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 22, 2024
1 parent 446adc3 commit e355301
Show file tree
Hide file tree
Showing 2 changed files with 54 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,50 @@
// 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
@EnvironmentObject var styleManager: StyleManager

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

if self.rootOwnerViewModel.isCompanyConnected {
CredentialsSection()
ProfilesSection()
AccountSection()
}
}
}
.scrollDisabled(true)
.tint(self.styleManager.accentColor)
.preferredColorScheme(self.styleManager.colorScheme)
.toolbar {
ToolbarItem(placement: .principal) {
Text(l10n.SettingsView.navigationTitle)
// TODO: (@ui/ux) - Design System - replace with Leka font

Check warning on line 34 in Apps/LekaApp/Sources/_NEWCodeBase/Views/Settings/SettingsView.swift

View workflow job for this annotation

GitHub Actions / swiftlint

TODOs should be resolved ((@ui/ux) - Design System - rep...) (todo)
.font(.headline)
}
ToolbarItem(placement: .topBarLeading) {
Button(String(l10n.SettingsView.closeButtonLabel.characters)) {
self.rootOwnerViewModel.isSettingsViewPresented = false
}
}
}
}
}
}

#Preview {
SettingsView()
.environmentObject(StyleManager())
}

0 comments on commit e355301

Please sign in to comment.