|
@@ -10,15 +10,14 @@ import Foundation
|
|
|
func bolus(_ bolusAmount: Double) async throws -> LocalizedStringResource {
|
|
func bolus(_ bolusAmount: Double) async throws -> LocalizedStringResource {
|
|
|
var bolusQuantity: Decimal = 0
|
|
var bolusQuantity: Decimal = 0
|
|
|
switch settingsManager.settings.bolusShortcut {
|
|
switch settingsManager.settings.bolusShortcut {
|
|
|
-
|
|
|
|
|
- //Block boluses if they are disabled
|
|
|
|
|
|
|
+ // Block boluses if they are disabled
|
|
|
case .notAllowed:
|
|
case .notAllowed:
|
|
|
return LocalizedStringResource(
|
|
return LocalizedStringResource(
|
|
|
"Bolusing is not allowed with shortcuts.",
|
|
"Bolusing is not allowed with shortcuts.",
|
|
|
table: "ShortcutsDetail"
|
|
table: "ShortcutsDetail"
|
|
|
)
|
|
)
|
|
|
-
|
|
|
|
|
- //Block any bolus attempted if it is larger than the max bolus in settings
|
|
|
|
|
|
|
+
|
|
|
|
|
+ // Block any bolus attempted if it is larger than the max bolus in settings
|
|
|
case .limitBolusMax:
|
|
case .limitBolusMax:
|
|
|
if Decimal(bolusAmount) > settingsManager.pumpSettings.maxBolus {
|
|
if Decimal(bolusAmount) > settingsManager.pumpSettings.maxBolus {
|
|
|
return LocalizedStringResource(
|
|
return LocalizedStringResource(
|
|
@@ -28,8 +27,8 @@ import Foundation
|
|
|
} else {
|
|
} else {
|
|
|
bolusQuantity = apsManager.roundBolus(amount: Decimal(bolusAmount))
|
|
bolusQuantity = apsManager.roundBolus(amount: Decimal(bolusAmount))
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- //Block any bolus attempted if it is larger than the max bolus in settings
|
|
|
|
|
|
|
+
|
|
|
|
|
+ // Block any bolus attempted if it is larger than the max bolus in settings
|
|
|
case .limitInsulinSuggestion:
|
|
case .limitInsulinSuggestion:
|
|
|
let insulinSuggestion = suggestion?.insulinForManualBolus ?? 0
|
|
let insulinSuggestion = suggestion?.insulinForManualBolus ?? 0
|
|
|
if Decimal(bolusAmount) > insulinSuggestion {
|
|
if Decimal(bolusAmount) > insulinSuggestion {
|