Reflect real sync state on the Sync settings page

`SyncConnectionState` was a one-variant enum (`SignedOut`), so the
Sync page rendered "Local-only · sign-in coming soon" even after the
bearer token landed on disk and the upload thread completed. The
state machine now mirrors the actual lifecycle.

What lands:
- `SyncConnectionState` gains `SignedIn`, `AwaitingDeviceApproval`,
  `SyncReady { last_synced_at_secs }`, `SyncError { message }`.
  `SyncObjectState::Synced` joins the per-object enum so individual
  rows can advertise "Synced" once a successful upload lands.
- `BrowserCore` stores the current `SyncConnectionState` and exposes
  `set_sync_connection_state`. `sync_status` now propagates the live
  state into the snapshot the UI reads.
- `ElyShell::probe_initial_sync_state` inspects
  `<profile_data>/sync/bearer.token` synchronously at construction
  so the first render of the sync page is honest about whether the
  user is signed in.
- A `std::sync::mpsc` channel ferries upload outcomes from the
  off-thread worker back to the shell; the existing 8 ms tick
  drains it and stamps `core.set_sync_connection_state` with the
  freshest result. The UI now shows "Signed in · awaiting first
  sync", "Synced · last upload Xm ago", "Sync error · …", and the
  worker-special "Signed in · waiting for device approval" when the
  server returns `device_not_approved`.
This commit is contained in:
2026-05-15 19:58:42 -04:00
parent 6b2578c3a8
commit 467dcb1f87
7 changed files with 260 additions and 79 deletions
+2
View File
@@ -162,6 +162,7 @@ pub struct BrowserCore {
update_policy: UpdatePolicy,
appearance: AppearanceSettings,
sync_object_policies: SyncObjectPolicies,
sync_connection_state: ely_domain::SyncConnectionState,
command_query: String,
}
@@ -210,6 +211,7 @@ impl BrowserCore {
update_policy: UpdatePolicy::default(),
appearance: AppearanceSettings::default(),
sync_object_policies: SyncObjectPolicies::default(),
sync_connection_state: ely_domain::SyncConnectionState::SignedOut,
spaces: vec![space],
profiles: vec![profile],
tabs: vec![tab],