Browse Source

Mirror global snooze onto per-alarm glucose snoozes

dnzxy 1 day ago
parent
commit
eb205345d3
1 changed files with 10 additions and 0 deletions
  1. 10 0
      Trio/Sources/Services/Alerts/GlucoseAlertCoordinator.swift

+ 10 - 0
Trio/Sources/Services/Alerts/GlucoseAlertCoordinator.swift

@@ -438,6 +438,16 @@ extension GlucoseAlertCoordinator: SnoozeObserver {
     /// IDs so the post-snooze evaluation can re-fire fresh if any condition
     /// still breaches.
     func snoozeDidChange(_ untilDate: Date) {
+        // Mirror the global snooze onto per-alarm snoozedUntil: alarms with
+        // "Override Silence & DnD" are issued .critical and pierce the
+        // AlertMuter, so the shared mute window alone can't hold them. A
+        // shorter per-type snooze (e.g. a 15-min swipe) would otherwise
+        // resurface them mid-window. Urgent low keeps its 15-minute safety
+        // floor and is never bulk-snoozed. An ended snooze (.distantPast)
+        // clears the stamps the same way.
+        for type in GlucoseAlertType.allCases where type != .urgentLow {
+            snoozeGlucoseType(type, until: untilDate)
+        }
         guard untilDate > Date() else { return }
         evaluationQueue.async { [weak self] in
             self?.firingAlertIDs.removeAll()