Integrate IndieBackup for snapshot backup and restore

Adds a local ZIP backup/restore of the iCloud document tree via the
IndieBackup package, surfaced in Settings with retention controls. A
restore suspends the sync observer, mirrors the files, then rebuilds the
SwiftData cache; opening a shared .workoutsbackup file restores it. The
engine exposes the container Documents root and a restore lifecycle
(isRestoring guards a concurrent connect), and the backup file type is
registered for open-in-place.

Claude-Session: https://claude.ai/code/session_01HJDQQDA9QdP8zByg43H5v3
This commit is contained in:
2026-07-08 08:03:30 -04:00
parent df3eac9d5f
commit 653cc65e0e
7 changed files with 190 additions and 1 deletions
+7
View File
@@ -41,5 +41,12 @@ struct WorkoutsApp: App {
.environment(services.liveRunState)
.modelContainer(services.container)
.task { await services.bootstrap() }
// Tap a shared ".workoutsbackup" file (Files, AirDrop, share sheet) to
// restore it. The controller stops the sync observer for the restore and
// rebuilds the cache afterward (see AppBackupConfiguration).
.onOpenURL { url in
guard url.pathExtension == "workoutsbackup" else { return }
Task { try? await services.backupController.restoreBackup(from: url) }
}
}
}