Fix backup loop, phone count invariant, and auto-start behaviour
- LocalPhotoIndex: add count(filter:) so fast-path reconcile uses the filtered asset count as phoneTotal instead of the unfiltered totalCount; fixes the broken alreadySafe + needBackup == phoneTotal invariant - BackupStatusService: fast-path uses count(filter:) instead of totalCount; writeManifest falls back to NASManifestCache when NAS download fails so accumulated history is never silently discarded on a flaky connection - ConnectionStore: autoBackupEnabled defaults false; new autoBackupOnOpen (default false) separates LAN-join auto-backup from app-open auto-backup - AutoBackupCoordinator: onActive(lanTriggered:) tracks trigger source; handleReconciliationComplete gates on autoBackupEnabled for LAN joins and autoBackupOnOpen for app-open — prevents backup starting on every launch - SettingsView: split auto-backup into two toggles with accurate descriptions Co-Authored-By: Kutesir <kutesir@provoc.ug> Co-Authored-By: Sentry <sentry@provoc.ug>
This commit is contained in:
@@ -63,11 +63,16 @@ final class ConnectionStore: ObservableObject {
|
||||
didSet { UserDefaults.standard.set(localRetentionDays, forKey: "localRetentionDays") }
|
||||
}
|
||||
|
||||
// Auto-backup: default on after first destination is configured
|
||||
// Auto-backup via LAN trigger (trusted Wi-Fi join)
|
||||
@Published var autoBackupEnabled: Bool {
|
||||
didSet { UserDefaults.standard.set(autoBackupEnabled, forKey: "autoBackupEnabled") }
|
||||
}
|
||||
|
||||
// Auto-backup on every app open — off by default; requires explicit opt-in
|
||||
@Published var autoBackupOnOpen: Bool {
|
||||
didSet { UserDefaults.standard.set(autoBackupOnOpen, forKey: "autoBackupOnOpen") }
|
||||
}
|
||||
|
||||
// Cellular & remote access
|
||||
@Published var allowCellularBackup: Bool {
|
||||
didSet { UserDefaults.standard.set(allowCellularBackup, forKey: "allowCellularBackup") }
|
||||
@@ -94,7 +99,8 @@ final class ConnectionStore: ObservableObject {
|
||||
onboardingPhotoShown = UserDefaults.standard.bool(forKey: "onboardingPhotoShown")
|
||||
appearanceMode = AppearanceMode(rawValue: UserDefaults.standard.string(forKey: "appearanceMode") ?? "") ?? .system
|
||||
localRetentionDays = UserDefaults.standard.object(forKey: "localRetentionDays") as? Int ?? 0
|
||||
autoBackupEnabled = UserDefaults.standard.object(forKey: "autoBackupEnabled") as? Bool ?? true
|
||||
autoBackupEnabled = UserDefaults.standard.object(forKey: "autoBackupEnabled") as? Bool ?? false
|
||||
autoBackupOnOpen = UserDefaults.standard.object(forKey: "autoBackupOnOpen") as? Bool ?? false
|
||||
allowCellularBackup = UserDefaults.standard.object(forKey: "allowCellularBackup") as? Bool ?? false
|
||||
useTailscaleWhenRemote = UserDefaults.standard.object(forKey: "useTailscaleWhenRemote") as? Bool ?? false
|
||||
tailscaleHost = UserDefaults.standard.string(forKey: "tailscaleHost") ?? ""
|
||||
|
||||
Reference in New Issue
Block a user