Przeglądaj źródła

Alarm icon and text changes

Jonas Björkert 1 rok temu
rodzic
commit
4952fa215b
2 zmienionych plików z 81 dodań i 81 usunięć
  1. 81 0
      LoopFollow/Alarm/Alarm.swift
  2. 0 81
      LoopFollow/Alarm/AlarmListView.swift

+ 81 - 0
LoopFollow/Alarm/Alarm.swift

@@ -252,3 +252,84 @@ struct Alarm: Identifiable, Codable, Equatable {
         }
         }
     }
     }
 }
 }
+
+extension AlarmType {
+    enum Group: String, CaseIterable {
+        case glucose = "Glucose"
+        case insulin = "Insulin / Food"
+        case device  = "Device / System"
+        case other   = "Override / Target"
+    }
+
+    var group: Group {
+        switch self {
+        case .low, .high, .fastDrop, .fastRise, .missedReading:
+            return .glucose
+        case .iob, .bolus, .cob, .missedBolus, .recBolus:
+            return .insulin
+        case .battery, .batteryDrop, .pump, .pumpChange,
+                .sensorChange, .notLooping, .buildExpire:
+            return .device
+        default:
+            return .other
+        }
+    }
+
+    var icon: String {
+        switch self {
+        case .low : return "arrow.down.to.line"
+        case .high : return "arrow.up.to.line"
+        case .fastDrop : return "chevron.down.2"
+        case .fastRise : return "chevron.up.2"
+        case .missedReading: return "wifi.slash"
+
+        case .iob, .bolus: return "syringe"
+        case .cob : return "fork.knife"
+        case .missedBolus: return "exclamationmark.arrow.triangle.2.circlepath"
+        case .recBolus : return "bolt.horizontal"
+
+        case .battery: return "battery.25"
+        case .batteryDrop: return "battery.100.bolt"
+        case .pump: return "drop"
+        case .pumpChange: return "arrow.triangle.2.circlepath"
+        case .sensorChange: return "sensor.tag.radiowaves.forward"
+
+        case .notLooping: return "circle.slash"
+        case .buildExpire: return "calendar.badge.exclamationmark"
+
+        case .overrideStart: return "play.circle"
+        case .overrideEnd: return "stop.circle"
+        case .tempTargetStart: return "flag"
+        case .tempTargetEnd: return "flag.slash"
+        }
+    }
+
+    var blurb: String {
+        switch self {
+        case .low:            return "Alerts when BG goes below a limit."
+        case .high:           return "Alerts when BG rises above a limit."
+        case .fastDrop:       return "Rapid downward BG trend."
+        case .fastRise:       return "Rapid upward BG trend."
+        case .missedReading:  return "No CGM data for X minutes."
+
+        case .iob:            return "High insulin-on-board."
+        case .bolus:          return "Large individual bolus."
+        case .cob:            return "High carbs-on-board."
+        case .missedBolus:    return "Carbs without bolus."
+        case .recBolus:       return "Recommended bolus issued."
+
+        case .battery:        return "Phone battery low."
+        case .batteryDrop:    return "Battery drops quickly."
+        case .pump:           return "Reservoir level low."
+        case .pumpChange:     return "Pump change due."
+        case .sensorChange:   return "Sensor change due."
+        case .notLooping:     return "Loop hasn’t completed."
+        case .buildExpire:    return "Looping-app build expiring."
+
+        case .overrideStart:  return "Override just started."
+        case .overrideEnd:    return "Override ended."
+        case .tempTargetStart:return "Temp target started."
+        case .tempTargetEnd:  return "Temp target ended."
+        }
+    }
+}

+ 0 - 81
LoopFollow/Alarm/AlarmListView.swift

@@ -8,87 +8,6 @@
 
 
 import SwiftUI
 import SwiftUI
 
 
-extension AlarmType {
-    enum Group: String, CaseIterable {
-        case glucose = "Glucose"
-        case insulin = "Insulin / Food"
-        case device  = "Device / System"
-        case other   = "Other"
-    }
-
-    var group: Group {
-        switch self {
-        case .low, .high, .fastDrop, .fastRise, .missedReading:
-            return .glucose
-        case .iob, .bolus, .cob, .missedBolus, .recBolus:
-            return .insulin
-        case .battery, .batteryDrop, .pump, .pumpChange,
-                .sensorChange, .notLooping, .buildExpire:
-            return .device
-        default:
-            return .other
-        }
-    }
-
-    var icon: String {
-        switch self {
-        case .low : return "arrow.down.to.line"
-        case .high : return "arrow.up.to.line"
-        case .fastDrop : return "chevron.down.2"
-        case .fastRise : return "chevron.up.2"
-        case .missedReading: return "wifi.slash"
-
-        case .iob, .bolus: return "syringe"
-        case .cob : return "fork.knife"
-        case .missedBolus: return "exclamationmark.arrow.triangle.2.circlepath"
-        case .recBolus : return "bolt.horizontal"
-
-        case .battery: return "battery.25"
-        case .batteryDrop: return "battery.100.bolt"
-        case .pump: return "drop"
-        case .pumpChange: return "arrow.triangle.2.circlepath"
-        case .sensorChange: return "sensor.tag.radiowaves.forward"
-
-        case .notLooping: return "circle.slash"
-        case .buildExpire: return "calendar.badge.exclamationmark"
-
-        case .overrideStart: return "play.circle"
-        case .overrideEnd: return "stop.circle"
-        case .tempTargetStart: return "flag"
-        case .tempTargetEnd: return "flag.slash"
-        }
-    }
-
-    var blurb: String {
-        switch self {
-        case .low:            return "Alerts when BG goes below a limit."
-        case .high:           return "Alerts when BG rises above a limit."
-        case .fastDrop:       return "Rapid downward BG trend."
-        case .fastRise:       return "Rapid upward BG trend."
-        case .missedReading:  return "No CGM data for X minutes."
-
-        case .iob:            return "High insulin-on-board."
-        case .bolus:          return "Large individual bolus."
-        case .cob:            return "High carbs-on-board."
-        case .missedBolus:    return "Carbs without bolus."
-        case .recBolus:       return "Recommended bolus issued."
-
-        case .battery:        return "Phone battery low."
-        case .batteryDrop:    return "Battery drops quickly."
-        case .pump:           return "Reservoir level low."
-        case .pumpChange:     return "Pump change due."
-        case .sensorChange:   return "Sensor change due."
-        case .notLooping:     return "Loop hasn’t completed."
-        case .buildExpire:    return "Looping-app build expiring."
-
-        case .overrideStart:  return "Override just started."
-        case .overrideEnd:    return "Override ended."
-        case .tempTargetStart:return "Temp target started."
-        case .tempTargetEnd:  return "Temp target ended."
-        }
-    }
-}
-
 struct AddAlarmSheet: View {
 struct AddAlarmSheet: View {
     let onSelect: (AlarmType) -> Void
     let onSelect: (AlarmType) -> Void
     @Environment(\.dismiss) private var dismiss
     @Environment(\.dismiss) private var dismiss