Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed: Application crash while adding application shortcuts. #4167

Merged
merged 1 commit into from
Jan 19, 2025

Conversation

MohitMaliFtechiz
Copy link
Collaborator

Fixes #4166

  • The issue occurred because these shortcuts were defined in the manifest, which treated them as immutable and unable to be updated. We removed them from the manifest and added them as dynamic shortcuts. On some devices (e.g., Honor devices), it takes time to remove these shortcuts from the static shortcut list after the user updates the app, causing them to be treated as immutable and unable to be updated. This led to the crash. To fix this, we updated our shortcut IDs so that when the previous static shortcuts are removed by the OS, it will not affect the creation of the new dynamic shortcuts.
  • For previously added dynamic shortcuts on other devices, we implemented a removeOutdatedIdShortcuts() method, which removes the old dynamic shortcuts.
  • Using the ShortcutManagerCompat class to add dynamic shortcuts instead of directly using the ShortcutManager class, as it provides better handling for adding shortcuts.

Copy link

codecov bot commented Jan 7, 2025

Codecov Report

Attention: Patch coverage is 84.61538% with 2 lines in your changes missing coverage. Please review.

Project coverage is 56.97%. Comparing base (bcc6ac8) to head (08e004a).
Report is 6 commits behind head on main.

Files with missing lines Patch % Lines
...va/org/kiwix/kiwixmobile/main/KiwixMainActivity.kt 84.61% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #4167      +/-   ##
============================================
+ Coverage     56.91%   56.97%   +0.06%     
- Complexity     1523     1530       +7     
============================================
  Files           313      313              
  Lines         13437    13443       +6     
  Branches       1670     1671       +1     
============================================
+ Hits           7647     7659      +12     
+ Misses         4631     4626       -5     
+ Partials       1159     1158       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

* Using the `ShortcutManagerCompat` class to add dynamic shortcuts instead of directly using the `ShortcutManager` class, as it provides better handling for adding shortcuts.
* The issue occurred because these shortcuts were defined in the manifest, which treated them as immutable and unable to be updated. We removed them from the manifest and added them as dynamic shortcuts. On some devices (e.g., Honor devices), it takes time to remove these shortcuts from the static shortcut list after the user updates the app, causing them to be treated as immutable and unable to be updated. This led to the crash. To fix this, we updated our shortcut IDs so that when the previous static shortcuts are removed by the OS, it will not affect the creation of the new dynamic shortcuts.
* For previously added dynamic shortcuts on other devices, we implemented a removeOutdatedIdShortcuts() method, which removes the old dynamic shortcuts.
@kelson42 kelson42 merged commit ef1239f into main Jan 19, 2025
28 checks passed
@kelson42 kelson42 deleted the Fixes#4166 branch January 19, 2025 16:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Application crashes due to java.lang.IllegalArgumentException while creating the ApplicationShortcuts.
3 participants