Remove newFilesOnly toggle; add functional notifications; fix WiFi status

WHAT TO BACK UP section:
- Remove "New files only" / "Skip files already on NAS" toggle from Settings
- Remove BackupFilter.newFilesOnly field — duplicate protection is always active
  (fileExists pre-check + hybrid filterIndex ensure NAS files are never re-uploaded)

NOTIFICATIONS section:
- Replace static decorative rows with real ToggleRow controls backed by
  ConnectionStore (notifyOnStart=false, notifyOnComplete=true, notifyOnErrors=true)
- BackupEngine now gates notification calls behind these store flags

NETWORK section:
- WiFi row always shows ● On / ● Off indicator (was only shown when SSID known)
- Shows "Trusted" / "Unknown" when SSID is available, "On" / "Off" otherwise

Tests:
- makeAssets: add missing isScreenRecording parameter
- Rename test_backup_skipsExistingFiles_whenNewFilesOnly → _alwaysHardcoded,
  remove filter.newFilesOnly assignment
- MockNASService: add downloadData, writeData, deleteFile to satisfy protocol

Co-Authored-By: Kutesir <kutesir@provoc.ug>
Co-Authored-By: Sentry <sentry@provoc.ug>
This commit is contained in:
Robin Kutesa
2026-05-19 01:33:36 +03:00
parent 089c9dfd67
commit 47867f2ef3
6 changed files with 53 additions and 40 deletions

View File

@@ -63,6 +63,17 @@ final class ConnectionStore: ObservableObject {
didSet { UserDefaults.standard.set(localRetentionDays, forKey: "localRetentionDays") }
}
// Notification preferences
@Published var notifyOnStart: Bool {
didSet { UserDefaults.standard.set(notifyOnStart, forKey: "notifyOnStart") }
}
@Published var notifyOnComplete: Bool {
didSet { UserDefaults.standard.set(notifyOnComplete, forKey: "notifyOnComplete") }
}
@Published var notifyOnErrors: Bool {
didSet { UserDefaults.standard.set(notifyOnErrors, forKey: "notifyOnErrors") }
}
// Auto-backup via LAN trigger (trusted Wi-Fi join)
@Published var autoBackupEnabled: Bool {
didSet { UserDefaults.standard.set(autoBackupEnabled, forKey: "autoBackupEnabled") }
@@ -99,6 +110,9 @@ 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
notifyOnStart = UserDefaults.standard.object(forKey: "notifyOnStart") as? Bool ?? false
notifyOnComplete = UserDefaults.standard.object(forKey: "notifyOnComplete") as? Bool ?? true
notifyOnErrors = UserDefaults.standard.object(forKey: "notifyOnErrors") as? Bool ?? true
autoBackupEnabled = UserDefaults.standard.object(forKey: "autoBackupEnabled") as? Bool ?? true
autoBackupOnOpen = UserDefaults.standard.object(forKey: "autoBackupOnOpen") as? Bool ?? false
allowCellularBackup = UserDefaults.standard.object(forKey: "allowCellularBackup") as? Bool ?? false