Bläddra i källkod

Skip not-looping alarm in open loop, manual basal, or suspension

trioneer 2 veckor sedan
förälder
incheckning
5ca4a0bfc5
1 ändrade filer med 12 tillägg och 0 borttagningar
  1. 12 0
      Trio/Sources/Services/Alerts/NotLoopingMonitor.swift

+ 12 - 0
Trio/Sources/Services/Alerts/NotLoopingMonitor.swift

@@ -16,6 +16,7 @@ import Swinject
 final class NotLoopingMonitor: Injectable {
     @Injected() private var apsManager: APSManager!
     @Injected() private var trioAlertManager: TrioAlertManager!
+    @Injected() private var settingsManager: SettingsManager!
 
     /// Minutes of staleness before the alarm fires. Mirrors the legacy
     /// `firstInterval` (20 min) — the second 40-min reminder is dropped;
@@ -53,6 +54,17 @@ final class NotLoopingMonitor: Injectable {
         // next issueAlert isn't blocked by 5-min duplicate suppression.
         trioAlertManager.retractAlert(identifier: Self.alertID)
 
+        // Skip when Trio isn't expected to be auto-enacting: open loop, an
+        // active manual temp basal, or a suspended pump. In all three the
+        // user has implicitly told Trio "don't loop right now"; a "Not
+        // Looping" alarm would just be noise. nil injection (publisher-only
+        // test seam) passes so the existing tests still exercise the
+        // retract/reschedule plumbing.
+        guard settingsManager?.settings.closedLoop != false,
+              apsManager?.isManualTempBasal != true,
+              apsManager?.isSuspended != true
+        else { return }
+
         let content = Alert.Content(
             title: String(localized: "Trio Not Active"),
             body: String(