Merge branch 'feature/sync-reliability'

This commit is contained in:
Trey t
2026-01-13 22:09:26 -06:00
8 changed files with 1607 additions and 94 deletions

View File

@@ -169,13 +169,19 @@ struct BootstrappedContentView: View {
await StoreManager.shared.loadProducts()
await StoreManager.shared.updateEntitlements()
// 6. App is now usable
// 6. Start network monitoring and wire up sync callback
NetworkMonitor.shared.onSyncNeeded = {
await BackgroundSyncManager.shared.triggerSyncFromNetworkRestoration()
}
NetworkMonitor.shared.startMonitoring()
// 7. App is now usable
isBootstrapping = false
// 7. Schedule background tasks for future syncs
// 8. Schedule background tasks for future syncs
BackgroundSyncManager.shared.scheduleAllTasks()
// 8. Background: Try to refresh from CloudKit (non-blocking)
// 9. Background: Try to refresh from CloudKit (non-blocking)
Task.detached(priority: .background) {
await self.performBackgroundSync(context: context)
await MainActor.run {