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

Sticky "Got it!" button to bottom of bolus calc popup, and

* rearrange fat and protein in popup
* l18n automations
* linting
Mike Plante 1 год назад
Родитель
Сommit
4b4fea151c

+ 3 - 0
Trio/Sources/Localizations/Main/Localizable.xcstrings

@@ -146826,6 +146826,9 @@
         }
       }
     },
+    "Submodules" : {
+
+    },
     "Subtract IOB" : {
       "localizations" : {
         "ar" : {

+ 12 - 12
Trio/Sources/Modules/Treatments/View/PopupView.swift

@@ -35,23 +35,23 @@ struct PopupView: View {
                         }
                     }
 
-                    if state.fat > 0 {
+                    if state.protein > 0 {
                         GridRow {
-                            Text("Fat").foregroundColor(.secondary)
+                            Text("Protein").foregroundColor(.secondary)
                             Color.clear.gridCellUnsizedAxes([.horizontal, .vertical])
                             HStack {
-                                Text(state.fat.formatted())
+                                Text(state.protein.formatted())
                                 Text("g").foregroundColor(.secondary)
                             }.gridCellAnchor(.trailing)
                         }
                     }
 
-                    if state.protein > 0 {
+                    if state.fat > 0 {
                         GridRow {
-                            Text("Protein").foregroundColor(.secondary)
+                            Text("Fat").foregroundColor(.secondary)
                             Color.clear.gridCellUnsizedAxes([.horizontal, .vertical])
                             HStack {
-                                Text(state.protein.formatted())
+                                Text(state.fat.formatted())
                                 Text("g").foregroundColor(.secondary)
                             }.gridCellAnchor(.trailing)
                         }
@@ -109,16 +109,16 @@ struct PopupView: View {
                     }
                     limitsRow
                 }
-
-                Spacer()
-
+            }
+            .padding([.horizontal, .bottom])
+            .font(.subheadline)
+            .safeAreaInset(edge: .bottom) {
                 Button { state.showInfo = false }
                 label: { Text("Got it!").bold().frame(maxWidth: .infinity, minHeight: 30, alignment: .center) }
                     .buttonStyle(.bordered)
-                    .padding(.top)
+                    .padding(.horizontal)
+                    .background(Color(UIColor.systemBackground))
             }
-            .padding([.horizontal, .bottom])
-            .font(.subheadline)
         }
     }
 

+ 1 - 1
Trio/Sources/Services/BolusCalculator/BolusCalculationManager.swift

@@ -406,7 +406,7 @@ final class BaseBolusCalculationManager: BolusCalculationManager, Injectable {
         // the final result for recommended insulin amount
         var insulinCalculated: Decimal
         let isLoopStale = Date().timeIntervalSince(apsManager.lastLoopDate) > 15 * 60
-        
+
         // don't recommend insulin when current glucose or minPredBG is < 54 or last sucessful loop was over 15 minutes ago
         if input.currentBG < 54 || input.minPredBG < 54 || isLoopStale {
             insulinCalculated = 0