Przeglądaj źródła

Show grams for Carbs Required row; shorten CGM-app toggle footer

The Carbs Required alarm stores its threshold in thresholdMgDL but
the value is grams, so the row summary was rendering "Below 10
mg/dL" with a mmol/L-converted number. Branch on type so carbsRequired
reads "At least 10 g" with no unit conversion.

Also trim the "Use CGM App Alerts" toggle footer from a 32-word
explanation to a 16-word one so it stays readable for people with
dyslexia or limited literacy.
trioneer 2 tygodni temu
rodzic
commit
6f479bb3c2

+ 10 - 2
Trio/Sources/Modules/GlucoseAlerts/View/GlucoseAlertsRootView.swift

@@ -68,7 +68,7 @@ extension GlucoseAlerts {
                 }.listRowBackground(Color.chart)
 
                 Section(footer: Text(
-                    "On by default when using a CGM in Trio which requires another app (e.g. Dexcom G6 / One, Dexcom G7 / One+, or xDrip4iOS). Turn off if you've disabled those and want Trio to alert you instead."
+                    "Your CGM app handles alerts (Dexcom G6 / One, G7 / One+, or xDrip4iOS). Turn off to let Trio alert you."
                 )) {
                     Toggle(isOn: Binding(
                         get: { !store.configuration.forceTrioAlertsWhenCGMProvidesOwn },
@@ -270,10 +270,18 @@ extension GlucoseAlerts {
             let comparator: String = {
                 switch alarm.type {
                 case .high: return String(localized: "above")
+                case .carbsRequired: return String(localized: "at least")
                 default: return String(localized: "below")
                 }
             }()
-            let threshold = "\(alarm.thresholdMgDL.formatted(for: state.units)) \(state.units.rawValue)"
+            let threshold: String = {
+                // `thresholdMgDL` stores grams for carbsRequired — no
+                // mg/dL ↔ mmol/L conversion and a fixed "g" unit label.
+                if alarm.type == .carbsRequired {
+                    return "\(alarm.thresholdMgDL) \(String(localized: "g", comment: "gram of carbs"))"
+                }
+                return "\(alarm.thresholdMgDL.formatted(for: state.units)) \(state.units.rawValue)"
+            }()
             let window = AlarmEnumDescription.description(for: alarm.activeOption)
             return "\(comparator.localizedCapitalized) \(threshold) • \(window)"
         }