Skip to content

Surface Sync Results in the Flutter UI (Not Just in the Settings Screen) #17

@TheZupZup

Description

@TheZupZup

Overview

Context: The sync engine is fully implemented in the Python backend (nexanote/sync/). The Flutter app can trigger a sync via AppState.triggerSync()POST /sync/trigger, and read the last sync report via ApiClient.getSyncStatus()GET /sync/status (returns notes_pulled, notes_pushed, conflicts_resolved, duration_seconds).

The gap: All sync feedback is buried inside SettingsScreen. The rest of the app has no idea whether sync succeeded, failed, or produced conflicts. The NotebookSidebar header has a sync button that calls triggerSync() but gives no feedback at all.

This issue brings sync results into the main UI.

What needs to be done

  • After triggerSync() completes (in AppState or where the sync button is pressed), call getSyncStatus() and store the result in AppState (e.g., add _lastSyncReport field)
  • In NotebookSidebar (notebook_sidebar.dart), after the sync button is tapped and completes, show a SnackBar with a summary: e.g., "Sync complete — 3 pushed, 1 pulled" or "Sync failed"
  • If conflicts_resolved > 0, show a different message: "Sync complete — ⚠️ 2 conflicts resolved" so the user knows something was auto-resolved
  • If the sync API call itself fails (backend error or network issue), show a SnackBar with "Sync failed — check your WebDAV settings"
  • Update the sync button icon to show a loading spinner while sync is in progress (use _isSyncing bool in AppState)

Goal

When the user taps the sync button, they see visual feedback: a spinner while it runs, then a snackbar saying how many notes were pushed/pulled, and a warning if any conflicts were resolved — all without needing to open Settings.

Where to look

  • app/lib/widgets/notebook_sidebar.dart — sync button is here
  • app/lib/services/app_state.darttriggerSync() method, add _lastSyncReport and _isSyncing
  • app/lib/services/api_client.darttriggerSync() and getSyncStatus() already exist
  • app/lib/screens/settings_screen.dart — reference for how sync results are currently displayed

Testing steps

  • Tap the sync button — verify a loading spinner appears on the button
  • After sync completes — verify a snackbar appears with the push/pull count
  • Configure invalid WebDAV credentials and tap sync — verify an error snackbar appears
  • Trigger a sync that resolves a conflict — verify the warning message appears

Related to: #8, #25, #26, #28

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions