Skip to content

feat(downloads): add manual sync button for sync rules#1197

Open
Darkmadda wants to merge 4 commits into
edde746:mainfrom
Darkmadda:feat/downloads_manual_sync_button
Open

feat(downloads): add manual sync button for sync rules#1197
Darkmadda wants to merge 4 commits into
edde746:mainfrom
Darkmadda:feat/downloads_manual_sync_button

Conversation

@Darkmadda

Copy link
Copy Markdown
Contributor

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 the autoRemoveWatchedDownloads setting is on) → queue missing episodes for every enabled rule.

Architecture

  • Extracted the global reconcile path into DownloadProvider.syncAllRules(...), returning a SyncReconcileSummary (queued + deleted counts).
  • Moved the run-guard out of main.dart into a notifying isReconciling flag 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 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.

Behavior

  • The button appears only when online and at least one enabled rule exists.
  • While any reconcile (manual or automatic) is in flight it shows a spinner and is disabled — focus is preserved since the action count doesn't change.
  • Reports the outcome via snackbar: queued/removed counts, or "Downloads are up to date" on a no-op.
  • Respects the autoRemoveWatchedDownloads setting — identical semantics to the automatic reconcile, just on demand. No new "trim excess unwatched" deletion.

i18n

Added downloads.syncNow, downloads.downloadsUpToDate, downloads.syncComplete to the base locale (others fall back via fallback_strategy: base_locale).

Testing

Existing sync_rule_executor test 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

Darkmadda and others added 4 commits May 30, 2026 01:00
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants