Przeglądaj źródła

Restore `treatmentButtonBackground`

* plus l18n automations
Mike Plante 1 rok temu
rodzic
commit
1a4531112d

+ 6 - 6
Trio/Sources/Localizations/Main/Localizable.xcstrings

@@ -13722,12 +13722,6 @@
     "≈" : {
 
     },
-    "⚠️ Enact Bolus and Ignore Warning" : {
-
-    },
-    "⚠️ Glucose is very low! Give insulin?" : {
-
-    },
     "⚠️ Safety Notifications are OFF" : {
       "localizations" : {
         "ar" : {
@@ -81163,6 +81157,9 @@
     "Glucose Deviations Algorithm" : {
 
     },
+    "Glucose is very low! Give insulin?" : {
+
+    },
     "Glucose is very low." : {
 
     },
@@ -89522,6 +89519,9 @@
         }
       }
     },
+    "Ignore Warning and Enact Bolus" : {
+
+    },
     "Immediately applying ${carbQuantity} at ${dateAdded}" : {
       "localizations" : {
         "ar" : {

+ 9 - 5
Trio/Sources/Modules/Treatments/View/TreatmentsRootView.swift

@@ -382,7 +382,14 @@ extension Treatments {
         @State private var showDangerousLowAlert = false
 
         var treatmentButton: some View {
-            Button {
+            var treatmentButtonBackground = Color(.systemBlue)
+            if limitExceeded || (state.amount > 0 && state.currentBG <= 54) {
+                treatmentButtonBackground = Color(.systemRed)
+            } else if disableTaskButton {
+                treatmentButtonBackground = Color(.systemGray)
+            }
+
+            return Button {
                 if state.currentBG <= 54 {
                     showDangerousLowAlert = true
                 } else {
@@ -403,10 +410,7 @@ extension Treatments {
                 .frame(height: 35)
             }
             .disabled(disableTaskButton)
-            .listRowBackground(
-                limitExceeded || (state.amount > 0 && state.currentBG <= 54) ? Color(.systemRed) :
-                    disableTaskButton ? Color(.systemGray) : Color(.systemBlue)
-            )
+            .listRowBackground(treatmentButtonBackground)
             .shadow(radius: 3)
             .clipShape(RoundedRectangle(cornerRadius: 8))
             .confirmationDialog(