diff --git a/KisaniCal/Managers/NotificationManager.swift b/KisaniCal/Managers/NotificationManager.swift index 7f3b66f..6fd0830 100644 --- a/KisaniCal/Managers/NotificationManager.swift +++ b/KisaniCal/Managers/NotificationManager.swift @@ -162,11 +162,12 @@ final class NotificationManager: NSObject, ObservableObject, @unchecked Sendable )) } - let count = snapshot.filter { !$0.isComplete && $0.quadrant == .urgent }.count - guard count > 0 else { return } + // No count in body — repeating notifications bake in the value + // at schedule time and go stale until the app is next opened. + guard snapshot.contains(where: { !$0.isComplete && $0.quadrant == .urgent }) else { return } let ec = UNMutableNotificationContent() ec.title = "Evening check-in" - ec.body = "\(count) urgent task\(count == 1 ? "" : "s") still open." + ec.body = "You still have urgent tasks open — tap to review." ec.sound = .default ec.userInfo = ["deeplink": "tasks"] var eComps = DateComponents(); eComps.hour = 19; eComps.minute = 30 @@ -204,6 +205,15 @@ extension NotificationManager: UNUserNotificationCenterDelegate { didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void ) { + let deeplink = response.notification.request.content.userInfo["deeplink"] as? String + Task { @MainActor in + switch deeplink { + case "workout": + ShortcutHandler.shared.handle(QuickAction.workout.rawValue) + default: + ShortcutHandler.shared.handle(QuickAction.today.rawValue) + } + } completionHandler() } }