Skip to content

feat(sync): sync page redesign — quiet card, filter chips, sync→conversation copy - #7404

Merged
mdmohsin7 merged 43 commits into
mainfrom
worktree-sync-page-redesign
May 20, 2026
Merged

mdmohsin7 merged 43 commits into
mainfrom
worktree-sync-page-redesign

Conversation

@mdmohsin7

Copy link
Copy Markdown
Member

What

A focused redesign of the auto-sync page that drops the heavy 3-tier pipeline card, the per-row colored circle, and the "back up" language model in favor of a quieter, type-first layout grounded in what the product actually does — sync recordings to Omi so a Conversation is created.

UI changes

Status card

  • Single quiet card at the top, no Material cloud / wifi-off / error icons.
  • Multi-line layout on progress states so Downloading from Omi and 4 of 12 sit on their own lines instead of crowding the Cancel pill.
  • Spinner is the only motion cue; only actionable states render a pill.
  • States: All synced • N ready to sync • Uploading to Omi · X of Y • Downloading from Omi · X of Y • Processing on Omi • Waiting for internet • N need attention.

Recordings list

  • All / Pending / Synced filter chips above the list (local state, resets on leaving).
  • Newest-first hint next to the section header; count follows the active filter.
  • Type-first rows: no leading colored circle, no Material chevron. Title is the date/time/duration; subtitle is the status.
  • Synced rows say Conversation created (not "Backed up").
  • On-device WALs say Waiting on Omi / Downloading from Omi instead of the misleading "Waiting to sync".
  • Trailing slot: small purple spinner while syncing, Retry pill on failed/retrying, FA chevron otherwise.
  • Active subtitle is neutral grey (not purple) — purple stays reserved for spinner + pill buttons.

Settings rows

  • iOS-style right-aligned On / Off text + FA chevron; no green/grey pill chips.

