feat(autoupload): add manual scan action - #1
Closed
ohthehugemanatee wants to merge 2 commits into
Closed
Conversation
ohthehugemanatee
force-pushed
the
claude/nextcloud-android-15782-othk5f
branch
from
August 11, 2026 21:21
6fb3244 to
f4fe9dd
Compare
ohthehugemanatee
force-pushed
the
claude/nextcloud-android-15782-othk5f
branch
from
August 12, 2026 03:51
68c647d to
fe9c987
Compare
Auto upload is only woken by the OS content observer, app start and folder configuration changes; there is no periodic scan job. When the content observer misses a file, nothing ever re-walks the folder and the file stays unuploaded. Add a "Scan for missing files" item to the Auto upload screen overflow menu that starts the auto upload worker for every enabled synced folder with overridePowerSaving set, which bypasses the power-saving and scan interval early exits so the folder is re-walked immediately. Assisted-by: ClaudeCode:claude-opus-5 Signed-off-by: Campbell Vertesi <campbell@vertesi.com>
FilesSyncHelper.startAutoUploadForEnabledSyncedFolders had no coverage. Assert that it starts auto upload only for enabled synced folders and that overridePowerSaving reaches the job manager, which is what the new manual scan action relies on. Assisted-by: ClaudeCode:claude-opus-5 Signed-off-by: Campbell Vertesi <campbell@vertesi.com>
ohthehugemanatee
force-pushed
the
claude/nextcloud-android-15782-othk5f
branch
from
August 12, 2026 04:14
fe9c987 to
317ab09
Compare
Owner
Author
|
this PR on my fork is only for validation purposes. The real PR is #nextcloud/android/17462 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Addresses nextcloud#15782 — "Auto upload - Button to manually scan files in the file system and re-upload missing files."
Auto upload is only woken by three things:
ContentObserverWork(the OS content-URI trigger), app start whenstartAutoUploadOnStart()is set, and saving/toggling a folder configuration. There is no periodic scan job —JOB_PERIODIC_FILES_SYNCis declared inBackgroundJobManagerImplbut never scheduled. So when the content observer misses a file, nothing ever re-walks the folder and the file stays unuploaded indefinitely. The only user-facing workaround today is deleting an auto-upload configuration and recreating it with "also upload existing files".AutoUploadWorkeralready performs a complete rescan on every run (AutoUploadHelper.insertEntries()walks MediaStore for image/video folders andFiles.walkFileTreefor custom folders). It just refuses to start unless something wakes it:canExitEarly()returns early on power saving or an unelapsed scan interval, both of which are bypassed byoverridePowerSaving.This adds a Manual scan item to the Auto upload screen's overflow menu that calls the existing
FilesSyncHelper.startAutoUploadForEnabledSyncedFolders(..., overridePowerSaving = true)for every enabled synced folder — the same callContentObserverWorkmakes, only forced. No new worker, no new job, no new scan logic; the feature itself is 20 lines across three files.Deliberate scope limits, kept out to keep the diff minimal:
filesystemtable already records asfileSentForUpload = 1are not re-queued, so a file the DB believes uploaded but that is absent server-side is not recovered. That would need a force-rescan flag threaded throughBackgroundJobManager→AutoUploadWorker→AutoUploadHelper→FileSystemRepository→SyncedFolder.shouldSkipFile, plus a DAO reset.startAutoUploadenqueues withExistingWorkPolicy.KEEP, so if a sync for a folder is already queued the manual request coalesces into it.🖼️ Screenshots
Not captured — the change was made in a headless environment with no Android SDK or emulator. The new entry is a standard overflow menu item in the Auto upload screen; the ⋮ button already existed, and the existing screenshot baselines capture the empty-list view and dialogs rather than an expanded menu, so no baseline should shift.
🏁 Checklist
/backport to stable-xx.xOn tests:
FilesSyncHelperTestcoversstartAutoUploadForEnabledSyncedFolders, which had no test coverage at all despite being the dispatch point for every auto-upload trigger in the app. It asserts that onlyisEnabledfolders are started and thatoverridePowerSavingreaches the job manager — the behaviour the manual scan action depends on, since this is the first caller to passtrue.The menu wiring itself is not covered. No test in this codebase asserts that a menu item exists or is handled (across 84 instrumented test files there is no
findItem,R.menu.oronCreateOptionsMenuusage), so a menu-presence test would be out of pattern and would mostly restate the XML. Happy to add one if reviewers disagree.Nothing here has been executed. Gradle cannot run in the environment this branch was written in: the network policy blocks
dl.google.com, the only host serving the Android Gradle Plugin (maven.google.com301-redirects there), and there is no Android SDK installed. Solint,detekt,spotlessKotlinCheck,spotbugsGplayDebugand both test suites were skipped. Before submitting, please run:🤖 AI (if applicable)
Generated with Claude Code; both commits carry an
Assisted-by:trailer. Needs your review, your own PR description, and yourSigned-off-bybefore submission.