diff --git a/FreeAPS/Sources/Modules/Bolus/BolusStateModel.swift b/FreeAPS/Sources/Modules/Bolus/BolusStateModel.swift index 6ab113298..7c4c01660 100644 --- a/FreeAPS/Sources/Modules/Bolus/BolusStateModel.swift +++ b/FreeAPS/Sources/Modules/Bolus/BolusStateModel.swift @@ -235,10 +235,6 @@ extension Bolus { .roundBolus(amount: max(self.insulinRecommended, 0)) self.getDeltaBG() - - if self.useCalc { - self.apsManager.determineBasalSync() - } } } } diff --git a/FreeAPS/Sources/Modules/Bolus/View/AlternativeBolusCalcRootView.swift b/FreeAPS/Sources/Modules/Bolus/View/AlternativeBolusCalcRootView.swift index 917caac11..3e9bcd61d 100644 --- a/FreeAPS/Sources/Modules/Bolus/View/AlternativeBolusCalcRootView.swift +++ b/FreeAPS/Sources/Modules/Bolus/View/AlternativeBolusCalcRootView.swift @@ -100,36 +100,44 @@ extension Bolus { header: { Text("Values") } Section { - HStack { - Text("Recommended Bolus") - Spacer() - - Text( - formatter - .string(from: Double(insulinCalculated) as NSNumber)! - ) - let unit = NSLocalizedString( - " U", - comment: "Unit in number of units delivered (keep the space character!)" - ) - Text(unit).foregroundColor(.secondary) - }.contentShape(Rectangle()) - .onTapGesture { - state.amount = insulinCalculated + if state.waitForSuggestion { + HStack { + Text("Wait please").foregroundColor(.secondary) + Spacer() + ActivityIndicator(isAnimating: .constant(true), style: .medium) // fix iOS 15 bug } - - if !state.waitForSuggestion { + } else { HStack { - Text("Bolus") + Text("Recommended Bolus") Spacer() - DecimalTextField( - "0", - value: $state.amount, - formatter: formatter, - autofocus: false, - cleanInput: true + + Text( + formatter + .string(from: Double(insulinCalculated) as NSNumber)! + ) + let unit = NSLocalizedString( + " U", + comment: "Unit in number of units delivered (keep the space character!)" ) - Text(!(state.amount > state.maxBolus) ? "U" : "😵").foregroundColor(.secondary) + Text(unit).foregroundColor(.secondary) + }.contentShape(Rectangle()) + .onTapGesture { + state.amount = insulinCalculated + } + + if !state.waitForSuggestion { + HStack { + Text("Bolus") + Spacer() + DecimalTextField( + "0", + value: $state.amount, + formatter: formatter, + autofocus: false, + cleanInput: true + ) + Text(!(state.amount > state.maxBolus) ? "U" : "😵").foregroundColor(.secondary) + } } } } diff --git a/FreeAPS/Sources/Modules/Home/View/HomeRootView.swift b/FreeAPS/Sources/Modules/Home/View/HomeRootView.swift index a74c57add..a4d4bd0d1 100644 --- a/FreeAPS/Sources/Modules/Home/View/HomeRootView.swift +++ b/FreeAPS/Sources/Modules/Home/View/HomeRootView.swift @@ -511,7 +511,10 @@ extension Home { .foregroundColor(.loopGreen) .buttonStyle(.borderless) Spacer() - Button { state.showModal(for: .bolus(waitForSuggestion: false)) } + Button { + state.showModal(for: .bolus(waitForSuggestion: true)) + state.apsManager.determineBasalSync() + } label: { Image("bolus") .renderingMode(.template)