Info sheet ("How syncing works")

  • Rewritten around the real flow: Sync (Your recording is sent to Omi's server) → Transcribe (Omi turns the audio into a conversation) → Conversation ready (Find it under Conversations).
  • Plain prose, numbered steps — no colored icon bubbles.

Icons

  • Material info_outline, more_horiz, check, error_outline → FontAwesome circleInfo, ellipsis, check, circleExclamation to match the rest of the app.

Reliability fix bundled in this PR

ConversationDetailProvider.conversation used to throw StateError("No valid conversation found") from a property getter. When that throw fired from inside Consumer.builder in the AppBar, Flutter cascaded a chain of "given an infinite size during layout" errors that masked the root cause. Added:

  • ConversationDetailProvider.conversationOrNull — non-throwing sibling that performs the same lookup but returns null instead of raising.
  • _ConversationDetailPageState.build defensive guard — if the conversation can't be resolved, pop the route on the next frame and render an empty Scaffold so the AppBar trailing slot never sees the throw.

The throwing conversation accessor is preserved as a thin wrapper so non-build call sites (gestures, async handlers) still loudly fail on impossible states.

i18n

  • 23 new keys (status card states, info-sheet flow, on-device row subtitles, filter empty state, newest-first hint).
  • 10 reframed keys (dropped "back up / backed up" framing).
  • All 48 non-English locales translated. flutter gen-l10n emits zero untranslated message(s) warnings.

Verification

  • flutter analyze app/lib/pages/conversations/auto_sync_page.dart → clean.
  • flutter gen-l10n → zero untranslated.
  • Tested on-device by the user during development; this PR is opened as a draft so it can run through the standard checks before merging.

Commits in this PR

  • feat(sync): redesign sync page — multi-line status card, filter chips, FA icons, restrained color budget
  • fix(conversation-detail): add non-throwing conversationOrNull getter
  • fix(conversation-detail): pop the route instead of crashing when conversation is unresolved
  • i18n(sync): EN — reframe sync copy to sync→conversation model
  • i18n(sync): translate new + reframed sync strings across 48 locales
  • chore(l10n): regenerate AppLocalizations for sync redesign keys

🤖 Generated with Claude Code

mdmohsin7 added 30 commits May 19, 2026 22:16
…ryCount

Single source of truth for how a recording's sync state is shown to the
user: syncing / synced / waiting / retrying / failed / corrupted. Lets the
UI render an explicit label per recording so a not-yet-synced item is never
visually identical to a failed one.
displaySortedWals, per-state counts, walsForDisplayFilter() and the
WalDisplayFilter enum. Purely additive — the legacy WalStatusFilter /
pendingWals / syncedWals API is untouched so the older SyncPage is
zero-risk.
- Always-visible status header (All backed up / Backing up N / N waiting /
  N need attention) — synced work is no longer hidden behind a tab, and
  the all-synced state is persistent completion feedback.
- Replace binary Pending/Synced tabs with one unified list + an
  All/Pending/Synced/Issues filter (default All).
- Every row carries an explicit status icon + colored label, so waiting,
  retrying, failed, corrupted and synced are visually distinct.
- Per-row Retry action on failed recordings; localize the
  previously-hardcoded 'Sync in progress' string.
13 new keys: status header summaries, per-row sync status labels,
filter chip labels, empty state. Non-English locales fall back to
English until translations land (follow-up).
flutter gen-l10n output. Non-English locales currently English-fallback
for the 13 new keys; native translations are a tracked follow-up.
The unified list renders all recordings in a single Column; two Wals can
share id (device_timerStart) across storage copies, producing duplicate
keys -> 'Duplicate keys found' assertion and a cascade of layout errors.
Suffix the key with the row index to guarantee uniqueness.
The client now uploads audio, marks the recording 'uploaded', and reconciles
it against the job_id later (out of the upload critical path). A 24h TTL
covers the common once-a-day app-open pattern so the app can learn a job
already succeeded and fetch conversation ids instead of re-uploading.

Efficiency window only — client retains the local file until synced, so an
expired job is a safe re-upload (server dedups by timestamp). STALE_THRESHOLD
left at 600s (separate in-flight liveness guard).
New 'uploaded' state = audio safely received by the server (HTTP 202),
job processing in the background, NOT yet confirmed and NOT deletable.
jobId/uploadedAt persist so a background reconciler can resolve the job
across navigation and app-kill. Backward compatible (defaults null/0).
Adds the WalSyncDisplayState.uploaded case to _rowVisual (keeps the
exhaustive switch valid): 'Uploaded · processing on Omi', cloud-sync icon,
neutral blue — visually distinct from waiting/synced/failed.
…chSyncJobStatus)

uploadLocalFilesV2 returns at the 202 (jobId) or the 200 fast-path
(finished result) — no polling. fetchSyncJobStatus does a single GET and
classifies the outcome (ok / notFound=expired-or-unknown / transient) so
the reconciler can own the polling cadence and the re-upload fallback.
Old polling syncLocalFilesV2 kept until callers migrate (Steps 3 & 6).
…ssing)

syncAll/syncWal now POST and return at the 202 (or 200 fast-path) instead
of polling each batch to terminal before the next. On 202: stamp the shared
jobId + uploadedAt and set status=uploaded; the reconciler resolves the job
out of the critical path. On 200 fast-path: mark synced + surface results as
before. On upload failure: stay 'miss' (retryable next sync).

Also fixes two latent bugs in the original loop:
- corrupted WALs in an otherwise-successful batch were wrongly marked synced
  (post-loop iterated the whole [left,right] range); now only WALs that
  actually became files are mutated.
- single syncWal could throw LateInitializationError on a missing file
  (late File walFile never assigned); now guarded with an early return.

Cancel no longer reverts already-'uploaded' WALs (safe on server).
Groups uploaded WALs by shared jobId, polls each job (bounded concurrency):
completed -> synced + surface conversation ids; partial/failed -> revert to
miss + retry++ (server dedups already-done segments); 404/expired -> re-upload
if local file kept, else corrupted; transient -> leave for next pass.
Idempotent; only touches 'uploaded' WALs so it never contends with the
upload loop (which only touches 'miss').
…mer)

