Anki-Android icon indicating copy to clipboard operation
Anki-Android copied to clipboard

Fix: Sync Media Fail Notifications are expandable and copyable

Open LUwUcifer opened this issue 6 months ago • 9 comments

Purpose / Description

SyncMediaWorker fail throwable notification could not be expanded or opened

Fixes

  • Fixes #20826

Approach

  1. Adds attribute .bigText to make text expandable
  2. Adds addAction for a button that copies error message and instantly closes the message upon the action
  3. Uses a custom receiver for serving pendingIntent required for addAction

How Has This Been Tested?

Tested on local device

Learning (optional, can help others)

  1. https://stackoverflow.com/questions/14291436/copy-to-clipboard-by-notification-action#14294660
  2. https://developer.android.com/develop/ui/views/touch-and-input/copy-paste#Copying
  3. https://developer.android.com/develop/ui/views/notifications/build-notification#Actions

Checklist

  • [X] You have a descriptive commit message with a short title (first line, max 50 chars).
  • [ ] You have commented your code, particularly in hard-to-understand areas
  • [X] You have performed a self-review of your own code
  • [ ] UI changes: include screenshots of all affected screens (in particular showing any new or changed strings)
  • [ ] UI Changes: You have tested your change using the Google Accessibility Scanner

LUwUcifer avatar May 07 '26 14:05 LUwUcifer

Second commit may not be fully optimised, requesting review

LUwUcifer avatar May 07 '26 14:05 LUwUcifer

How Has This Been Tested?

Tested on local device

Describe that appropriately and/or send a video or screenshot

BrayanDSO avatar May 08 '26 11:05 BrayanDSO

IMG_20260508_164622.jpg

LUwUcifer avatar May 08 '26 11:05 LUwUcifer

bigText allows for display of the entire error message, copy to clipboard - copies to clipboard

LUwUcifer avatar May 08 '26 11:05 LUwUcifer

Hello 👋, this PR has had no activity for more than 2 weeks and needs a reply from the author. If you think this is a mistake please comment and ping a maintainer to get this merged ASAP! Thanks for contributing! You have 7 days until this gets closed automatically

github-actions[bot] avatar May 22 '26 11:05 github-actions[bot]

@BrayanDSO

LUwUcifer avatar May 22 '26 11:05 LUwUcifer

This still has a flagged security vulnerability:

https://github.com/ankidroid/Anki-Android/security/code-scanning/35

david-allison avatar May 22 '26 20:05 david-allison

Hey david I saw that persisting error but couldn't figure out how to rectify it as other examples of usages of intent within the project follow the same syntax, I'll need some guidance on the same

LUwUcifer avatar May 29 '26 00:05 LUwUcifer

Hello 👋, this PR has had no activity for more than 2 weeks and needs a reply from the author. If you think this is a mistake please comment and ping a maintainer to get this merged ASAP! Thanks for contributing! You have 7 days until this gets closed automatically

github-actions[bot] avatar Jun 19 '26 10:06 github-actions[bot]

Should be fine now, I didn't implement support for other languages/runes since I assume stacktrace will necessarily be in english, lmk if i should

LUwUcifer avatar Jun 26 '26 22:06 LUwUcifer

Hmm... Can't reopen this

david-allison avatar Jun 27 '26 09:06 david-allison