|
@@ -29,6 +29,7 @@ extension Settings {
|
|
|
isUpdateAvailable: false,
|
|
isUpdateAvailable: false,
|
|
|
isBlacklisted: false
|
|
isBlacklisted: false
|
|
|
)
|
|
)
|
|
|
|
|
+ @State private var closedLoopDisabled = true
|
|
|
|
|
|
|
|
@Environment(\.colorScheme) var colorScheme
|
|
@Environment(\.colorScheme) var colorScheme
|
|
|
@EnvironmentObject var appIcons: Icons
|
|
@EnvironmentObject var appIcons: Icons
|
|
@@ -113,6 +114,11 @@ extension Settings {
|
|
|
}
|
|
}
|
|
|
).listRowBackground(Color.chart)
|
|
).listRowBackground(Color.chart)
|
|
|
|
|
|
|
|
|
|
+ let miniHintText = closedLoopDisabled ?
|
|
|
|
|
+ String(localized: "Add a CGM and pump to enable automated insuin delivery") :
|
|
|
|
|
+ String(localized: "Enable automated insulin delivery.")
|
|
|
|
|
+ let miniHintTextColorForDisabled: Color = colorScheme == .dark ? .orange : .accentColor
|
|
|
|
|
+ let miniHintTextColor: Color = closedLoopDisabled ? miniHintTextColorForDisabled : .secondary
|
|
|
SettingInputSection(
|
|
SettingInputSection(
|
|
|
decimalValue: $decimalPlaceholder,
|
|
decimalValue: $decimalPlaceholder,
|
|
|
booleanValue: $state.closedLoop,
|
|
booleanValue: $state.closedLoop,
|
|
@@ -127,7 +133,7 @@ extension Settings {
|
|
|
units: state.units,
|
|
units: state.units,
|
|
|
type: .boolean,
|
|
type: .boolean,
|
|
|
label: String(localized: "Closed Loop"),
|
|
label: String(localized: "Closed Loop"),
|
|
|
- miniHint: String(localized: "Enable automated insulin delivery."),
|
|
|
|
|
|
|
+ miniHint: miniHintText,
|
|
|
verboseHint: VStack(alignment: .leading, spacing: 10) {
|
|
verboseHint: VStack(alignment: .leading, spacing: 10) {
|
|
|
Text(
|
|
Text(
|
|
|
"Running Trio in closed loop mode requires an active CGM sensor session and a connected pump. This enables automated insulin delivery."
|
|
"Running Trio in closed loop mode requires an active CGM sensor session and a connected pump. This enables automated insulin delivery."
|
|
@@ -136,8 +142,13 @@ extension Settings {
|
|
|
"Before enabling, dial in your settings (basal / insulin sensitivity / carb ratio), and familiarize yourself with the app."
|
|
"Before enabling, dial in your settings (basal / insulin sensitivity / carb ratio), and familiarize yourself with the app."
|
|
|
)
|
|
)
|
|
|
},
|
|
},
|
|
|
- headerText: String(localized: "Automated Insulin Delivery")
|
|
|
|
|
|
|
+ headerText: String(localized: "Automated Insulin Delivery"),
|
|
|
|
|
+ isToggleDisabled: closedLoopDisabled,
|
|
|
|
|
+ miniHintColor: miniHintTextColor
|
|
|
)
|
|
)
|
|
|
|
|
+ .onAppear {
|
|
|
|
|
+ closedLoopDisabled = !state.hasCgmAndPump()
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
Section(
|
|
Section(
|
|
|
header: Text("Trio Configuration"),
|
|
header: Text("Trio Configuration"),
|