polscm32 2 lat temu
rodzic
commit
44508fb9c5

+ 2 - 2
FreeAPS/Sources/Modules/Bolus/BolusStateModel.swift

@@ -332,7 +332,7 @@ extension Bolus {
 //            }
 //        }
 
-        func addCarbs(_ continue_: Bool, fetch: Bool) {
+        func addCarbs() {
             guard carbs > 0 || fat > 0 || protein > 0 else { return }
             carbs = min(carbs, maxCarbs)
             id_ = UUID().uuidString
@@ -350,7 +350,7 @@ extension Bolus {
             )]
             carbsStorage.storeCarbs(carbsToStore)
 
-            if skipBolus, !continue_, !fetch {
+            if skipBolus {
                 apsManager.determineBasalSync()
                 showModal(for: nil)
             } else if carbs > 0 {

+ 15 - 75
FreeAPS/Sources/Modules/Bolus/View/AlternativeBolusCalcRootView.swift

@@ -6,10 +6,6 @@ import Swinject
 extension Bolus {
     struct AlternativeBolusCalcRootView: BaseView {
         let resolver: Resolver
-        let waitForSuggestion: Bool
-        let fetch: Bool
-        let editMode: Bool
-        let override: Bool
 
         @StateObject var state: StateModel
 
@@ -398,26 +394,18 @@ extension Bolus {
                         }
                     }
 
-                    if state.waitForSuggestion {
-                        HStack {
-                            Text("Wait please").foregroundColor(.secondary)
-                            Spacer()
-                            ActivityIndicator(isAnimating: .constant(true), style: .medium) // fix iOS 15 bug
-                        }
-                    } else {
-                        HStack {
-                            Text("Recommended Bolus")
-                            Spacer()
-                            Text(
-                                formatter
-                                    .string(from: Double(state.insulinCalculated) as NSNumber) ?? ""
-                            )
-                            Text(
-                                NSLocalizedString(" U", comment: "Unit in number of units delivered (keep the space character!)")
-                            ).foregroundColor(.secondary)
-                        }.contentShape(Rectangle())
-                            .onTapGesture { state.amount = state.insulinCalculated }
-                    }
+                    HStack {
+                        Text("Recommended Bolus")
+                        Spacer()
+                        Text(
+                            formatter
+                                .string(from: Double(state.insulinCalculated) as NSNumber) ?? ""
+                        )
+                        Text(
+                            NSLocalizedString(" U", comment: "Unit in number of units delivered (keep the space character!)")
+                        ).foregroundColor(.secondary)
+                    }.contentShape(Rectangle())
+                        .onTapGesture { state.amount = state.insulinCalculated }
 
                     HStack {
                         Text("Bolus")
@@ -446,7 +434,7 @@ extension Bolus {
                         Button {
                             state.add()
                             state.hideModal()
-                            state.addCarbs(override, fetch: editMode)
+                            state.addCarbs()
                         }
                         label: { Text(exceededMaxBolus ? "Max Bolus exceeded!" : "Enact bolus") }
                             .frame(maxWidth: .infinity, alignment: .center)
@@ -459,7 +447,7 @@ extension Bolus {
                     Section {
                         Button {
                             state.hideModal()
-                            state.addCarbs(override, fetch: editMode)
+                            state.addCarbs()
                         }
                         label: { Text("Continue without bolus") }.frame(maxWidth: .infinity, alignment: .center)
                     }.listRowBackground(Color.chart)
@@ -479,8 +467,6 @@ extension Bolus {
                 })
                 .onAppear {
                     configureView {
-                        state.waitForSuggestionInitial = waitForSuggestion
-                        state.waitForSuggestion = waitForSuggestion
                         state.insulinCalculated = state.calculateInsulin()
                     }
                 }
@@ -488,7 +474,7 @@ extension Bolus {
                 .sheet(isPresented: $showInfo) {
                     calculationsDetailView
                         .presentationDetents(
-                            [fetch ? .large : .fraction(0.9), .large],
+                            [.fraction(0.9), .large],
                             selection: $calculatorDetent
                         )
                 }
@@ -839,52 +825,6 @@ extension Bolus {
 
                         DividerCustom()
 
-                        if fetch {
-                            // meal entries as grid rows
-
-                            GridRow {
-                                if let carbs = meal.first?.carbs, carbs > 0 {
-                                    Text("Carbs").foregroundColor(.secondary)
-                                    Color.clear.gridCellUnsizedAxes([.horizontal, .vertical])
-                                    HStack {
-                                        Text(carbs.formatted())
-                                        Text("g").foregroundColor(.secondary)
-                                    }.gridCellAnchor(.trailing)
-                                }
-                            }
-
-                            GridRow {
-                                if let fat = meal.first?.fat, fat > 0 {
-                                    Text("Fat").foregroundColor(.secondary)
-                                    Color.clear.gridCellUnsizedAxes([.horizontal, .vertical])
-                                    HStack {
-                                        Text(fat.formatted())
-                                        Text("g").foregroundColor(.secondary)
-                                    }.gridCellAnchor(.trailing)
-                                }
-                            }
-
-                            GridRow {
-                                if let protein = meal.first?.protein, protein > 0 {
-                                    Text("Protein").foregroundColor(.secondary)
-                                    Color.clear.gridCellUnsizedAxes([.horizontal, .vertical])
-                                    HStack {
-                                        Text(protein.formatted())
-                                        Text("g").foregroundColor(.secondary)
-                                    }.gridCellAnchor(.trailing)
-                                }
-                            }
-
-                            GridRow {
-                                if let note = meal.first?.note, note != "" {
-                                    Text("Note").foregroundColor(.secondary)
-                                    Text(note).foregroundColor(.secondary).gridCellColumns(2).gridCellAnchor(.trailing)
-                                }
-                            }
-
-                            DividerCustom()
-                        }
-
                         GridRow {
                             Text("Detailed Calculation Steps").gridCellColumns(3).gridCellAnchor(.center)
                                 .padding(.bottom, 10)

+ 0 - 4
FreeAPS/Sources/Modules/Bolus/View/BolusRootView.swift

@@ -15,10 +15,6 @@ extension Bolus {
                 // show alternative bolus calc based on toggle in bolus calc settings
                 AlternativeBolusCalcRootView(
                     resolver: resolver,
-                    waitForSuggestion: waitForSuggestion,
-                    fetch: fetch,
-                    editMode: editMode,
-                    override: override,
                     state: state
                 )
             } else {