Skip to content

Conversation

@alperozturk96
Copy link
Collaborator

@alperozturk96 alperozturk96 commented Jan 19, 2026

  • Tests written, or not not needed

Issue

After migrating file uploads from a foreground service to worker, the previous mechanism for notifying activities such as UploadListActivity and FileDisplayActivity via LocalBroadcastManager stopped 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 UploadListActivity and FileDisplayActivity, 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 FileUploadWorker finishes.
Restored previously working LocalBroadcastManager logic for notifying activities.
Removed FileUploadStarted and FileUploadCompleted worker states, as broadcasts are now used.
Broadcast receivers are registered in onStart and unregistered in onStop for proper lifecycle handling.
Added clear documentation to functions describing their purpose and expected triggers.
Adds file upload completion event for AutoUploadWorker.

Test

  1. When a user manually uploads a file or files or uploads files via AutoUploadWorker, FileDisplayActivity, UploadListActivity must 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.

@alperozturk96 alperozturk96 added the ux-enhancement Improvements that refine user interactions, accessibility, or overall usability label Jan 19, 2026
@alperozturk96 alperozturk96 mentioned this pull request Jan 20, 2026
1 task
@alperozturk96 alperozturk96 force-pushed the fix/upload-receivers branch 3 times, most recently from ee61c40 to ba4acc6 Compare January 26, 2026 10:36
@alperozturk96 alperozturk96 mentioned this pull request Jan 27, 2026
1 task
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>
@github-actions
Copy link

Codacy

SpotBugs

CategoryBaseNew
Bad practice4343
Correctness7474
Dodgy code260258
Experimental11
Internationalization77
Malicious code vulnerability33
Multithreaded correctness3434
Performance4343
Security1818
Total483481

Copy link
Collaborator

@ZetaTom ZetaTom left a 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.

Comment on lines +38 to +42
* ### Triggered when
* - [UploadFileOperation] added
*
* ### Observed by
* - [com.owncloud.android.ui.activity.UploadListActivity.UploadFinishReceiver]
Copy link
Collaborator

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().

fun sendFinished(
upload: UploadFileOperation,
uploadResult: RemoteOperationResult<*>,
unlinkedFromRemotePath: String?,
Copy link
Collaborator

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.

alperozturk96 and others added 3 commits January 29, 2026 15:09
…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>
@alperozturk96
Copy link
Collaborator Author

/backport to stable-3.35

@alperozturk96 alperozturk96 merged commit 79c73bf into master Jan 29, 2026
11 of 19 checks passed
@alperozturk96 alperozturk96 deleted the fix/upload-receivers branch January 29, 2026 14:10
@github-actions
Copy link

APK file: https://www.kaminsky.me/nc-dev/android-artifacts/16317.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
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review ux-enhancement Improvements that refine user interactions, accessibility, or overall usability

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants