android icon indicating copy to clipboard operation
android copied to clipboard

Add Sync Worker

Open alperozturk96 opened this issue 11 months ago • 6 comments
trafficstars

  • [x] Tests written, or not not needed

Changes:

• Fixed the issue of scheduling too many FileDownloadWorker instances for folder sync. • Improved file download status observation, including states like syncing, downloading, and downloaded. • Better constraints for worker • Enhanced folder sync progress observation in notifications. • Optimized performance using CoroutineWorker.

Demo New Notifications

https://github.com/user-attachments/assets/b9a93482-dbf0-4c18-9d3c-7fcfd974c9ff

Known Issues

https://github.com/nextcloud/android/issues/13906

alperozturk96 avatar Dec 12 '24 10:12 alperozturk96

Resolved the issue of retrieving sub-folder items for the selected folder. •

It is indented, to not flood the entire storage, if the folder is too big.

tobiasKaminsky avatar Feb 19 '25 08:02 tobiasKaminsky

Resolved the issue of retrieving sub-folder items for the selected folder. •

It is indented, to not flood the entire storage, if the folder is too big.

Fixed via https://github.com/nextcloud/android/pull/14166/commits/e8e1179136285436c3fc8f26ca8f3f174ad22d03

alperozturk96 avatar Feb 19 '25 14:02 alperozturk96

@jancborchardt While the user downloading the folder, I changed the notification icon and progress text. Is that acceptable to you?

alperozturk96 avatar Apr 08 '25 12:04 alperozturk96

Nice! Just some small things:

  • [x] Shouldn't the icon of the notification and the action that you clicked be the same?
  • [x] Neither icons really work for "Sync". How about we use the actual Material Design Sync icon? https://fonts.google.com/icons?icon.set=Material+Symbols&icon.size=24&icon.color=%235f6368&selected=Material+Symbols+Outlined:sync:FILL@1;wght@400;GRAD@0;opsz@24&icon.query=sync
  • [x] Instead of "1 / 5 - filename", can we use "1 of 5 · filename"? Bit more humanly readable with "of" and looks nicer with the middle dot instead of dash.

https://github.com/user-attachments/assets/5ad699a1-16ae-437d-af31-0cdd5c94398b

alperozturk96 avatar Jun 04 '25 10:06 alperozturk96

I just gave it a small smoke test: 2025-06-18-152539

From logs it seems that it had trouble with one file:

2025-06-18 15:25:20.425 21749-21898 Synchroniz...eOperation com.nextcloud.client                 I  Synchronizing [email protected], file /allTypes/gif.gif: Operation finished with HTTP status code -1 (success)
2025-06-18 15:25:23.813 21749-21925 FileDownloadWorker      com.nextcloud.client                 E  FilesDownloadWorker downloading: [email protected]/allTypes/gif.gif
2025-06-18 15:25:23.823 21749-21925 OwnCloudClient #0       com.nextcloud.client                 D  REQUEST GET /remote.php/dav/files/test/allTypes/gif.gif
2025-06-18 15:25:23.850 21749-21882 OwnCloudClient #0       com.nextcloud.client                 D  REQUEST GET /remote.php/dav/files/test/allTypes/gif.gif
2025-06-18 15:25:24.021 21749-21882 DownloadFi...eOperation com.nextcloud.client                 I  Download of /allTypes/gif.gif to /storage/emulated/0/Android/media/com.nextcloud.client/nextcloud/tmp/[email protected]/allTypes/gif.gif: Operation finished with HTTP status code 200 (success)
2025-06-18 15:25:24.022 21749-21882 DownloadFileOperation   com.nextcloud.client                 I  Download of /allTypes/gif.gif to /storage/emulated/0/Android/media/com.nextcloud.client/nextcloud/[email protected]/allTypes/gif.gif: Operation finished with HTTP status code 200 (success)
2025-06-18 15:25:24.022 21749-21882 SyncWorker              com.nextcloud.client                 D  Syncing file: /allTypes/gif.gif
2025-06-18 15:25:24.065 21749-21925 DownloadFi...eOperation com.nextcloud.client                 I  Download of /allTypes/gif.gif to /storage/emulated/0/Android/media/com.nextcloud.client/nextcloud/tmp/[email protected]/allTypes/gif.gif: Operation finished with HTTP status code 200 (success)
2025-06-18 15:25:24.065 21749-21925 DownloadFileOperation   com.nextcloud.client                 I  Download of /allTypes/gif.gif to /storage/emulated/0/Android/media/com.nextcloud.client/nextcloud/[email protected]/allTypes/gif.gif: Error while moving file to final directory
2025-06-18 15:25:46.130 21749-21995 ThumbnailsCacheManager  com.nextcloud.client                 D  generate thumbnail: gif.gif URI: https://nextcloud.kaminsky.me/index.php/core/preview?fileId=1890238&x=256&y=256&a=1&mode=cover&forceIcon=0
2025-06-18 15:25:46.133 21749-21749 OCFileListAdapter       com.nextcloud.client                 D  sharees of gif.gif: [ShareeUser(userId=jdl, displayName=jdl, shareType=USER)]

tobiasKaminsky avatar Jun 18 '25 13:06 tobiasKaminsky

@tobiasKaminsky The error message is not coming from SyncWorker, it's actually used by FileDownloadWorker. How did you encounter this issue? I’m unable to reproduce it. SyncWorker only downloads the first level of the folder hierarchy.

alperozturk96 avatar Jun 27 '25 10:06 alperozturk96

@jancborchardt I will update the PR thanks for the reminder.

alperozturk96 avatar Sep 04 '25 08:09 alperozturk96

Let’s first complete the following PR

https://github.com/nextcloud/android/pull/15540

alperozturk96 avatar Sep 09 '25 12:09 alperozturk96

@jancborchardt We can merge it after get approval from @tobiasKaminsky :)

How to test?

  1. Create a folder containing multiple files and subfolders.
  2. Initiate a folder sync.

The sync icon should be displayed for the folder itself and for its sub-files. Subfolders and the files within those subfolders should not be downloaded (because).

When the user reopens the app, the sync icons for the already downloaded folders and subfiles should remain visible.

alperozturk96 avatar Sep 25 '25 15:09 alperozturk96

blue-Light-Screenshot test failed, but no output was generated. Maybe a preliminary stage failed.

github-actions[bot] avatar Oct 15 '25 07:10 github-actions[bot]

Codacy

Lint

TypemasterPR
Warnings4542
Errors1111

SpotBugs

CategoryBaseNew
Bad practice4646
Correctness7374
Dodgy code267267
Experimental11
Internationalization77
Malicious code vulnerability22
Multithreaded correctness3535
Performance4947
Security1818
Total498497

github-actions[bot] avatar Oct 15 '25 07:10 github-actions[bot]

APK file: https://www.kaminsky.me/nc-dev/android-artifacts/14166.apk

qrcode

To test this change/fix you can simply download above APK file and install and test it in parallel to your existing Nextcloud app.

github-actions[bot] avatar Oct 15 '25 07:10 github-actions[bot]