Drives reconcileUploadedWals off the critical path: on-demand poke
(startup/screen/after-upload), debounced, with a 20s->2m backoff timer
while any recording is still 'uploaded'. Scheduling only; conversation
surfacing goes through an injected callback so services never import
providers. Survives app-kill via persisted WAL state.
Attach reconciler on init (poke resumes uploaded WALs from a prior
session); incremental conversation surfacing as jobs finish without
disturbing an active sync; poke after a sync/cancel. pendingWals now
includes 'uploaded' so it stays visible in the legacy page/counts; add
uploadedWals getter. cancelSync already preserved status, so 'uploaded'
WALs keep reconciling.
Per the approved plan and user feedback ('messy, too many things, the
backing-up message is unnecessary'): drop the status banner and the
All/Pending/Synced/Issues chips. One unified list with a quiet
'Recordings N' header; every row already states its own status
explicitly. Poke the reconciler while the screen is open.
Auto-sync / orphan-recovery now upload (202) and let the reconciler
finish the job instead of polling to terminal with an in-method
5/10/20s retry loop. 200 fast-path -> synced; 202 -> uploaded+jobId
+ poke reconciler; offline -> retry later (no retryCount++); real
failure -> retryCount++ for orphan recovery / next sync.
…back

All three callers migrated to uploadLocalFilesV2 + the reconciler. No
dead band-aid left behind.
A WAL in 'uploaded' state still has the only copy of the audio locally
until the server job is confirmed. Deleting it mid-processing is
unrecoverable, so the swipe-to-delete confirm now explains the risk
('Still processing … Delete anyway?') instead of the generic prompt.
… locales

New keys (syncStatusUploaded, processing, syncStatus*, noRecordingsYet,
syncInProgress, deleteWhileProcessing*) translated natively into all 48
non-English locales. Removed the now-dead banner/filter keys
(allRecordingsBackedUp, backingUpRecordingsCount, recordingsWaitingCount,
recordingsNeedAttentionCount, filterIssues) after the UI declutter.
A recording in WalSyncDisplayState.retrying (retryCount 1-2) is auto-
retried on the next sync trigger (app relaunch picks up pending phone
WALs via _scheduleAutoUploadPendingPhoneFiles). The Retry pill now also
appears here so the user can force the retry now instead of waiting.
…, FA icons, restrained color budget

- Drop the 3-tier pipeline card and per-row colored circle in favor of a
  type-first layout: one quiet card at top, one icon-free line per row.
- Multi-line status card on progress states so 'Downloading from Omi' and
  '4 of 12' sit on their own lines without crowding the Cancel pill.
- Local All / Pending / Synced filter chips above the recordings list.
- On-device WALs surface their transfer state (Waiting on Omi /
  Downloading from Omi) instead of the misleading 'Waiting to sync'.
- Synced rows say 'Conversation created' so the row tells the user the
  actual outcome instead of an implementation detail.
- Drop purple from row subtitles; purple is now reserved for spinner +
  pill buttons. Failed/retrying stay text-only amber/red.
- Replace Material info_outline / more_horiz / check / error_outline with
  their FontAwesome equivalents to match the rest of the app.
- Rewrite the 'How syncing works' sheet around the sync→conversation
  model: 'Your recording is sent to Omi's server' / 'Omi turns the audio
  into a conversation' / 'Find it under Conversations'.
- Newest-first hint next to the section header.
- Page header count now follows the active filter.
- Confirmation copy when deleting an in-flight uploaded recording.
- Net -149 lines after removing verbose history-explaining comments.
mdmohsin7 added 5 commits May 20, 2026 18:30
The existing 'conversation' getter throws StateError when the parent list
has mutated under us (deleted / day-group emptied). When that throw fires
from inside a Consumer.builder in the AppBar, the trailing slot is left
half-built and Flutter cascades 'infinite size during layout' errors
that mask the real cause.

Add a sibling 'conversationOrNull' getter that performs the same lookup
but returns null instead of throwing. Build paths use this; gesture/async
handlers can keep using the throwing variant as a 'cannot-be-null'
assertion.
…ersation is unresolved

If conversationOrNull is null at build time the page can't render
meaningfully — every descendant reads provider.conversation. Schedule
Navigator.pop on the next frame and return an empty Scaffold for this
build so the AppBar's trailing slot never sees the throw.
- Drop 'back up / backed up' framing; emphasize that recordings are
  synced to Omi's server and the result is a Conversation.
- New keys for the status card states (uploading/downloading title,
  X-of-Y progress, all synced, ready to sync count, needs attention,
  processing on Omi, waiting for internet).
- Info-sheet rewrite: Sync → Transcribe → Conversation ready.
- New row subtitles: Conversation created, Waiting on Omi, Downloading
  from Omi.
- 'Newest first' hint and 'No synced recordings yet' empty state for the
  filter UI.
Translations match the EN reframe (sync→conversation, no 'backup'
language) and adopt the locale's existing word for the 'Conversations'
section so the info-sheet pointer matches the in-app section name (de
Gespräche, fr Conversations, ja 会話, ko 대화, ar المحادثات, zh 对话,
etc.).

Full CLDR plural categories applied where the language requires them
(ar zero/one/two/few/many/other; ru/uk/pl/be/lt one/few/many/other;
sl one/two/few/other; lv zero/one/other). CJK locales use a single
'other' arm (no grammatical number).

Pre-commit hook reformatted ARBs to 4-space JSON indent — most of the
diff is whitespace; substantive changes are the new keys plus the
reframed values.
@mdmohsin7
mdmohsin7 marked this pull request as ready for review May 20, 2026 13:08
@mdmohsin7

Copy link
Copy Markdown
Member Author

@greptile-apps review

@greptile-apps

greptile-apps Bot commented May 20, 2026 •

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR redesigns the auto-sync page (quieter status card, filter chips, "Conversation created" copy, FontAwesome icons), refactors the WAL upload pipeline from poll-to-terminal to fire-and-forget (HTTP 202 → uploaded status resolved by a new SyncReconciler background service), adds a conversationOrNull non-throwing getter to prevent AppBar crashes in the conversation detail page, and ships 23 new/10 reframed l10n keys across 48 locales.

  • Upload pipeline: syncLocalFilesV2 (blocking poll loop) is replaced by uploadLocalFilesV2 (returns on 202) + fetchSyncJobStatus (single GET). SyncReconciler drives the polling off the critical path with exponential backoff, wired from SyncProvider on construction.
  • Sync page: redesigned AutoSyncPage adds All/Pending/Synced filter chips, a unified newest-first WAL list, and an uploaded (processing) state distinct from both miss and synced.
  • Conversation detail fix: conversationOrNull + _providerInitialized guard prevents the StateError thrown inside Consumer.builder from cascading into layout errors.

Confidence Score: 5/5

Safe to merge; the upload pipeline refactor is well-structured and the two findings are edge-case quality nits.

The fire-and-forget upload with persisted job_id and debounced background reconciler is architecturally sound. The conversation detail guard correctly gates the pop on _providerInitialized. The two new findings are unlikely to surface in typical usage.

app/lib/services/wals/local_wal_sync.dart (reconcileUploadedWals notFound branch) and app/lib/pages/conversations/auto_sync_page.dart (_monthName)

Important Files Changed

Filename Overview
app/lib/pages/conversations/auto_sync_page.dart New redesigned sync page: filter chips, unified WAL list, quiet status card, FA icons; hardcodes English month abbreviations in row titles despite 23 new l10n keys added elsewhere.
app/lib/services/wals/local_wal_sync.dart Upload path refactored from poll-to-terminal to fire-and-forget (HTTP 202 → uploaded status); adds reconcileUploadedWals(). retryCount is incremented on job expiry (notFound), which can misclassify a recording as failed after 3 TTL expirations even though each upload succeeded.
app/lib/services/wals/sync_reconciler.dart New singleton service that drives reconcileUploadedWals() off the critical path with exponential backoff; attach() is correctly wired from SyncProvider.
app/lib/pages/conversation_detail/page.dart Defensive build guard using _providerInitialized flag prevents premature pop on first build; addPostFrameCallback queued on every build while conversationOrNull is null.
app/lib/pages/conversation_detail/conversation_detail_provider.dart Adds non-throwing conversationOrNull getter; conversation accessor preserved as thin wrapper.
app/lib/backend/http/api/conversations.dart syncLocalFilesV2 removed; replaced with uploadLocalFilesV2 and fetchSyncJobStatus with clean discriminated union types.
app/lib/providers/sync_provider.dart Adds WalDisplayFilter, displaySortedWals, walsForDisplayFilter(), pendingDeletableWals, and reconciler wiring.
backend/database/sync_jobs.py Job TTL extended from 1h to 24h to match the new reconciliation window; well-documented.

Reviews (3): Last reviewed commit: "fix(conversation-detail): gate the build..." | Re-trigger Greptile

Comment thread app/lib/providers/sync_provider.dart Resolved
mdmohsin7 added 7 commits May 20, 2026 18:54
… intro

The 'How syncing works' intro previously skipped the device→phone transfer
half of the flow and said 'uploaded to Omi' (the brand) instead of
'Omi's server' (the cloud target). Rewrite to cover both halves
explicitly so the prose matches step 1 ('Your recording is sent to
Omi's server').
…Omi's server' (48 locales)

Match the EN reframe. Each locale uses its native word for 'transferred'
and 'server', preserves the Omi brand literally, and adopts the locale's
existing terminology for 'recordings' (consistent with the rest of the
sync strings).
Greptile flagged it as dead code. The redesigned page renders only three
chips (All / Pending / Synced); failed/retrying/corrupted recordings ride
inside Pending and are surfaced by their per-row amber/red status.
The Pending list/section includes uploaded WALs (their server job is
still processing), but deleteAllPendingWals can't touch them — the
local audio is required until the reconciler confirms 'synced'. So the
manage-storage sheet showed 'Pending: 5', the user tapped Clear, got a
success snackbar, and the uploaded recordings stayed in the list.

Add pendingDeletableWals (miss + corrupted, not isSyncing) — the subset
deleteAllPendingWals actually deletes. The manage-storage sheets in
both the redesigned and legacy pages now use this count.
Pending count in the redesigned page's manage-storage sheet now reflects
the WALs that 'Clear Pending' will actually delete. Total used for the
'Clear All' visibility excludes uploaded WALs for the same reason.
@mdmohsin7

Copy link
Copy Markdown
Member Author

@greptile-apps re-review

Comment on lines +584 to +591
if (detailProvider.conversationOrNull == null) {
WidgetsBinding.instance.addPostFrameCallback((_) {
if (!mounted) return;
if (Navigator.of(context).canPop()) {
Navigator.of(context).pop();
}
});
return Scaffold(backgroundColor: Theme.of(context).colorScheme.primary);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Build guard may prematurely pop on first navigation

When ConversationDetailPage is opened for the very first time after app start (i.e., _cachedConversation is null in the provider) and today's conversation group is empty (all conversations are from previous days), conversationOrNull returns null on the first build. This queues the pop callback. The initState post-frame callback fires first and calls setCachedConversation(widget.conversation), which schedules a rebuild — but the pop callback from this build fires immediately after in the same post-frame batch, popping the route before the rebuild can show the conversation. The result is that navigating to an old conversation auto-pops back to the list.

A simple fix is to track whether the provider has been initialized and skip the pop until after that step, or use an _initialized flag in the widget state.

Greptile P1: the previous build guard popped the route on the FIRST
build whenever the conversation wasn't in today's group, before
initState's post-frame setCachedConversation could populate the
provider. Both callbacks live in the same post-frame batch and the
guard's pop fired before the init callback's notifyListeners could
trigger a rebuild.

Add _providerInitialized, set it inside the init callback right after
setCachedConversation, and only pop when the flag is true. The first
build still renders an empty shell (no throw from descendants), but
the route stays mounted long enough for init to land the conversation.
@mdmohsin7

Copy link
Copy Markdown
Member Author

@greptile-apps re-review

@mdmohsin7
mdmohsin7 merged commit b4fd68f into main May 20, 2026
3 checks passed
@mdmohsin7
mdmohsin7 deleted the worktree-sync-page-redesign branch May 20, 2026 14:02
mdmohsin7 added a commit that referenced this pull request May 22, 2026
… fix 'stuck' processing perception (#7449)

## Why

The auto-sync page was redesigned in #7404 (merged). Manual sync
(`sync_page.dart`) — still used by **Limitless** — was left behind, and
users reported it looking **stuck**: the moment uploads finished and the
phase flipped to processing-on-server, the determinate progress bar
froze at 100% (its value source stops updating) while nothing animated.

This brings manual sync up to the same visual language and fixes the
perception.

## Changes

**Status card** (replaces the heavy phase-icon + percentage +
progress-bar card)
- Quiet multi-line card. Download/upload: spinner + `Downloading from
Omi` / `Uploading to Omi` + `X of Y · 320 KB/s` sub-line + Cancel pill.
- **Processing: live spinner + `Processing on Omi…` + "this continues in
the background — you can leave this screen."** No frozen bar. This is
the core fix.
- Idle with pending: `N recordings ready to sync` + a Sync pill
(preserves the SD-card warning / Fast-Transfer suggestion /
WiFi-connection-sheet flows behind `_handleSyncWals`).
- Waiting-for-internet and error states reuse the restrained amber/red
treatment; error card matches auto-sync's red-tint + Retry pill.

**WAL rows** (type-first)
- Dropped the leading device image. Title = `time · duration · source`;
status is a restrained colored subtitle; trailing = spinner / Retry pill
/ FA chevron.
- Source (SD card / Limitless / From SD) shown as quiet grey text
instead of colored pills.
- BLE per-row download progress bar **kept** (it's real progress and
genuinely useful for slow transfers), recolored to the purple accent.

**Chrome**
- Segmented Pending/Synced filter (matches auto-sync's chip style).
- iOS-style settings rows: right-aligned status text (`Fast`/`BLE`,
`On`/`Off`) + FA chevron, no colored pills.
- 4-color budget throughout (purple / grey / amber / red).

## i18n

- `syncProcessingBackgroundHint` (new) — the background-processing
reassurance line.
- `syncStatusBackingUp`: `Backing up…` → `Syncing…` (drops the last bit
of "backup" framing; this key is shared with the auto-sync row, so that
page benefits too).
- Everything else reuses keys already added in #7404
(`syncCardDownloadingTitle`, `syncCardUploadingTitle`,
`syncCardProgressOf`, `syncCardProcessing`, `syncCardReadyCount`,
`syncCardWaitingInternet`, `syncCardAllBackedUp`,
`syncStatusConversationCreated`, …).
- Both keys translated across all 48 non-English locales; `flutter
gen-l10n` emits zero untranslated warnings.

## Verification

- `flutter analyze` on `sync_page.dart` and `auto_sync_page.dart` → no
issues.
- `flutter gen-l10n` → zero untranslated.
- All manual-sync flows preserved: SD-card warning dialog, Fast-Transfer
suggestion, WiFi connection sheet, cancel, retry, manage-storage sheet
(deletable-pending count), per-WAL delete-while-processing guard.

Opened as draft for the standard checks before merge.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
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.

1 participant