Просмотр исходного кода

Alerts: rename isAlertWorthy → shouldFireImmediately, tighten critical-tier copy

Deniz Cengiz недель назад: 3
Родитель
Сommit
c8cd4f8265

+ 1 - 1
Trio/Sources/APS/APSManager.swift

@@ -1253,7 +1253,7 @@ final class BaseAPSManager: APSManager, Injectable {
         let category = TrioAlertClassifier.categorize(error: error)
         let key = String(describing: category)
 
-        if category.isAlertWorthy || currentLoopUserInitiated {
+        if category.shouldFireImmediately || currentLoopUserInitiated {
             transientCategoryFirstSeen.removeValue(forKey: key)
             transientCategoryCount.removeValue(forKey: key)
             issueAlertForError(error, category: category)

+ 3 - 1
Trio/Sources/Models/GlucoseAlerts/DeviceAlertSeverity.swift

@@ -25,7 +25,9 @@ enum DeviceAlertSeverity: String, Codable, CaseIterable, Identifiable {
     var blurb: String {
         switch self {
         case .critical:
-            return String(localized: "Overrides Silence & Focus Mode. Always audible. For hazardous failures.")
+            return String(
+                localized: "Overrides Silence & Focus Mode. Always audible. For situations requiring immediate attention."
+            )
         case .timeSensitive:
             return String(localized: "Pierces banner suppression but obeys Silence & Focus Mode.")
         case .normal:

+ 4 - 3
Trio/Sources/Services/Alerts/TrioAlertCategory.swift

@@ -49,10 +49,11 @@ enum TrioAlertCategory: Equatable {
 
     /// Whether an inbound alert in this category surfaces *immediately*.
     /// `false` means the category is dwell-suppressed by `APSManager`
-    /// (count + time threshold) before it reaches `TrioAlertManager`.
-    /// `commsTransient` stays suppressed because connectivity blips
+    /// (count + time threshold) before it reaches `TrioAlertManager`, and
+    /// also dropped at the manager boundary if it leaks through. Today
+    /// only `commsTransient` qualifies — connectivity blips usually
     /// recover on their own.
-    var isAlertWorthy: Bool {
+    var shouldFireImmediately: Bool {
         switch self {
         case .algorithmError,
              .batteryEmpty,

+ 2 - 2
Trio/Sources/Services/Alerts/TrioAlertManager.swift

@@ -115,8 +115,8 @@ final class BaseTrioAlertManager: TrioAlertManager, Injectable {
             .service,
             "TrioAlertManager.issueAlert \(alert.identifier.value) category=\(category) level=\(alert.interruptionLevel)"
         )
-        guard category.isAlertWorthy else {
-            debug(.service, "TrioAlertManager dropped \(alert.identifier.value): \(category) not alert-worthy")
+        guard category.shouldFireImmediately else {
+            debug(.service, "TrioAlertManager dropped \(alert.identifier.value): \(category) does not surface")
             return
         }