Skip to content

Commit

Permalink
✨ (LekaApp): Add SettingsView
Browse files Browse the repository at this point in the history
  • Loading branch information
HPezz committed Jan 24, 2024
1 parent 44d261e commit f7a8e96
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ class RootOwnerViewModel: ObservableObject {
@Published var showConfirmDisconnection: Bool = false
@Published var showConfirmDeleteAccount: Bool = false

var isCompanyConnected: Bool {
!self.currentCompany.email.isEmpty && !self.currentCompany.password.isEmpty
}

func disconnect() {
self.currentCompany = Company(email: "", password: "", caregivers: [], carereceivers: [])
self.isWelcomeViewPresented = true
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// Leka - iOS Monorepo
// Copyright APF France handicap
// SPDX-License-Identifier: Apache-2.0

import DesignKit
import LocalizationKit
import SwiftUI

// MARK: - SettingsView

struct SettingsView: View {
@ObservedObject var rootOwnerViewModel: RootOwnerViewModel = .shared
@ObservedObject var styleManager: StyleManager = .shared

var body: some View {
NavigationStack {
Form {
AppearanceSection()

if self.rootOwnerViewModel.isCompanyConnected {
CredentialsSection()
AccountSection()
}
}
.navigationTitle(String(l10n.SettingsView.navigationTitle.characters))
.toolbar {
ToolbarItem(placement: .topBarTrailing) {
Button(String(l10n.SettingsView.closeButtonLabel.characters)) {
self.rootOwnerViewModel.isSettingsViewPresented = false
}
}
}
}
.preferredColorScheme(self.styleManager.colorScheme)
}
}

#Preview {
SettingsView()
}

0 comments on commit f7a8e96

Please sign in to comment.