Skip to content

BugFix - Offline Operation Conflict Handling #15027

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

Open
wants to merge 22 commits into
base: master
Choose a base branch
from

Conversation

alperozturk96
Copy link
Collaborator

@alperozturk96 alperozturk96 commented Jun 18, 2025

  • Tests written, or not not needed

This PR improves the handling of file and folder conflicts during offline operations.

Changes:

Removed the HashMap previously used in RefreshFolderOperation and OfflineOperationActionReceiver.
Conflict detection is now handled directly by OfflineOperationWorker.
Conflict detection logic checks if the target path already exists on the server. If it does, a conflict is assumed.

Handling Conflicts

Since offline operations do not have access to server-side metadata such as eTags, we cannot reliably compare local and remote versions of a file or folder. To prevent unintended overwrites: If the remote path exists, we treat it as a conflict.

Handling Create File & Create Folder

Users are prompted with a ConflictResolveDialog to choose how to proceed.

Handling Remove & Rename

User interaction is not allowed via ConflictResolveDialog:

These operations lack meaningful resolution options like "Keep Local."

For example, if a user modified a folder on the server and another offline operation attempted to delete the same folder, prompting the user to "keep local" would result in deleting the modified folder, which is not intuitive.

Supporting (Delete Folder, Delete File, Rename Folder, Rename File -- which files in the folder can be deleted which ones not etc.) these operations in the ConflictResolveDialog would introduce unnecessary complexity.

Instead:

Users are notified of the conflict via a notification.
The corresponding offline operation is removed from the database.
If the user still intends to rename or delete the file/folder, they can manually retry the operation.

@alperozturk96 alperozturk96 added the performance 🚀 Performance improvement opportunities (non-crash related) label Jun 18, 2025
@@ -57,32 +56,6 @@ class FileUploaderIntents(private val context: Context) {
)
}

fun resultIntent(resultCode: ResultCode, operation: UploadFileOperation): PendingIntent {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused function

@alperozturk96 alperozturk96 force-pushed the bugfix/offline-operation-conflict-handling branch 2 times, most recently from 542a8b0 to 7637906 Compare June 24, 2025 09:18
@alperozturk96 alperozturk96 added this to the Nextcloud App 3.32.0 milestone Jun 24, 2025
@alperozturk96 alperozturk96 force-pushed the bugfix/offline-operation-conflict-handling branch from 20698bd to 5d98ad4 Compare June 26, 2025 14:34
@alperozturk96 alperozturk96 removed this from the Nextcloud App 3.32.0 milestone Jul 2, 2025
alperozturk96 and others added 21 commits July 3, 2025 16:08
…tion if delete op successfully completed, change text delete offline folder to delete file or delete folder

Signed-off-by: alperozturk <[email protected]>
Signed-off-by: alperozturk <[email protected]>
Signed-off-by: alperozturk <[email protected]>
Signed-off-by: alperozturk <[email protected]>
Signed-off-by: alperozturk <[email protected]>
Signed-off-by: alperozturk <[email protected]>
Signed-off-by: alperozturk <[email protected]>
Signed-off-by: alperozturk <[email protected]>
Signed-off-by: alperozturk <[email protected]>
Signed-off-by: alperozturk <[email protected]>
Signed-off-by: alperozturk <[email protected]>
Signed-off-by: alperozturk <[email protected]>
Signed-off-by: alperozturk <[email protected]>
Signed-off-by: alperozturk <[email protected]>
Signed-off-by: alperozturk <[email protected]>
Signed-off-by: alperozturk <[email protected]>
Signed-off-by: alperozturk <[email protected]>
Co-authored-by: kramo <[email protected]>
Signed-off-by: Alper Öztürk <[email protected]>
@alperozturk96 alperozturk96 force-pushed the bugfix/offline-operation-conflict-handling branch from 2b6134b to 666c051 Compare July 3, 2025 14:08
Signed-off-by: alperozturk <[email protected]>
@nextcloud nextcloud deleted a comment from github-actions bot Jul 3, 2025
Copy link

github-actions bot commented Jul 3, 2025

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

Copy link

github-actions bot commented Jul 3, 2025

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
backport-request performance 🚀 Performance improvement opportunities (non-crash related)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants