Refactor: Unified Auto Upload Architecture#129
Refactor: Unified Auto Upload Architecture#129PhilippThaler wants to merge 2 commits intoopencloud-eu:mainfrom
Conversation
|
Could u squash those commits? |
|
please solve this issues, then squash into 1 commit. |
bf88ed6 to
f296ed2
Compare
|
Is it rebased now? |
|
Squashed the current branch into 1 commit. The old branch has upstream merge commits in its history, so squashing it cleanly would be tricky — left it as-is for now. Happy to adjust if needed! |
f296ed2 to
7357a78
Compare
|
What matters here is that the target folder can belong to a different Space, and the transfer needs to keep both the folder path and the
For camera upload targets we store both A small fix would be to persist the refreshed ocTransfer = ocTransfer.copy(
remotePath = uploadPath,
spaceId = latestConfig.spaceId,
)
transferRepository.updateTransfer(ocTransfer)Right now we only do this: ocTransfer = ocTransfer.copy(remotePath = uploadPath)
transferRepository.updateTransferRemotePath(uploadIdInStorageManager, uploadPath)So a queued upload can end up using the new folder path with the old Space WebDAV base.
The retry path passes At minimum, retries should not pass the file URI as the auto-upload source: val autoUploadSourcePath = when (uploadToRetry.createdBy) {
UploadEnqueuedBy.ENQUEUED_AS_AUTOMATIC_UPLOAD_PICTURE,
UploadEnqueuedBy.ENQUEUED_AS_AUTOMATIC_UPLOAD_VIDEO -> null
else -> uploadToRetry.sourcePath
}If we want retries to recalculate against the latest config, then the watched tree URI needs to be stored separately. Passing the individual file URI cannot work for that lookup. |
|
I think two things are still off here.
The old picture and video screens excluded accounts with That should probably stay filtered, something like: availableAccounts = userQuotas
.filter { it.available != -4L }
.map { it.accountName }
Right now the sub settings stay active even when the main switch is off. That means changing Wi-Fi, charging, source, account, or behavior can still flow into The old screen blocked that by disabling the child preferences together with the main toggle, and I think that behavior still makes sense here. |
7357a78 to
7bce16b
Compare
|
can u make sure that theres 1-2 commits instead 9 commits? i think u squashed but the old commits still appear |
7bce16b to
ec3da3e
Compare
- Replace separate picture/video upload fragments with unified SettingsAutoUploadFragment - Add AutoUploadPathBuilder for dynamic upload paths with subfolders (YEAR, YEAR_MONTH, YEAR_MONTH_DAY) - Refactor AutomaticUploadsWorker to support multiple folder backup configurations - Update dependency injection modules for unified architecture - Add UseSubfoldersBehaviour enum and integrate into FolderBackUpConfiguration - Fix database migration: replace broken MIGRATION_43_44 with defensive MIGRATION_49_50 - Set legacy migration default to NONE to preserve existing user behavior - Update tests and copyright headers Review fixes: - Persist spaceId when refreshing upload path from latest config - Fix retry source path for auto-uploads (use null instead of file URI) - Filter out light-user accounts (available == -4L) from account picker - Disable child preferences when auto upload main toggle is off
ec3da3e to
fc65e87
Compare
Built upon #56 and based on #124
So there aren't that many changes if #56 is merged first
Summary
This PR is mostly about refactoring the background workers to use a unified upload architecture. Instead of having "Picture" and "Video" logic hardcoded everywhere, the background sync is now entirely driven by the configuration itself.
This gives us a much cleaner foundation so we can eventually support custom folders and other features for auto uploading in the future.
While creating this, I also fixed a few edge cases, I ran into where settings would overwrite each other, or where files would end up in the wrong folder if you changed your settings while waiting for Wi-Fi.
What changed
How to test
• Turn on auto-uploads with subfolders, take a pic/video, and make sure it still works exactly like it did in Feature: Add Subfolder Strategy for Automatic Uploads #56. The unified logic shouldn't break anything.
• Turn on auto-uploads (Wi-Fi only) and turn off your Wi-Fi.
• Take a picture/video so it gets queued up.
• Go into the app settings and change the destination folder.
• Turn Wi-Fi back on.
• Verify: It should upload to the new folder, and the Uploads tab should update to show the new folder right as it starts.
• Set up both Picture and Video auto-uploads for the exact same local folder (e.g., /DCIM/Camera) but with different target folders on the server.
• Trigger an auto-upload.
• Verify: The picture and video configs should stay completely separate and not overwrite each other in the database anymore.
So this