summaryrefslogtreecommitdiff
path: root/DomainDig/LocalNotificationService.swift
diff options
context:
space:
mode:
authorChristian Cleberg <[email protected]>2026-04-23 22:15:20 -0500
committerChristian Cleberg <[email protected]>2026-04-23 22:15:20 -0500
commitf045a5d339a796f40a9e958436ebc6f5314bdab8 (patch)
treec1d122f3ed7a9110dfcd001c86a56ed67980dfcc /DomainDig/LocalNotificationService.swift
parent6c23daaaba2a954220ece2afa7193dbdcad55c22 (diff)
downloaddomain-dig-f045a5d339a796f40a9e958436ebc6f5314bdab8.tar.gz
domain-dig-f045a5d339a796f40a9e958436ebc6f5314bdab8.tar.bz2
domain-dig-f045a5d339a796f40a9e958436ebc6f5314bdab8.zip
feat(v3.4.0): add backup, restore, and data portability
• introduce versioned DomainDig backup format • add full backup export/import with merge and replace modes • implement data validation and conflict handling • add partial exports for tracked domains, workflows, and history • add Data Portability settings section • support Files/iCloud Drive import and export • harden migrations for evolving local models • extend CLI with backup export and validation
Diffstat (limited to 'DomainDig/LocalNotificationService.swift')
-rw-r--r--DomainDig/LocalNotificationService.swift33
1 files changed, 33 insertions, 0 deletions
diff --git a/DomainDig/LocalNotificationService.swift b/DomainDig/LocalNotificationService.swift
index 450d844..7b43d67 100644
--- a/DomainDig/LocalNotificationService.swift
+++ b/DomainDig/LocalNotificationService.swift
@@ -27,6 +27,18 @@ final class LocalNotificationService {
}
}
+ func isAuthorizedForAlerts() async -> Bool {
+ let settings = await UNUserNotificationCenter.current().notificationSettings()
+ switch settings.authorizationStatus {
+ case .authorized, .provisional, .ephemeral:
+ return true
+ case .denied, .notDetermined:
+ return false
+ @unknown default:
+ return false
+ }
+ }
+
func notifyDomainEvent(domain: String, message: String, severity: ChangeSeverity) async {
await schedule(
identifier: "domain-change-\(domain)",
@@ -45,6 +57,27 @@ final class LocalNotificationService {
)
}
+ func notifyMonitoringAlert(
+ domain: String,
+ message: String,
+ severity: MonitoringAlertSeverity
+ ) async {
+ let interruptionLevel: UNNotificationInterruptionLevel
+ switch severity {
+ case .critical:
+ interruptionLevel = .timeSensitive
+ case .warning, .info:
+ interruptionLevel = .active
+ }
+
+ await schedule(
+ identifier: "monitoring-\(domain)-\(UUID().uuidString)",
+ title: domain,
+ body: message,
+ interruptionLevel: interruptionLevel
+ )
+ }
+
func notifySweepComplete(summary: BatchSweepSummary) async {
let body = "\(summary.changedDomains) changed, \(summary.warningDomains) warnings, \(summary.unchangedDomains) unchanged"
await schedule(