introduce SyncProgressNotifier
Description
Make eDrive notification to display remaining files to sync. The notification should be updated each time that a synchronization is finished.
Screenrecords
Technical details
The notification takes time to be displayed and thus some files are already synchronized so the amount display in the notification is not the same as the amount of file to sync at the beginning.
By example: Let's say eDrive found 15 files to synchronize. It will start doing this job, and the notification will only appears after 30 sec (not a real value). During this timeframe, eDrive synchronized 7 files. Then the notification will display: 8 files to sync.
Implementations details
Extracted notification code from SyncWorker.kt into a dedicated class: SyncProgressNotifier and rely on an AtomicInteger in SyncWorker to count remaining pending request.
SyncWorker.kt use it to create notification channel, create ForegroundInfo and build the initial notification. Then SyncTask.kt call it to send a notification each time that a request is finished (in success or in failure).
Tests
-
run synchronization with many files to synchronize
Issues
https://gitlab.e.foundation/e/os/backlog/-/issues/1751