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: Download notification disappears when pausing a download. #4210

Merged
merged 2 commits into from
Feb 6, 2025

Conversation

MohitMaliFtechiz
Copy link
Collaborator

@MohitMaliFtechiz MohitMaliFtechiz commented Feb 5, 2025

Fixes #4207

  • The Fetch library automatically removes the ongoing download notification when a download is paused. To improve the user experience, we have implemented custom logic to display a notification for paused downloads, allowing users to easily resume them.
  • Additionally, Android 14 introduces a change that prevents non-dismissible notifications see for more details https://developer.android.com/about/versions/14/behavior-changes-all#non-dismissable-notifications. This means users can now dismiss notifications by swiping left or right. Since our app uses a foreground service for downloads, we must always display a notification. To handle this, we have implemented a mechanism that automatically adds the last notification to our foreground service to satisfy its need when no download is ongoing, and the user can still cancel it on Android 14 and above.
screen-20250205-145841.mp4

Copy link

codecov bot commented Feb 5, 2025

Codecov Report

Attention: Patch coverage is 60.71429% with 33 lines in your changes missing coverage. Please review.

Project coverage is 56.88%. Comparing base (256896f) to head (6d407fc).
Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
...wnloader/downloadManager/DownloadMonitorService.kt 0.00% 21 Missing and 4 partials ⚠️
...ownloadManager/FetchDownloadNotificationManager.kt 84.61% 4 Missing and 4 partials ⚠️

❌ Your patch status has failed because the patch coverage (60.71%) is below the target coverage (70.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #4210      +/-   ##
============================================
- Coverage     56.90%   56.88%   -0.03%     
- Complexity     1542     1544       +2     
============================================
  Files           313      313              
  Lines         13515    13590      +75     
  Branches       1695     1703       +8     
============================================
+ Hits           7691     7730      +39     
- Misses         4653     4685      +32     
- Partials       1171     1175       +4     

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

@kelson42
Copy link
Collaborator

kelson42 commented Feb 5, 2025

I don't rhink this is a good idea to bring back a notification the user has explicitly dismiss. We should not bring it back and user should rhen go to kiwix to handle his download.

* The Fetch library automatically removes the ongoing download notification when a download is paused. To improve the user experience, we have implemented custom logic to display a notification for paused downloads, allowing users to easily resume them.
* Additionally, Android 14 introduces a change that prevents non-dismissible notifications. This means users can now dismiss notifications by swiping left or right. Since our app uses a foreground service for downloads, we must always display a notification. To handle this, we have implemented a mechanism that detects when a paused download notification is dismissed. If the download is still in a paused state, the notification will be re-displayed to ensure users can resume their downloads.
…proved the setting of foreground notification when all other downloads are paused.
@MohitMaliFtechiz
Copy link
Collaborator Author

I don't rhink this is a good idea to bring back a notification the user has explicitly dismiss. We should not bring it back and user should rhen go to kiwix to handle his download.

@kelson42 I have removed the again showing of notification and updated the PR description.

@kelson42 kelson42 merged commit c1a3b2b into main Feb 6, 2025
30 of 31 checks passed
@kelson42 kelson42 deleted the Fixes#4207 branch February 6, 2025 05:49
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.

Why download notification disappears when pause?
3 participants