-
Notifications
You must be signed in to change notification settings - Fork 1
/
profile_loop.patch
50 lines (47 loc) · 2.9 KB
/
profile_loop.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
diff --git a/Loop/Views/SettingsView.swift b/Loop/Views/SettingsView.swift
index dc3f6ec3..8b38a7e3 100644
--- a/Loop/Views/SettingsView.swift
+++ b/Loop/Views/SettingsView.swift
@@ -28,6 +28,7 @@ public struct SettingsView: View {
@State private var cgmChooserIsPresented: Bool = false
@State private var serviceChooserIsPresented: Bool = false
@State private var therapySettingsIsPresented: Bool = false
+ @State private var profilesIsPresented: Bool = false
@State private var deletePumpDataAlertIsPresented = false
@State private var deleteCGMDataAlertIsPresented = false
@@ -198,6 +199,10 @@ extension SettingsView {
}
}
+ private var isAnySheetPresented: Bool {
+ therapySettingsIsPresented || profilesIsPresented
+ }
+
private var configurationSection: some View {
Section(header: SectionHeader(label: NSLocalizedString("Configuration", comment: "The title of the Configuration section in settings"))) {
LargeButton(action: { self.therapySettingsIsPresented = true },
@@ -221,6 +226,26 @@ extension SettingsView {
.environment(\.insulinTintColor, self.insulinTintColor)
}
+ LargeButton(action: { self.profilesIsPresented = true },
+ includeArrow: true,
+ imageView: AnyView(Image(systemName: "arrow.triangle.2.circlepath").font(.system(size: 30, weight: .bold))),
+ label: NSLocalizedString("Profiles", comment: "Title text for button to Profiles"),
+ descriptiveText: NSLocalizedString("Switch between profiles for different scenarios", comment: "Descriptive text for Profiles"))
+ .sheet(isPresented: $profilesIsPresented) {
+ ProfileView(viewModel: ProfileViewModel(therapySettings: self.viewModel.therapySettings(),
+ sensitivityOverridesEnabled: FeatureFlags.sensitivityOverridesEnabled,
+ adultChildInsulinModelSelectionEnabled: FeatureFlags.adultChildInsulinModelSelectionEnabled,
+ delegate: self.viewModel.therapySettingsViewModelDelegate))
+ .environmentObject(displayGlucoseUnitObservable)
+ .environment(\.dismissAction, self.dismiss)
+ .environment(\.appName, self.appName)
+ .environment(\.chartColorPalette, .primary)
+ .environment(\.carbTintColor, self.carbTintColor)
+ .environment(\.glucoseTintColor, self.glucoseTintColor)
+ .environment(\.guidanceColors, self.guidanceColors)
+ .environment(\.insulinTintColor, self.insulinTintColor)
+ }
+
ForEach(pluginMenuItems.filter {$0.section == .configuration}) { item in
item.view
}