-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
fix(receivers): upload #16317
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
fix(receivers): upload #16317
Conversation
1cbea54 to
de0cba5
Compare
ee61c40 to
ba4acc6
Compare
ba4acc6 to
c1ff6b1
Compare
Signed-off-by: alperozturk96 <alper_ozturk@proton.me>
Signed-off-by: alperozturk96 <alper_ozturk@proton.me>
Signed-off-by: alperozturk96 <alper_ozturk@proton.me>
Signed-off-by: alperozturk96 <alper_ozturk@proton.me>
Signed-off-by: alperozturk96 <alper_ozturk@proton.me>
Signed-off-by: alperozturk96 <alper_ozturk@proton.me>
Signed-off-by: alperozturk96 <alper_ozturk@proton.me>
Signed-off-by: alperozturk96 <alper_ozturk@proton.me>
c1ff6b1 to
71a2ed3
Compare
ZetaTom
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall everything seems to work nicely. I've added a few minor suggestions to rephrase some comments.
One thing we need to discuss further is what users expect to see when they upload a file - should the UI reflect that immediately, or should it only be updated in batches (current behaviour). However, this discussion is entirely out of scope for this pull request and a separate issue will be opened for that.
app/src/main/java/com/nextcloud/client/jobs/upload/FileUploadBroadcastManager.kt
Outdated
Show resolved
Hide resolved
| * ### Triggered when | ||
| * - [UploadFileOperation] added | ||
| * | ||
| * ### Observed by | ||
| * - [com.owncloud.android.ui.activity.UploadListActivity.UploadFinishReceiver] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if we should keep track of the calling and receiving functions, as they might change in the future. We would then have remember to manually adjust these comments.
Same for sendStarted() and sendFinished().
app/src/main/java/com/nextcloud/client/jobs/upload/FileUploadBroadcastManager.kt
Outdated
Show resolved
Hide resolved
| fun sendFinished( | ||
| upload: UploadFileOperation, | ||
| uploadResult: RemoteOperationResult<*>, | ||
| unlinkedFromRemotePath: String?, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure what this variable name refers to. I think we should either change this name or add a short explanation.
app/src/main/java/com/nextcloud/client/jobs/upload/FileUploadBroadcastManager.kt
Outdated
Show resolved
Hide resolved
…roadcastManager.kt Co-authored-by: Tom <70907959+ZetaTom@users.noreply.github.com> Signed-off-by: Alper Öztürk <67455295+alperozturk96@users.noreply.github.com>
…roadcastManager.kt Co-authored-by: Tom <70907959+ZetaTom@users.noreply.github.com> Signed-off-by: Alper Öztürk <67455295+alperozturk96@users.noreply.github.com>
…roadcastManager.kt Co-authored-by: Tom <70907959+ZetaTom@users.noreply.github.com> Signed-off-by: Alper Öztürk <67455295+alperozturk96@users.noreply.github.com>
|
/backport to stable-3.35 |
|
APK file: https://www.kaminsky.me/nc-dev/android-artifacts/16317.apk |
|
blue-Light-Screenshot test failed, but no output was generated. Maybe a preliminary stage failed. |

Issue
After migrating file uploads from a foreground service to worker, the previous mechanism for notifying activities such as
UploadListActivityandFileDisplayActivityviaLocalBroadcastManagerstopped functioning correctly.Specifically:
Once an upload completes, the adapters (
OCFileListAdapter,UploadListAdapter) are not refreshed with the updated data.Upload start and completion events were not correctly triggered in
UploadListActivityandFileDisplayActivity, preventing proper UI updates.Changes
Ensured worker state is correctly updated in finally blocks to maintain consistency.
The adapter is now notified correctly when the
FileUploadWorkerfinishes.Restored previously working
LocalBroadcastManagerlogic for notifying activities.Removed
FileUploadStartedandFileUploadCompletedworker states, as broadcasts are now used.Broadcast receivers are registered in
onStartand unregistered inonStopfor proper lifecycle handling.Added clear documentation to functions describing their purpose and expected triggers.
Adds file upload completion event for
AutoUploadWorker.Test
AutoUploadWorker,FileDisplayActivity,UploadListActivitymust display an updated list after the file or files upload completion. The adapter must not be triggered excessively; it must be triggered only batch by batch.Impact
With this change, users can see updates in real time in the file list and upload list tabs.