Browse Source

Fix max basal setting
* Correct setting name 'Max Basal' -> 'Max Basal Rate'
* Correct setting unit 'U' -> 'U/hr'
* Adjust implementation and handling accordingly

Deniz Cengiz 1 year ago
parent
commit
952cfeb416

+ 9 - 1
Trio/Sources/Localizations/Main/Localizable.xcstrings

@@ -65391,7 +65391,11 @@
         }
         }
       }
       }
     },
     },
+    "Default: 2 %@" : {
+
+    },
     "Default: 2 units" : {
     "Default: 2 units" : {
+      "extractionState" : "stale",
       "localizations" : {
       "localizations" : {
         "bg" : {
         "bg" : {
           "stringUnit" : {
           "stringUnit" : {
@@ -126814,6 +126818,7 @@
     },
     },
     "Max Basal" : {
     "Max Basal" : {
       "comment" : "Max setting",
       "comment" : "Max setting",
+      "extractionState" : "stale",
       "localizations" : {
       "localizations" : {
         "bg" : {
         "bg" : {
           "stringUnit" : {
           "stringUnit" : {
@@ -126913,6 +126918,9 @@
         }
         }
       }
       }
     },
     },
+    "Max Basal Rate" : {
+
+    },
     "Max bolus" : {
     "Max bolus" : {
       "localizations" : {
       "localizations" : {
         "bg" : {
         "bg" : {
@@ -206979,7 +206987,7 @@
 
 
     },
     },
     "U/hr" : {
     "U/hr" : {
-      "comment" : "Insulin unit per hour",
+      "comment" : "Insulin unit per hour abbreviation",
       "localizations" : {
       "localizations" : {
         "bg" : {
         "bg" : {
           "stringUnit" : {
           "stringUnit" : {

+ 8 - 1
Trio/Sources/Models/DecimalPickerSettings.swift

@@ -137,7 +137,13 @@ struct DecimalPickerSettings {
     var hours = PickerSetting(value: 6, step: 0.5, min: 2, max: 24, type: PickerSetting.PickerSettingType.hour)
     var hours = PickerSetting(value: 6, step: 0.5, min: 2, max: 24, type: PickerSetting.PickerSettingType.hour)
     var dia = PickerSetting(value: 10, step: 0.5, min: 5, max: 10, type: PickerSetting.PickerSettingType.hour)
     var dia = PickerSetting(value: 10, step: 0.5, min: 5, max: 10, type: PickerSetting.PickerSettingType.hour)
     var maxBolus = PickerSetting(value: 10, step: 0.5, min: 0.5, max: 30, type: PickerSetting.PickerSettingType.insulinUnit)
     var maxBolus = PickerSetting(value: 10, step: 0.5, min: 0.5, max: 30, type: PickerSetting.PickerSettingType.insulinUnit)
-    var maxBasal = PickerSetting(value: 10, step: 0.5, min: 0.5, max: 30, type: PickerSetting.PickerSettingType.insulinUnit)
+    var maxBasal = PickerSetting(
+        value: 10,
+        step: 0.5,
+        min: 0.5,
+        max: 30,
+        type: PickerSetting.PickerSettingType.insulinUnitPerHour
+    )
 }
 }
 
 
 struct PickerSetting {
 struct PickerSetting {
@@ -152,6 +158,7 @@ struct PickerSetting {
         case factor
         case factor
         case gram
         case gram
         case insulinUnit
         case insulinUnit
+        case insulinUnitPerHour
         case minute
         case minute
         case hour
         case hour
     }
     }

+ 3 - 3
Trio/Sources/Modules/GeneralSettings/View/UnitsLimitsSettingsRootView.swift

@@ -95,16 +95,16 @@ extension UnitsLimitsSettings {
                         get: { selectedVerboseHint },
                         get: { selectedVerboseHint },
                         set: {
                         set: {
                             selectedVerboseHint = $0.map { AnyView($0) }
                             selectedVerboseHint = $0.map { AnyView($0) }
-                            hintLabel = String(localized: "Max Basal")
+                            hintLabel = String(localized: "Max Basal Rate")
                         }
                         }
                     ),
                     ),
                     units: state.units,
                     units: state.units,
                     type: .decimal("maxBasal"),
                     type: .decimal("maxBasal"),
-                    label: String(localized: "Max Basal"),
+                    label: String(localized: "Max Basal Rate"),
                     miniHint: String(localized: "Largest basal rate allowed."),
                     miniHint: String(localized: "Largest basal rate allowed."),
                     verboseHint:
                     verboseHint:
                     VStack(alignment: .leading, spacing: 10) {
                     VStack(alignment: .leading, spacing: 10) {
-                        Text("Default: 2 units").bold()
+                        Text("Default: 2 \(String(localized: "U/hr", comment: "Insulin unit per hour abbreviation"))").bold()
                         Text(
                         Text(
                             "This is the maximum basal rate allowed to be set or scheduled. This applies to both automatic and manual basal rates."
                             "This is the maximum basal rate allowed to be set or scheduled. This applies to both automatic and manual basal rates."
                         )
                         )

+ 3 - 2
Trio/Sources/Modules/Onboarding/View/OnboardingSteps/DeliveryLimitsStepView.swift

@@ -94,8 +94,9 @@ struct DeliveryLimitsStepView: View {
 
 
     private func displayText(for substep: DeliveryLimitSubstep, decimalValue: Decimal) -> Text {
     private func displayText(for substep: DeliveryLimitSubstep, decimalValue: Decimal) -> Text {
         switch substep {
         switch substep {
-        case .maxBasal,
-             .maxBolus,
+        case .maxBasal:
+            return Text("\(decimalValue) \(String(localized: "U/hr", comment: "Insulin unit per hour abbreviation"))")
+        case .maxBolus,
              .maxIOB:
              .maxIOB:
             return Text("\(decimalValue) \(String(localized: "U", comment: "Insulin unit abbreviation"))")
             return Text("\(decimalValue) \(String(localized: "U", comment: "Insulin unit abbreviation"))")
         case .maxCOB:
         case .maxCOB:

+ 1 - 1
Trio/Sources/Modules/Onboarding/View/OnboardingView+Util.swift

@@ -173,7 +173,7 @@ enum DeliveryLimitSubstep: Int, CaseIterable, Identifiable {
         switch self {
         switch self {
         case .maxIOB: return String(localized: "Max IOB", comment: "Max IOB")
         case .maxIOB: return String(localized: "Max IOB", comment: "Max IOB")
         case .maxBolus: return String(localized: "Max Bolus")
         case .maxBolus: return String(localized: "Max Bolus")
-        case .maxBasal: return String(localized: "Max Basal")
+        case .maxBasal: return String(localized: "Max Basal Rate")
         case .maxCOB: return String(localized: "Max COB", comment: "Max COB")
         case .maxCOB: return String(localized: "Max COB", comment: "Max COB")
         case .minimumSafetyThreshold: return String(localized: "Minimum Safety Threshold")
         case .minimumSafetyThreshold: return String(localized: "Minimum Safety Threshold")
         }
         }

+ 2 - 0
Trio/Sources/Views/SettingInputSection.swift

@@ -222,6 +222,8 @@ struct SettingInputSection<VerboseHint: View>: View {
             return Text("\(decimalValue * 100) \(String(localized: "%", comment: "Percentage symbol"))")
             return Text("\(decimalValue * 100) \(String(localized: "%", comment: "Percentage symbol"))")
         case .insulinUnit:
         case .insulinUnit:
             return Text("\(decimalValue) \(String(localized: "U", comment: "Insulin unit abbreviation"))")
             return Text("\(decimalValue) \(String(localized: "U", comment: "Insulin unit abbreviation"))")
+        case .insulinUnitPerHour:
+            return Text("\(decimalValue) \(String(localized: "U/hr", comment: "Insulin unit per hour abbreviation"))")
         case .gram:
         case .gram:
             return Text("\(decimalValue) \(String(localized: "g", comment: "Gram abbreviation"))")
             return Text("\(decimalValue) \(String(localized: "g", comment: "Gram abbreviation"))")
         case .minute:
         case .minute: