feat: harden Flow cold-start/force-quit and polish macOS dictation UX

Fix cold-start overlay recursion that overflowed the main-thread stack when
recording began while the ready overlay was still up; also remove temporary
on-screen Flow DEBUG panels after the orange-mic investigation, and land the
macOS overlay/catalog/layout polish plus related Flow recovery hardening.
This commit is contained in:
Rocky
2026-07-10 12:39:41 +08:00
parent dcb66a9849
commit cdf833935a
104 changed files with 5794 additions and 853 deletions
@@ -45,8 +45,16 @@ public final class UsageStatisticsCloudSync {
public func pushLocalIfEnabled() async throws {
let store = makeStore()
guard store.settingsICloudSyncEnabled else { return }
// Read-merge-write: this fires after every utterance, so pushing the
// local view verbatim would clobber counter slices another device
// advanced since our last pull (KVS is last-writer-wins). The
// G-Counter merge makes the push commutative instead.
let local = SyncedUsageStatisticsStorage.load(from: store.defaults)
try push(local)
let merged = loadRemote().map { SyncedUsageStatisticsV2.merge(local: local, remote: $0) } ?? local
if merged != local {
apply(merged, to: store.defaults, postNotification: true)
}
try push(merged)
}
/// Called when settings sync is first enabled to union local + remote totals.