diff --git a/Apps/LekaApp/Sources/_NEWCodeBase/Views/MainView/MainView.swift b/Apps/LekaApp/Sources/_NEWCodeBase/Views/MainView/MainView.swift index c1f397f7eb..b5990f6761 100644 --- a/Apps/LekaApp/Sources/_NEWCodeBase/Views/MainView/MainView.swift +++ b/Apps/LekaApp/Sources/_NEWCodeBase/Views/MainView/MainView.swift @@ -140,7 +140,7 @@ struct MainView: View { ActivityView(activity: activity) } .sheet(isPresented: self.$rootOwnerViewModel.isSettingsViewPresented) { - SettingsView() + SettingsView(isCaregiverPickerPresented: self.$isCaregiverPickerPresented) } .sheet(isPresented: self.$rootOwnerViewModel.isEditCaregiverViewPresented) { EditCaregiverView(modifiedCaregiver: self.rootOwnerViewModel.currentCaregiver!) diff --git a/Apps/LekaApp/Sources/_NEWCodeBase/Views/Settings/SettingsView+ProfilesSection.swift b/Apps/LekaApp/Sources/_NEWCodeBase/Views/Settings/SettingsView+ProfilesSection.swift index dbdad14ced..791ca214e4 100644 --- a/Apps/LekaApp/Sources/_NEWCodeBase/Views/Settings/SettingsView+ProfilesSection.swift +++ b/Apps/LekaApp/Sources/_NEWCodeBase/Views/Settings/SettingsView+ProfilesSection.swift @@ -11,12 +11,14 @@ extension SettingsView { struct ProfilesSection: View { // MARK: Internal + @Binding var isCaregiverPickerPresented: Bool + var body: some View { Section(String(l10n.SettingsView.ProfilesSection.header.characters)) { Button { self.rootOwnerViewModel.isSettingsViewPresented = false DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) { - self.rootOwnerViewModel.currentCaregiver = nil + self.isCaregiverPickerPresented = true } } label: { Label(String(l10n.SettingsView.ProfilesSection.switchProfileButtonLabel.characters), systemImage: "person.2.gobackward") @@ -32,5 +34,5 @@ extension SettingsView { } #Preview { - SettingsView.ProfilesSection() + SettingsView.ProfilesSection(isCaregiverPickerPresented: .constant(false)) } diff --git a/Apps/LekaApp/Sources/_NEWCodeBase/Views/Settings/SettingsView.swift b/Apps/LekaApp/Sources/_NEWCodeBase/Views/Settings/SettingsView.swift index f34c93c841..2069044b1f 100644 --- a/Apps/LekaApp/Sources/_NEWCodeBase/Views/Settings/SettingsView.swift +++ b/Apps/LekaApp/Sources/_NEWCodeBase/Views/Settings/SettingsView.swift @@ -9,14 +9,15 @@ import SwiftUI // MARK: - SettingsView struct SettingsView: View { - @ObservedObject var rootOwnerViewModel: RootOwnerViewModel = .shared - @ObservedObject var styleManager: StyleManager = .shared + @ObservedObject private var rootOwnerViewModel: RootOwnerViewModel = .shared + @ObservedObject private var styleManager: StyleManager = .shared + @Binding var isCaregiverPickerPresented: Bool var body: some View { NavigationStack { Form { CredentialsSection() - ProfilesSection() + ProfilesSection(isCaregiverPickerPresented: self.$isCaregiverPickerPresented) AccountSection() } .navigationTitle(String(l10n.SettingsView.navigationTitle.characters)) @@ -34,5 +35,5 @@ struct SettingsView: View { } #Preview { - SettingsView() + SettingsView(isCaregiverPickerPresented: .constant(false)) }