feat(downloads): add manual sync button for sync rules#1197
Open
Darkmadda wants to merge 4 commits into
Open
Conversation
The downloads page had no way to force sync-rule evaluation on demand — rules only ran on app resume, connectivity reconnect, watch-state change, or offline-sync drain. Add a "Sync now" action to the downloads app bar that forces an immediate reconcile. Extract the global reconcile path (refresh metadata, delete watched downloads when the autoRemoveWatchedDownloads setting is on, queue missing episodes for every enabled rule) into DownloadProvider.syncAllRules, and move the run-guard out of main.dart into a notifying isReconciling flag on the provider. The automatic global path delegates to syncAllRules; the targeted per-watch-event path is unchanged aside from sharing the guard. reconcileNow wraps syncAllRules with the guard and force=true for the button. The button appears only when online and at least one enabled rule exists, shows a spinner while any reconcile (manual or automatic) is in flight, and reports the outcome via snackbar (queued/removed counts, or "up to date"). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…nloads_manual_sync_button # Conflicts: # lib/i18n/strings.g.dart
# Conflicts: # lib/i18n/strings.g.dart # lib/providers/download_provider.dart
…ownloads_manual_sync_button # Conflicts: # lib/i18n/strings.g.dart
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.
Problem
The downloads page had no way to force sync-rule evaluation on demand. Sync rules ("keep N unwatched" etc.) only reconciled automatically — on app resume, connectivity reconnect, watch-state change, or offline-sync drain. There was no manual trigger.
Fix
Add a "Sync now" action to the downloads app bar (left of the rule-settings gear,
Symbols.sync) that forces an immediate reconcile: refresh metadata → delete watched downloads (only when theautoRemoveWatchedDownloadssetting is on) → queue missing episodes for every enabled rule.Architecture
DownloadProvider.syncAllRules(...), returning aSyncReconcileSummary(queued + deleted counts).main.dartinto a notifyingisReconcilingflag on the provider (beginReconcile/endReconcile), so manual and automatic syncs never overlap and the button can reflect in-progress state.main.dart's automatic global path now delegates tosyncAllRules; the targeted per-watch-event path is unchanged aside from sharing the guard.reconcileNow(...)wrapssyncAllRuleswith the guard andforce: truefor the button.Behavior
autoRemoveWatchedDownloadssetting — identical semantics to the automatic reconcile, just on demand. No new "trim excess unwatched" deletion.i18n
Added
downloads.syncNow,downloads.downloadsUpToDate,downloads.syncCompleteto the base locale (others fall back viafallback_strategy: base_locale).Testing
Existing
sync_rule_executortest suite passes; analyzer clean. Verified manually: pressing Sync queues missing episodes and (with the setting on) removes watched downloads, shows the correct summary snackbar, shows "up to date" on a no-op, hides when the rule is disabled or offline, and spins during an in-flight sync.🤖 Generated with Claude Code