From 3f0b7746b1bee4c2f626eb805e3fd13c5f2f5d22 Mon Sep 17 00:00:00 2001 From: Christian Cleberg Date: Fri, 24 Apr 2026 15:04:54 -0500 Subject: DomainDig v3.8.0 — Smart Monitoring MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Stable domain intervals * Frequent changes decrease intervals * Duplicate states do not trigger alerts * Quiet hours suppress alerts * Quiet hours across midnight work correctly * Sensitivity levels alter behavior as expected --- DomainDig/LocalNotificationService.swift | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'DomainDig/LocalNotificationService.swift') diff --git a/DomainDig/LocalNotificationService.swift b/DomainDig/LocalNotificationService.swift index 7b43d67..93beca5 100644 --- a/DomainDig/LocalNotificationService.swift +++ b/DomainDig/LocalNotificationService.swift @@ -78,6 +78,35 @@ final class LocalNotificationService { ) } + func notifyMonitoringSummary( + domain: String, + alerts: [MonitoringPendingAlert] + ) async { + let summary = alerts + .sorted { $0.detectedAt < $1.detectedAt } + .prefix(2) + .map(\.message) + .joined(separator: " • ") + let body: String + if alerts.count <= 1 { + body = alerts.first?.message ?? "Monitoring change detected" + } else if summary.isEmpty { + body = "\(alerts.count) monitoring changes detected" + } else { + body = "\(alerts.count) monitoring changes: \(summary)" + } + + let severity = alerts.map(\.severity).max() ?? .info + let interruptionLevel: UNNotificationInterruptionLevel = severity == .critical ? .timeSensitive : .active + + await schedule( + identifier: "monitoring-summary-\(domain)-\(UUID().uuidString)", + title: domain, + body: body, + interruptionLevel: interruptionLevel + ) + } + func notifySweepComplete(summary: BatchSweepSummary) async { let body = "\(summary.changedDomains) changed, \(summary.warningDomains) warnings, \(summary.unchangedDomains) unchanged" await schedule( -- cgit v1.2.3