|
|
@@ -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)
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|