@@ -28,6 +28,7 @@ public struct SettingsView: View {
2828 @State private var cgmChooserIsPresented : Bool = false
2929 @State private var serviceChooserIsPresented : Bool = false
3030 @State private var therapySettingsIsPresented : Bool = false
31+ @State private var profilesIsPresented : Bool = false
3132 @State private var deletePumpDataAlertIsPresented = false
3233 @State private var deleteCGMDataAlertIsPresented = false
3334
@@ -198,6 +199,10 @@ extension SettingsView {
198199 }
199200 }
200201
202+ private var isAnySheetPresented : Bool {
203+ therapySettingsIsPresented || profilesIsPresented
204+ }
205+
201206 private var configurationSection : some View {
202207 Section ( header: SectionHeader ( label: NSLocalizedString ( " Configuration " , comment: " The title of the Configuration section in settings " ) ) ) {
203208 LargeButton ( action: { self . therapySettingsIsPresented = true } ,
@@ -221,6 +226,26 @@ extension SettingsView {
221226 . environment ( \. insulinTintColor, self . insulinTintColor)
222227 }
223228
229+ LargeButton ( action: { self . profilesIsPresented = true } ,
230+ includeArrow: true ,
231+ imageView: AnyView ( Image ( systemName: " arrow.triangle.2.circlepath " ) . font ( . system( size: 30 , weight: . bold) ) ) ,
232+ label: NSLocalizedString ( " Profiles " , comment: " Title text for button to Profiles " ) ,
233+ descriptiveText: NSLocalizedString ( " Switch between profiles for different scenarios " , comment: " Descriptive text for Profiles " ) )
234+ . sheet ( isPresented: $profilesIsPresented) {
235+ ProfileView ( viewModel: ProfileViewModel ( therapySettings: self . viewModel. therapySettings ( ) ,
236+ sensitivityOverridesEnabled: FeatureFlags . sensitivityOverridesEnabled,
237+ adultChildInsulinModelSelectionEnabled: FeatureFlags . adultChildInsulinModelSelectionEnabled,
238+ delegate: self . viewModel. therapySettingsViewModelDelegate) )
239+ . environmentObject ( displayGlucoseUnitObservable)
240+ . environment ( \. dismissAction, self . dismiss)
241+ . environment ( \. appName, self . appName)
242+ . environment ( \. chartColorPalette, . primary)
243+ . environment ( \. carbTintColor, self . carbTintColor)
244+ . environment ( \. glucoseTintColor, self . glucoseTintColor)
245+ . environment ( \. guidanceColors, self . guidanceColors)
246+ . environment ( \. insulinTintColor, self . insulinTintColor)
247+ }
248+
224249 ForEach ( pluginMenuItems. filter { $0. section == . configuration} ) { item in
225250 item. view
226251 }
0 commit comments