From 0e3a4701df262ef286b302f83239b80a69003e9f Mon Sep 17 00:00:00 2001 From: Hugo Pezziardi Date: Wed, 24 Jan 2024 10:20:20 +0100 Subject: [PATCH 1/8] :recycle: (LekaApp): Add StyleManager shared instance and refactor views --- Apps/LekaApp/Sources/MainApp.swift | 9 +++------ .../LekaApp/Sources/_NEWCodeBase/Views/WelcomeView.swift | 1 - Modules/DesignKit/Sources/StyleManager.swift | 2 ++ 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/Apps/LekaApp/Sources/MainApp.swift b/Apps/LekaApp/Sources/MainApp.swift index cf938517de..86d21aacff 100644 --- a/Apps/LekaApp/Sources/MainApp.swift +++ b/Apps/LekaApp/Sources/MainApp.swift @@ -9,23 +9,20 @@ import SwiftUI struct LekaApp: App { @Environment(\.colorScheme) var colorScheme - @StateObject var viewRouter = ViewRouterDeprecated() - @StateObject var styleManager: StyleManager = .init() + @ObservedObject var styleManager: StyleManager = .shared @ObservedObject var rootOwnerViewModel = RootOwnerViewModel.shared var body: some Scene { WindowGroup { MainView() - .tint(self.styleManager.accentColor) - .preferredColorScheme(self.styleManager.colorScheme) - .environmentObject(self.styleManager) - .environmentObject(self.viewRouter) .onAppear { self.styleManager.setDefaultColorScheme(self.colorScheme) } .fullScreenCover(isPresented: self.$rootOwnerViewModel.isWelcomeViewPresented) { WelcomeView() } + .tint(self.styleManager.accentColor) + .preferredColorScheme(self.styleManager.colorScheme) } } } diff --git a/Apps/LekaApp/Sources/_NEWCodeBase/Views/WelcomeView.swift b/Apps/LekaApp/Sources/_NEWCodeBase/Views/WelcomeView.swift index 73d54ee50f..b148ffa62e 100644 --- a/Apps/LekaApp/Sources/_NEWCodeBase/Views/WelcomeView.swift +++ b/Apps/LekaApp/Sources/_NEWCodeBase/Views/WelcomeView.swift @@ -39,5 +39,4 @@ struct WelcomeView: View { #Preview { WelcomeView() - .environmentObject(ViewRouterDeprecated()) } diff --git a/Modules/DesignKit/Sources/StyleManager.swift b/Modules/DesignKit/Sources/StyleManager.swift index 529190af95..1caa1b8252 100644 --- a/Modules/DesignKit/Sources/StyleManager.swift +++ b/Modules/DesignKit/Sources/StyleManager.swift @@ -14,6 +14,8 @@ public class StyleManager: ObservableObject { // MARK: Public + public static let shared = StyleManager(accentColor: DesignKitAsset.Colors.lekaDarkBlue.swiftUIColor) + @Published public var accentColor: Color? @Published public var colorScheme: ColorScheme From b2e14b79195b7ce7cbdce7ba909e6a4fe241fb8f Mon Sep 17 00:00:00 2001 From: Hugo Pezziardi Date: Fri, 19 Jan 2024 17:08:21 +0100 Subject: [PATCH 2/8] :sparkles: (LekaApp): Add Settings button to MainView --- .../Views/MainView/MainView.swift | 27 +++++++++++++- .../Views/MainView/RootOwnerViewModel.swift | 4 ++ .../Views/MainView/SettingsLabel.swift | 37 +++++++++++++++++++ 3 files changed, 66 insertions(+), 2 deletions(-) create mode 100644 Apps/LekaApp/Sources/_NEWCodeBase/Views/MainView/SettingsLabel.swift diff --git a/Apps/LekaApp/Sources/_NEWCodeBase/Views/MainView/MainView.swift b/Apps/LekaApp/Sources/_NEWCodeBase/Views/MainView/MainView.swift index 9da2225427..18a7260204 100644 --- a/Apps/LekaApp/Sources/_NEWCodeBase/Views/MainView/MainView.swift +++ b/Apps/LekaApp/Sources/_NEWCodeBase/Views/MainView/MainView.swift @@ -8,12 +8,16 @@ import LocalizationKit import RobotKit import SwiftUI +extension Bundle { + static var version = Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString") as? String + static var buildNumber = Bundle.main.object(forInfoDictionaryKey: "CFBundleVersion") as? String +} + // MARK: - MainView struct MainView: View { - @EnvironmentObject var styleManager: StyleManager - @ObservedObject var navigation: Navigation = .shared + @ObservedObject var rootOwnerViewModel: RootOwnerViewModel = .shared @StateObject var viewModel: ViewModel = .init() var body: some View { @@ -43,6 +47,22 @@ struct MainView: View { CategoryLabel(category: .remotes) CategoryLabel(category: .stories) } + + HStack { + Spacer() + VStack(spacing: 20) { + Button { + self.rootOwnerViewModel.isSettingsViewPresented = true + } label: { + SettingsLabel() + } + + Text("My Leka App - Version \(Bundle.version!) (\(Bundle.buildNumber!))") + .foregroundColor(.gray) + .font(.caption2) + } + Spacer() + } } // TODO: (@ladislas) remove if not necessary // .disabled(navigation.disableUICompletly) @@ -106,6 +126,9 @@ struct MainView: View { .fullScreenCover(isPresented: self.$viewModel.isRobotConnectionPresented) { RobotConnectionView(viewModel: RobotConnectionViewModel()) } + .fullScreenCover(isPresented: self.$rootOwnerViewModel.isSettingsViewPresented) { + SettingsView() + } } } diff --git a/Apps/LekaApp/Sources/_NEWCodeBase/Views/MainView/RootOwnerViewModel.swift b/Apps/LekaApp/Sources/_NEWCodeBase/Views/MainView/RootOwnerViewModel.swift index 86ddd42f22..ff4f0f04c7 100644 --- a/Apps/LekaApp/Sources/_NEWCodeBase/Views/MainView/RootOwnerViewModel.swift +++ b/Apps/LekaApp/Sources/_NEWCodeBase/Views/MainView/RootOwnerViewModel.swift @@ -18,6 +18,10 @@ class RootOwnerViewModel: ObservableObject { @Published var currentCompany = Company(email: "", password: "", caregivers: [], carereceivers: []) @Published var isWelcomeViewPresented = true + @Published var isSettingsViewPresented = false + + @Published var showConfirmDisconnection: Bool = false + @Published var showConfirmDeleteAccount: Bool = false func disconnect() { self.currentCompany = Company(email: "", password: "", caregivers: [], carereceivers: []) diff --git a/Apps/LekaApp/Sources/_NEWCodeBase/Views/MainView/SettingsLabel.swift b/Apps/LekaApp/Sources/_NEWCodeBase/Views/MainView/SettingsLabel.swift new file mode 100644 index 0000000000..00107e713b --- /dev/null +++ b/Apps/LekaApp/Sources/_NEWCodeBase/Views/MainView/SettingsLabel.swift @@ -0,0 +1,37 @@ +// Leka - iOS Monorepo +// Copyright APF France handicap +// SPDX-License-Identifier: Apache-2.0 + +import DesignKit +import LocalizationKit +import RobotKit +import SwiftUI + +// MARK: - SettingsLabel + +struct SettingsLabel: View { + // MARK: Internal + + var body: some View { + Label(String(l10n.SettingsLabel.buttonLabel.characters), systemImage: "gear") + .frame(width: 200, height: 44) + .background(self.backgroundColor, in: RoundedRectangle(cornerRadius: 10, style: .continuous)) + .contentShape(Rectangle()) + } + + // MARK: Private + + private let backgroundColor: Color = .init(light: UIColor.white, dark: UIColor.systemGray5) +} + +// MARK: - l10n.SettingsLabel + +extension l10n { + enum SettingsLabel { + static let buttonLabel = LocalizedString("lekaapp.settings_label.title", value: "Settings", comment: "Settings button label") + } +} + +#Preview { + SettingsLabel() +} From 14a15c014e03a43e974cee813ac5c5d303b5976b Mon Sep 17 00:00:00 2001 From: Hugo Pezziardi Date: Fri, 19 Jan 2024 17:08:52 +0100 Subject: [PATCH 3/8] :globe_with_meridians: (LekaApp): Add SettingsView l10n file --- Apps/LekaApp/Resources/Localizable.xcstrings | 1290 +++++++++++------ .../Views/Settings/SettingsView+l10n.swift | 65 + 2 files changed, 944 insertions(+), 411 deletions(-) create mode 100644 Apps/LekaApp/Sources/_NEWCodeBase/Views/Settings/SettingsView+l10n.swift diff --git a/Apps/LekaApp/Resources/Localizable.xcstrings b/Apps/LekaApp/Resources/Localizable.xcstrings index d895da1b1d..d81676924e 100644 --- a/Apps/LekaApp/Resources/Localizable.xcstrings +++ b/Apps/LekaApp/Resources/Localizable.xcstrings @@ -1,618 +1,1086 @@ { - "sourceLanguage": "en", - "strings": { - "lekaapp.welcome_view.create_account_button": { - "comment": "Create account button on WelcomeView", - "extractionState": "extracted_with_value", - "localizations": { - "en": { - "stringUnit": { - "state": "new", - "value": "Create account" + "sourceLanguage" : "en", + "strings" : { + "lekaapp.account_creation_process.step_1.go_button" : { + "comment" : "Step 1 continue button", + "extractionState" : "extracted_with_value", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "new", + "value" : "Let's start! 🏃" } }, - "fr": { - "stringUnit": { - "state": "translated", - "value": "CrĂ©er un compte" + "fr" : { + "stringUnit" : { + "state" : "translated", + "value" : "Commençons ! 🏃" } } } }, - "lekaapp.welcome_view.login_button": { - "comment": "Login button on WelcomeView", - "extractionState": "extracted_with_value", - "localizations": { - "en": { - "stringUnit": { - "state": "new", - "value": "Login" + "lekaapp.account_creation_process.step_1.message" : { + "comment" : "Step 1 message", + "extractionState" : "extracted_with_value", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "new", + "value" : "We will now guide you throught\nthe creation of your account\nand the different steps.\nReady?" } }, - "fr": { - "stringUnit": { - "state": "translated", - "value": "Se connecter" + "fr" : { + "stringUnit" : { + "state" : "translated", + "value" : "Nous allons maintenant vous guider\nĂ  travers la crĂ©ation de votre compte\net les diffĂ©rentes Ă©tapes.\nPrĂȘt(e)?" } } } }, - "lekaapp.welcome_view.skip_step_button": { - "comment": "Skip step button on WelcomeView", - "extractionState": "extracted_with_value", - "localizations": { - "en": { - "stringUnit": { - "state": "new", - "value": "Skip this step" + "lekaapp.account_creation_process.step_1.title" : { + "comment" : "Step 1 title", + "extractionState" : "extracted_with_value", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "new", + "value" : "Welcome to our account creation process! 👋" } }, - "fr": { - "stringUnit": { - "state": "translated", - "value": "Passer cette Ă©tape" + "fr" : { + "stringUnit" : { + "state" : "translated", + "value" : "Bienvenue dans notre processus de crĂ©ation de compte ! 👋" } } } }, - "main_view.sidebar.section.information": { - "comment": "The title of the section 'Information'", - "extractionState": "extracted_with_value", - "localizations": { - "en": { - "stringUnit": { - "state": "new", - "value": "Information" + "lekaapp.account_creation_process.step_2.create_button" : { + "comment" : "Step 2 create button", + "extractionState" : "extracted_with_value", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "new", + "value" : "Create" } }, - "fr": { - "stringUnit": { - "state": "translated", - "value": "Informations" + "fr" : { + "stringUnit" : { + "state" : "translated", + "value" : "CrĂ©er" } } } }, - "main_view.sidebar.section.content": { - "comment": "The title of the section 'Content'", - "extractionState": "extracted_with_value", - "localizations": { - "en": { - "stringUnit": { - "state": "new", - "value": "Content" + "lekaapp.account_creation_process.step_2.message" : { + "comment" : "Step 2 message", + "extractionState" : "extracted_with_value", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "new", + "value" : "First, let's create your profile as a caregiver." } }, - "fr": { - "stringUnit": { - "state": "translated", - "value": "Contenu" + "fr" : { + "stringUnit" : { + "state" : "translated", + "value" : "Tout d'abord, crĂ©ons votre profil en tant qu'aidant." } } } }, - "main_view.sidebar.navigation_title": { - "comment": "The title of the sidebar", - "extractionState": "extracted_with_value", - "localizations": { - "en": { - "stringUnit": { - "state": "new", - "value": "Leka App" + "lekaapp.account_creation_process.step_2.title" : { + "comment" : "Step 2 title", + "extractionState" : "extracted_with_value", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "new", + "value" : "Step 1 - Caregiver profile" } }, - "fr": { - "stringUnit": { - "state": "translated", - "value": "Leka App" + "fr" : { + "stringUnit" : { + "state" : "translated", + "value" : "Étape 1 - Profil de l'aidant" } } } }, - "main_view.sidebar.category_label.stories": { - "comment": "The title of the category 'Stories'", - "extractionState": "extracted_with_value", - "localizations": { - "en": { - "stringUnit": { - "state": "new", - "value": "Stories" + "lekaapp.account_creation_process.step_3.create_button" : { + "comment" : "Step 3 create button", + "extractionState" : "extracted_with_value", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "new", + "value" : "Create" } }, - "fr": { - "stringUnit": { - "state": "translated", - "value": "Histoires" + "fr" : { + "stringUnit" : { + "state" : "translated", + "value" : "CrĂ©er" } } } }, - "main_view.sidebar.category_label.resources": { - "comment": "The title of the category 'Resources'", - "extractionState": "extracted_with_value", - "localizations": { - "en": { - "stringUnit": { - "state": "new", - "value": "Resources" + "lekaapp.account_creation_process.step_3.message" : { + "comment" : "Step 3 message", + "extractionState" : "extracted_with_value", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "new", + "value" : "We will now create your first\ncare receiver profile." } }, - "fr": { - "stringUnit": { - "state": "translated", - "value": "Ressources" + "fr" : { + "stringUnit" : { + "state" : "translated", + "value" : "Nous allons maintenant crĂ©er votre premier\nprofil de bĂ©nĂ©ficiaire de soins." } } } }, - "main_view.sidebar.category_label.remotes": { - "comment": "The title of the category 'Remotes'", - "extractionState": "extracted_with_value", - "localizations": { - "en": { - "stringUnit": { - "state": "new", - "value": "Remotes" + "lekaapp.account_creation_process.step_3.title" : { + "comment" : "Step 3 title", + "extractionState" : "extracted_with_value", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "new", + "value" : "Step 2 - Care receiver profile" } }, - "fr": { - "stringUnit": { - "state": "translated", - "value": "TĂ©lĂ©commandes" + "fr" : { + "stringUnit" : { + "state" : "translated", + "value" : "Étape 2 - Profil du bĂ©nĂ©ficiaire de soins" } } } }, - "main_view.sidebar.category_label.news": { - "comment": "The title of the category 'News'", - "extractionState": "extracted_with_value", - "localizations": { - "en": { - "stringUnit": { - "state": "new", - "value": "News" + "lekaapp.account_creation_process.step_4.discover_content_button" : { + "comment" : "Step 4 discover content button", + "extractionState" : "extracted_with_value", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "new", + "value" : "Let's go! 🚀" } }, - "fr": { - "stringUnit": { - "state": "translated", - "value": "NouveautĂ©s" + "fr" : { + "stringUnit" : { + "state" : "translated", + "value" : "Allons-y ! 🚀" } } } }, - "main_view.sidebar.category_label.curriculums": { - "comment": "The title of the category 'Curriculums'", - "extractionState": "extracted_with_value", - "localizations": { - "en": { - "stringUnit": { - "state": "new", - "value": "Curriculums" + "lekaapp.account_creation_process.step_4.message" : { + "comment" : "Step 4 message", + "extractionState" : "extracted_with_value", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "new", + "value" : "You have completed process brilliantly:\n\n- Create your caregiver profile ✅\n- Create your first care receiver profile ✅\n\nYou can now discover the Leka App and dive deep in our educational content!" } }, - "fr": { - "stringUnit": { - "state": "translated", - "value": "Parcours" + "fr" : { + "stringUnit" : { + "state" : "translated", + "value" : "Vous avez brillamment complĂ©tĂ© le processus :\n\n- CrĂ©er votre profil d'aidant ✅\n- CrĂ©er votre premier profil de bĂ©nĂ©ficiaire de soins ✅\n\nVous pouvez maintenant dĂ©couvrir l'appli Leka et approfondir notre contenu Ă©ducatif !" } } } }, - "main_view.sidebar.category_label.activities": { - "comment": "The title of the category 'Activities'", - "extractionState": "extracted_with_value", - "localizations": { - "en": { - "stringUnit": { - "state": "new", - "value": "Activities" + "lekaapp.account_creation_process.step_4.title" : { + "comment" : "Step 4 title", + "extractionState" : "extracted_with_value", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "new", + "value" : "🎉 Congratulations! 👏" } }, - "fr": { - "stringUnit": { - "state": "translated", - "value": "ActivitĂ©s" + "fr" : { + "stringUnit" : { + "state" : "translated", + "value" : "🎉 FĂ©licitations ! 👏" } } } }, - "lekaapp.connection_view.title": { - "comment": "ConnectionView title", - "extractionState": "extracted_with_value", - "localizations": { - "en": { - "stringUnit": { - "state": "new", - "value": "Account connection" + "lekaapp.account_creation_view.connection_button" : { + "comment" : "Connection button on SignupView", + "extractionState" : "extracted_with_value", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "new", + "value" : "Connection" } }, - "fr": { - "stringUnit": { - "state": "translated", - "value": "Connexion au compte" + "fr" : { + "stringUnit" : { + "state" : "translated", + "value" : "Connexion" } } } }, - "lekaapp.connection_view.password_forgotten_button": { - "comment": "ConnectionView password forgotten button", - "extractionState": "extracted_with_value", - "localizations": { - "en": { - "stringUnit": { - "state": "new", - "value": "[Forgot password?](https://leka.io)" + "lekaapp.account_creation_view.create_account_title" : { + "comment" : "Create account title on SignupView", + "extractionState" : "extracted_with_value", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "new", + "value" : "Create an account" } }, - "fr": { - "stringUnit": { - "state": "translated", - "value": "[Mot de passe oubliĂ© ?](https://leka.io)" + "fr" : { + "stringUnit" : { + "state" : "translated", + "value" : "CrĂ©er un compte" } } } }, - "lekaapp.connection_view.connection_button": { - "comment": "ConnectionView connection button", - "extractionState": "extracted_with_value", - "localizations": { - "en": { - "stringUnit": { - "state": "new", - "value": "Connect" + "lekaapp.account_creation_view.navigation_title" : { + "comment" : "NavigationBar title on the whole Signup process", + "extractionState" : "extracted_with_value", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "new", + "value" : "Account Creation Process" } }, - "fr": { - "stringUnit": { - "state": "translated", - "value": "Se connecter" + "fr" : { + "stringUnit" : { + "state" : "translated", + "value" : "Processus de crĂ©ation de compte" } } } }, - "lekaapp.account_creation_view.navigation_title": { - "comment": "NavigationBar title on the whole Signup process", - "extractionState": "extracted_with_value", - "localizations": { - "en": { - "stringUnit": { - "state": "new", - "value": "Account Creation Process" + "lekaapp.connection_view.connection_button" : { + "comment" : "ConnectionView connection button", + "extractionState" : "extracted_with_value", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "new", + "value" : "Connect" } }, - "fr": { - "stringUnit": { - "state": "translated", - "value": "Processus de crĂ©ation de compte" + "fr" : { + "stringUnit" : { + "state" : "translated", + "value" : "Se connecter" } } } }, - "lekaapp.account_creation_view.create_account_title": { - "comment": "Create account title on SignupView", - "extractionState": "extracted_with_value", - "localizations": { - "en": { - "stringUnit": { - "state": "new", - "value": "Create an account" + "lekaapp.connection_view.password_forgotten_button" : { + "comment" : "ConnectionView password forgotten button", + "extractionState" : "extracted_with_value", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "new", + "value" : "[Forgot password?](https://leka.io)" } }, - "fr": { - "stringUnit": { - "state": "translated", - "value": "CrĂ©er un compte" + "fr" : { + "stringUnit" : { + "state" : "translated", + "value" : "[Mot de passe oubliĂ© ?](https://leka.io)" } } } }, - "lekaapp.account_creation_view.connection_button": { - "comment": "Connection button on SignupView", - "extractionState": "extracted_with_value", - "localizations": { - "en": { - "stringUnit": { - "state": "new", - "value": "Connection" + "lekaapp.connection_view.title" : { + "comment" : "ConnectionView title", + "extractionState" : "extracted_with_value", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "new", + "value" : "Account connection" } }, - "fr": { - "stringUnit": { - "state": "translated", - "value": "Connexion" + "fr" : { + "stringUnit" : { + "state" : "translated", + "value" : "Connexion au compte" } } } }, - "lekaapp.account_creation_process.step_4.title": { - "comment": "Step 4 title", - "extractionState": "extracted_with_value", - "localizations": { - "en": { - "stringUnit": { - "state": "new", - "value": "🎉 Congratulations! 👏" + "lekaapp.robot_connection_label.text_connected_to" : { + "comment" : "Connected to xxx robot label", + "extractionState" : "extracted_with_value", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "new", + "value" : "Connected to" } }, - "fr": { - "stringUnit": { - "state": "translated", - "value": "🎉 FĂ©licitations ! 👏" + "fr" : { + "stringUnit" : { + "state" : "translated", + "value" : "ConnectĂ© Ă " } } } }, - "lekaapp.account_creation_process.step_4.message": { - "comment": "Step 4 message", - "extractionState": "extracted_with_value", - "localizations": { - "en": { - "stringUnit": { - "state": "new", - "value": "You have completed process brilliantly:\n\n- Create your caregiver profile ✅\n- Create your first care receiver profile ✅\n\nYou can now discover the Leka App and dive deep in our educational content!" + "lekaapp.robot_connection_label.text_not_connected" : { + "comment" : "Connect to your Leka label", + "extractionState" : "extracted_with_value", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "new", + "value" : "Connect to your Leka" } }, - "fr": { - "stringUnit": { - "state": "translated", - "value": "Vous avez brillamment complĂ©tĂ© le processus :\n\n- CrĂ©er votre profil d'aidant ✅\n- CrĂ©er votre premier profil de bĂ©nĂ©ficiaire de soins ✅\n\nVous pouvez maintenant dĂ©couvrir l'appli Leka et approfondir notre contenu Ă©ducatif !" + "fr" : { + "stringUnit" : { + "state" : "translated", + "value" : "Connectez-vous Ă  votre Leka" } } } }, - "lekaapp.account_creation_process.step_4.discover_content_button": { - "comment": "Step 4 discover content button", - "extractionState": "extracted_with_value", - "localizations": { - "en": { - "stringUnit": { - "state": "new", - "value": "Let's go! 🚀" + "lekaapp.settings_label.title" : { + "comment" : "Settings button label", + "extractionState" : "extracted_with_value", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "new", + "value" : "Settings" } }, - "fr": { - "stringUnit": { - "state": "translated", - "value": "Allons-y ! 🚀" + "fr" : { + "stringUnit" : { + "state" : "translated", + "value" : "RĂ©glages" } } } }, - "lekaapp.account_creation_process.step_3.title": { - "comment": "Step 3 title", - "extractionState": "extracted_with_value", - "localizations": { - "en": { - "stringUnit": { - "state": "new", - "value": "Step 2 - Care receiver profile" + "lekaapp.TextFieldEmail.label" : { + "comment" : "TextFieldEmail label", + "extractionState" : "extracted_with_value", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "new", + "value" : "Email" } }, - "fr": { - "stringUnit": { - "state": "translated", - "value": "Étape 2 - Profil du bĂ©nĂ©ficiaire de soins" + "fr" : { + "stringUnit" : { + "state" : "translated", + "value" : "Email" } } } }, - "lekaapp.account_creation_process.step_3.message": { - "comment": "Step 3 message", - "extractionState": "extracted_with_value", - "localizations": { - "en": { - "stringUnit": { - "state": "new", - "value": "We will now create your first\ncare receiver profile." + "lekaapp.TextFieldPassword.label" : { + "comment" : "TextFieldPassword label", + "extractionState" : "extracted_with_value", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "new", + "value" : "Password" } }, - "fr": { - "stringUnit": { - "state": "translated", - "value": "Nous allons maintenant crĂ©er votre premier\nprofil de bĂ©nĂ©ficiaire de soins." + "fr" : { + "stringUnit" : { + "state" : "translated", + "value" : "Mot de passe" } } } }, - "lekaapp.account_creation_process.step_3.create_button": { - "comment": "Step 3 create button", - "extractionState": "extracted_with_value", - "localizations": { - "en": { - "stringUnit": { - "state": "new", - "value": "Create" + "lekaapp.welcome_view.create_account_button" : { + "comment" : "Create account button on WelcomeView", + "extractionState" : "extracted_with_value", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "new", + "value" : "Create account" } }, - "fr": { - "stringUnit": { - "state": "translated", - "value": "CrĂ©er" + "fr" : { + "stringUnit" : { + "state" : "translated", + "value" : "CrĂ©er un compte" } } } }, - "lekaapp.account_creation_process.step_2.title": { - "comment": "Step 2 title", - "extractionState": "extracted_with_value", - "localizations": { - "en": { - "stringUnit": { - "state": "new", - "value": "Step 1 - Caregiver profile" + "lekaapp.welcome_view.login_button" : { + "comment" : "Login button on WelcomeView", + "extractionState" : "extracted_with_value", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "new", + "value" : "Login" } }, - "fr": { - "stringUnit": { - "state": "translated", - "value": "Étape 1 - Profil de l'aidant" + "fr" : { + "stringUnit" : { + "state" : "translated", + "value" : "Se connecter" } } } }, - "lekaapp.account_creation_process.step_2.message": { - "comment": "Step 2 message", - "extractionState": "extracted_with_value", - "localizations": { - "en": { - "stringUnit": { - "state": "new", - "value": "First, let's create your profile as a caregiver." + "lekaapp.welcome_view.skip_step_button" : { + "comment" : "Skip step button on WelcomeView", + "extractionState" : "extracted_with_value", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "new", + "value" : "Skip this step" } }, - "fr": { - "stringUnit": { - "state": "translated", - "value": "Tout d'abord, crĂ©ons votre profil en tant qu'aidant." + "fr" : { + "stringUnit" : { + "state" : "translated", + "value" : "Passer cette Ă©tape" } } } }, - "lekaapp.account_creation_process.step_2.create_button": { - "comment": "Step 2 create button", - "extractionState": "extracted_with_value", - "localizations": { - "en": { - "stringUnit": { - "state": "new", - "value": "Create" + "main_view.sidebar.category_label.activities" : { + "comment" : "The title of the category 'Activities'", + "extractionState" : "extracted_with_value", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "new", + "value" : "Activities" } }, - "fr": { - "stringUnit": { - "state": "translated", - "value": "CrĂ©er" + "fr" : { + "stringUnit" : { + "state" : "translated", + "value" : "ActivitĂ©s" } } } }, - "lekaapp.account_creation_process.step_1.title": { - "comment": "Step 1 title", - "extractionState": "extracted_with_value", - "localizations": { - "en": { - "stringUnit": { - "state": "new", - "value": "Welcome to our account creation process! 👋" + "main_view.sidebar.category_label.curriculums" : { + "comment" : "The title of the category 'Curriculums'", + "extractionState" : "extracted_with_value", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "new", + "value" : "Curriculums" } }, - "fr": { - "stringUnit": { - "state": "translated", - "value": "Bienvenue dans notre processus de crĂ©ation de compte ! 👋" + "fr" : { + "stringUnit" : { + "state" : "translated", + "value" : "Parcours" } } } }, - "lekaapp.account_creation_process.step_1.message": { - "comment": "Step 1 message", - "extractionState": "extracted_with_value", - "localizations": { - "en": { - "stringUnit": { - "state": "new", - "value": "We will now guide you throught\nthe creation of your account\nand the different steps.\nReady?" + "main_view.sidebar.category_label.news" : { + "comment" : "The title of the category 'News'", + "extractionState" : "extracted_with_value", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "new", + "value" : "News" } }, - "fr": { - "stringUnit": { - "state": "translated", - "value": "Nous allons maintenant vous guider\nĂ  travers la crĂ©ation de votre compte\net les diffĂ©rentes Ă©tapes.\nPrĂȘt(e)?" + "fr" : { + "stringUnit" : { + "state" : "translated", + "value" : "NouveautĂ©s" } } } }, - "lekaapp.account_creation_process.step_1.go_button": { - "comment": "Step 1 continue button", - "extractionState": "extracted_with_value", - "localizations": { - "en": { - "stringUnit": { - "state": "new", - "value": "Let's start! 🏃" + "main_view.sidebar.category_label.remotes" : { + "comment" : "The title of the category 'Remotes'", + "extractionState" : "extracted_with_value", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "new", + "value" : "Remotes" } }, - "fr": { - "stringUnit": { - "state": "translated", - "value": "Commençons ! 🏃" + "fr" : { + "stringUnit" : { + "state" : "translated", + "value" : "TĂ©lĂ©commandes" } } } }, - "lekaapp.robot_connection_label.text_not_connected": { - "comment": "Connect to your Leka label", - "extractionState": "extracted_with_value", - "localizations": { - "en": { - "stringUnit": { - "state": "new", - "value": "Connect to your Leka" + "main_view.sidebar.category_label.resources" : { + "comment" : "The title of the category 'Resources'", + "extractionState" : "extracted_with_value", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "new", + "value" : "Resources" } }, - "fr": { - "stringUnit": { - "state": "translated", - "value": "Connectez-vous Ă  votre Leka" + "fr" : { + "stringUnit" : { + "state" : "translated", + "value" : "Ressources" } } } }, - "lekaapp.robot_connection_label.text_connected_to": { - "comment": "Connected to xxx robot label", - "extractionState": "extracted_with_value", - "localizations": { - "en": { - "stringUnit": { - "state": "new", - "value": "Connected to" + "main_view.sidebar.category_label.stories" : { + "comment" : "The title of the category 'Stories'", + "extractionState" : "extracted_with_value", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "new", + "value" : "Stories" } }, - "fr": { - "stringUnit": { - "state": "translated", - "value": "ConnectĂ© Ă " + "fr" : { + "stringUnit" : { + "state" : "translated", + "value" : "Histoires" } } } }, - "lekaapp.TextFieldPassword.label": { - "comment": "TextFieldPassword label", - "extractionState": "extracted_with_value", - "localizations": { - "en": { - "stringUnit": { - "state": "new", - "value": "Password" + "main_view.sidebar.navigation_title" : { + "comment" : "The title of the sidebar", + "extractionState" : "extracted_with_value", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "new", + "value" : "Leka App" } }, - "fr": { - "stringUnit": { - "state": "translated", - "value": "Mot de passe" + "fr" : { + "stringUnit" : { + "state" : "translated", + "value" : "Leka App" } } } }, - "lekaapp.TextFieldEmail.label": { - "comment": "TextFieldEmail label", - "extractionState": "extracted_with_value", - "localizations": { - "en": { - "stringUnit": { - "state": "new", - "value": "Email" + "main_view.sidebar.section.content" : { + "comment" : "The title of the section 'Content'", + "extractionState" : "extracted_with_value", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "new", + "value" : "Content" } }, - "fr": { - "stringUnit": { - "state": "translated", - "value": "Email" + "fr" : { + "stringUnit" : { + "state" : "translated", + "value" : "Contenu" + } + } + } + }, + "main_view.sidebar.section.information" : { + "comment" : "The title of the section 'Information'", + "extractionState" : "extracted_with_value", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "new", + "value" : "Information" + } + }, + "fr" : { + "stringUnit" : { + "state" : "translated", + "value" : "Informations" + } + } + } + }, + "settings_view.account_section.delete_account.alert_buton_label" : { + "comment" : "Delete account alert button label", + "extractionState" : "extracted_with_value", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "new", + "value" : "Delete" + } + }, + "fr" : { + "stringUnit" : { + "state" : "translated", + "value" : "Supprimer" + } + } + } + }, + "settings_view.account_section.delete_account.alert_message" : { + "comment" : "Delete account alert message", + "extractionState" : "extracted_with_value", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "new", + "value" : "You are about to delete your account and all its data.\nThis action is irreversible.\nDo you want to continue ?" + } + }, + "fr" : { + "stringUnit" : { + "state" : "translated", + "value" : "Vous ĂȘtes sur le point de supprimer votre compte et toutes les donnĂ©es qu'il contient.‹Cette action est irrĂ©versible.‹Voulez-vous continuer ?" + } + } + } + }, + "settings_view.account_section.delete_account.alert_title" : { + "comment" : "Delete account alert title", + "extractionState" : "extracted_with_value", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "new", + "value" : "Delete account" + } + }, + "fr" : { + "stringUnit" : { + "state" : "translated", + "value" : "Supprimer le compte" + } + } + } + }, + "settings_view.account_section.delete_account.button_label" : { + "comment" : "Delete account button label", + "extractionState" : "extracted_with_value", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "new", + "value" : "Delete account" + } + }, + "fr" : { + "stringUnit" : { + "state" : "translated", + "value" : "Supprimer le compte" + } + } + } + }, + "settings_view.account_section.log_out.alert_buton_label" : { + "comment" : "Log out alert button label", + "extractionState" : "extracted_with_value", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "new", + "value" : "Log out" + } + }, + "fr" : { + "stringUnit" : { + "state" : "translated", + "value" : "Se dĂ©connecter" + } + } + } + }, + "settings_view.account_section.log_out.alert_message" : { + "comment" : "Log out alert message", + "extractionState" : "extracted_with_value", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "new", + "value" : "You are about to log out." + } + }, + "fr" : { + "stringUnit" : { + "state" : "translated", + "value" : "Vous ĂȘtes sur le point de vous dĂ©connecter." + } + } + } + }, + "settings_view.account_section.log_out.alert_title" : { + "comment" : "Log out alert title", + "extractionState" : "extracted_with_value", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "new", + "value" : "Log out" + } + }, + "fr" : { + "stringUnit" : { + "state" : "translated", + "value" : "DĂ©connexion" + } + } + } + }, + "settings_view.account_section.log_out.button_label" : { + "comment" : "Log out button label", + "extractionState" : "extracted_with_value", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "new", + "value" : "Log out" + } + }, + "fr" : { + "stringUnit" : { + "state" : "translated", + "value" : "Se dĂ©connecter" + } + } + } + }, + "settings_view.appearance_section.accent_color_row.blue_label" : { + "comment" : "Label below blue accent color button in AccentColor Section", + "extractionState" : "stale", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "new", + "value" : "Blue" + } + }, + "fr" : { + "stringUnit" : { + "state" : "translated", + "value" : "Bleu" + } + } + } + }, + "settings_view.appearance_section.accent_color_row.gray_label" : { + "comment" : "Label below gray accent color button in AccentColor Section", + "extractionState" : "stale", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "new", + "value" : "Gray" + } + }, + "fr" : { + "stringUnit" : { + "state" : "translated", + "value" : "Gris" + } + } + } + }, + "settings_view.appearance_section.accent_color_row.green_label" : { + "comment" : "Label below green accent color button in AccentColor Section", + "extractionState" : "stale", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "new", + "value" : "Green" + } + }, + "fr" : { + "stringUnit" : { + "state" : "translated", + "value" : "Vert" + } + } + } + }, + "settings_view.appearance_section.accent_color_row.none_label" : { + "comment" : "Label below none accent color button in AccentColor Section", + "extractionState" : "stale", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "new", + "value" : "None" + } + }, + "fr" : { + "stringUnit" : { + "state" : "translated", + "value" : "Aucune" + } + } + } + }, + "settings_view.appearance_section.accent_color_row.orange_label" : { + "comment" : "Label below orange accent color button in AccentColor Section", + "extractionState" : "stale", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "new", + "value" : "Orange" + } + }, + "fr" : { + "stringUnit" : { + "state" : "translated", + "value" : "Orange" + } + } + } + }, + "settings_view.appearance_section.accent_color_row.purple_label" : { + "comment" : "Label below purple accent color button in AccentColor Section", + "extractionState" : "stale", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "new", + "value" : "Purple" + } + }, + "fr" : { + "stringUnit" : { + "state" : "translated", + "value" : "Violet" + } + } + } + }, + "settings_view.appearance_section.accent_color_row.red_label" : { + "comment" : "Label below red accent color button in AccentColor Section", + "extractionState" : "stale", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "new", + "value" : "Red" + } + }, + "fr" : { + "stringUnit" : { + "state" : "translated", + "value" : "Rouge" + } + } + } + }, + "settings_view.appearance_section.accent_color_row.title" : { + "comment" : "AccentColor Row title", + "extractionState" : "extracted_with_value", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "new", + "value" : "Accent Color" + } + }, + "fr" : { + "stringUnit" : { + "state" : "translated", + "value" : "Couleur accentuĂ©e" + } + } + } + }, + "settings_view.appearance_section.accent_color_row.yellow_label" : { + "comment" : "Label below yellow accent color button in AccentColor Section", + "extractionState" : "stale", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "new", + "value" : "Yellow" + } + }, + "fr" : { + "stringUnit" : { + "state" : "translated", + "value" : "Jaune" + } + } + } + }, + "settings_view.appearance_section.appearance_row.title" : { + "comment" : "Appearance Row title", + "extractionState" : "extracted_with_value", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "new", + "value" : "Dark mode" + } + }, + "fr" : { + "stringUnit" : { + "state" : "translated", + "value" : "Mode sombre" + } + } + } + }, + "settings_view.appearance_section.header" : { + "comment" : "Appearance section header", + "extractionState" : "extracted_with_value", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "new", + "value" : "Appearance" + } + }, + "fr" : { + "stringUnit" : { + "state" : "translated", + "value" : "Apparence" + } + } + } + }, + "settings_view.close_button_label" : { + "comment" : "Close button label of Settings View", + "extractionState" : "extracted_with_value", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "new", + "value" : "Close" + } + }, + "fr" : { + "stringUnit" : { + "state" : "translated", + "value" : "Fermer" + } + } + } + }, + "settings_view.credentials_section.change_credentials_button_label" : { + "comment" : "Change credentials button label", + "extractionState" : "extracted_with_value", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "new", + "value" : "[Change email and password](https://leka.io)" + } + }, + "fr" : { + "stringUnit" : { + "state" : "translated", + "value" : "[Modifier l'email et le mot de passe](https://leka.io)" + } + } + } + }, + "settings_view.credentials_section.email_label" : { + "comment" : "Account email address label", + "extractionState" : "extracted_with_value", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "new", + "value" : "Account email adress" + } + }, + "fr" : { + "stringUnit" : { + "state" : "translated", + "value" : "Adresse email du compte" + } + } + } + }, + "settings_view.credentials_section.header" : { + "comment" : "Credentials section header", + "extractionState" : "extracted_with_value", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "new", + "value" : "Credentials" + } + }, + "fr" : { + "stringUnit" : { + "state" : "translated", + "value" : "Identifiants" + } + } + } + }, + "settings_view.navigation_title" : { + "comment" : "The navigation title of Settings View", + "extractionState" : "extracted_with_value", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "new", + "value" : "Settings" + } + }, + "fr" : { + "stringUnit" : { + "state" : "translated", + "value" : "RĂ©glages" + } + } + } + }, + "settings_view.profiles_section.header" : { + "comment" : "Profiles section header", + "extractionState" : "stale", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "new", + "value" : "Profiles" + } + }, + "fr" : { + "stringUnit" : { + "state" : "translated", + "value" : "Profils" } } } } }, - "version": "1.0" + "version" : "1.0" } \ No newline at end of file diff --git a/Apps/LekaApp/Sources/_NEWCodeBase/Views/Settings/SettingsView+l10n.swift b/Apps/LekaApp/Sources/_NEWCodeBase/Views/Settings/SettingsView+l10n.swift new file mode 100644 index 0000000000..7d06107d07 --- /dev/null +++ b/Apps/LekaApp/Sources/_NEWCodeBase/Views/Settings/SettingsView+l10n.swift @@ -0,0 +1,65 @@ +// Leka - iOS Monorepo +// Copyright APF France handicap +// SPDX-License-Identifier: Apache-2.0 + +import LocalizationKit + +// swiftlint:disable line_length nesting + +extension l10n { + enum SettingsView { + enum AppearanceSection { + enum AppearanceRow { + static let title = LocalizedString("settings_view.appearance_section.appearance_row.title", value: "Dark mode", comment: "Appearance Row title") + } + + enum AccentColorRow { + static let title = LocalizedString("settings_view.appearance_section.accent_color_row.title", value: "Accent Color", comment: "AccentColor Row title") + } + + static let header = LocalizedString("settings_view.appearance_section.header", value: "Appearance", comment: "Appearance section header") + } + + enum CredentialsSection { + static let header = LocalizedString("settings_view.credentials_section.header", value: "Credentials", comment: "Credentials section header") + + static let emailLabel = LocalizedString("settings_view.credentials_section.email_label", value: "Account email adress", comment: "Account email address label") + + static let changeCredentialsButtonLabel = LocalizedString("settings_view.credentials_section.change_credentials_button_label", value: "[Change email and password](https://leka.io)", comment: "Change credentials button label") + } + + enum AccountSection { + enum LogOut { + static let buttonLabel = LocalizedString("settings_view.account_section.log_out.button_label", value: "Log out", comment: "Log out button label") + + static let alertTitle = LocalizedString("settings_view.account_section.log_out.alert_title", value: "Log out", comment: "Log out alert title") + + static let alertMessage = LocalizedString("settings_view.account_section.log_out.alert_message", value: "You are about to log out.", comment: "Log out alert message") + + static let alertButtonLabel = LocalizedString("settings_view.account_section.log_out.alert_buton_label", value: "Log out", comment: "Log out alert button label") + } + + enum DeleteAccount { + static let buttonLabel = LocalizedString("settings_view.account_section.delete_account.button_label", value: "Delete account", comment: "Delete account button label") + + static let alertTitle = LocalizedString("settings_view.account_section.delete_account.alert_title", value: "Delete account", comment: "Delete account alert title") + + static let alertMessage = LocalizedString("settings_view.account_section.delete_account.alert_message", + value: """ + You are about to delete your account and all its data. + This action is irreversible. + Do you want to continue ? + """, + comment: "Delete account alert message") + + static let alertButtonLabel = LocalizedString("settings_view.account_section.delete_account.alert_buton_label", value: "Delete", comment: "Delete account alert button label") + } + } + + static let navigationTitle = LocalizedString("settings_view.navigation_title", value: "Settings", comment: "The navigation title of Settings View") + + static let closeButtonLabel = LocalizedString("settings_view.close_button_label", value: "Close", comment: "Close button label of Settings View") + } +} + +// swiftlint:enable line_length nesting From ba9473a06702831b64d27dfb2c5349be69aca4c7 Mon Sep 17 00:00:00 2001 From: Hugo Pezziardi Date: Fri, 19 Jan 2024 17:09:38 +0100 Subject: [PATCH 4/8] :sparkles: (LekaApp): Add account related settings sections --- .../SettingsView+AccountSection.swift | 62 +++++++++++++++++++ .../SettingsView+CredentialsSection.swift | 36 +++++++++++ 2 files changed, 98 insertions(+) create mode 100644 Apps/LekaApp/Sources/_NEWCodeBase/Views/Settings/SettingsView+AccountSection.swift create mode 100644 Apps/LekaApp/Sources/_NEWCodeBase/Views/Settings/SettingsView+CredentialsSection.swift diff --git a/Apps/LekaApp/Sources/_NEWCodeBase/Views/Settings/SettingsView+AccountSection.swift b/Apps/LekaApp/Sources/_NEWCodeBase/Views/Settings/SettingsView+AccountSection.swift new file mode 100644 index 0000000000..d58f4a830f --- /dev/null +++ b/Apps/LekaApp/Sources/_NEWCodeBase/Views/Settings/SettingsView+AccountSection.swift @@ -0,0 +1,62 @@ +// Leka - iOS Monorepo +// Copyright APF France handicap +// SPDX-License-Identifier: Apache-2.0 + +import LocalizationKit +import SwiftUI + +// swiftlint:disable line_length + +// MARK: - SettingsView.AccountSection + +extension SettingsView { + struct AccountSection: View { + @ObservedObject var rootOwnerViewModel: RootOwnerViewModel = .shared + + var body: some View { + Section("") { + Group { + Button { + self.rootOwnerViewModel.showConfirmDisconnection.toggle() + } label: { + Text(l10n.SettingsView.AccountSection.LogOut.buttonLabel) + .foregroundColor(.accentColor) + } + + Button(role: .destructive) { + self.rootOwnerViewModel.showConfirmDeleteAccount.toggle() + } label: { + Text(l10n.SettingsView.AccountSection.DeleteAccount.buttonLabel) + } + } + } + .alert(String(l10n.SettingsView.AccountSection.LogOut.alertTitle.characters), isPresented: self.$rootOwnerViewModel.showConfirmDisconnection) { + Button(role: .destructive) { + self.rootOwnerViewModel.isSettingsViewPresented = false + self.rootOwnerViewModel.currentCompany = Company(email: "", password: "") + } label: { + Text(l10n.SettingsView.AccountSection.LogOut.alertButtonLabel) + } + } message: { + Text(l10n.SettingsView.AccountSection.LogOut.alertMessage) + } + .alert(String(l10n.SettingsView.AccountSection.DeleteAccount.alertTitle.characters), isPresented: self.$rootOwnerViewModel.showConfirmDeleteAccount) { + Button(role: .destructive) { + // TODO: (@team) - Replace w/ real implementation + self.rootOwnerViewModel.isSettingsViewPresented = false + self.rootOwnerViewModel.currentCompany = Company(email: "", password: "") + } label: { + Text(l10n.SettingsView.AccountSection.DeleteAccount.alertButtonLabel) + } + } message: { + Text(l10n.SettingsView.AccountSection.DeleteAccount.alertMessage) + } + } + } +} + +// swiftlint:enable line_length + +#Preview { + SettingsView.AccountSection() +} diff --git a/Apps/LekaApp/Sources/_NEWCodeBase/Views/Settings/SettingsView+CredentialsSection.swift b/Apps/LekaApp/Sources/_NEWCodeBase/Views/Settings/SettingsView+CredentialsSection.swift new file mode 100644 index 0000000000..85b1ec3c0a --- /dev/null +++ b/Apps/LekaApp/Sources/_NEWCodeBase/Views/Settings/SettingsView+CredentialsSection.swift @@ -0,0 +1,36 @@ +// Leka - iOS Monorepo +// Copyright APF France handicap +// SPDX-License-Identifier: Apache-2.0 + +import LocalizationKit +import SwiftUI + +// MARK: - SettingsView.CredentialsSection + +extension SettingsView { + struct CredentialsSection: View { + @ObservedObject var rootOwnerViewModel: RootOwnerViewModel = .shared + + var body: some View { + Section(String(l10n.SettingsView.CredentialsSection.header.characters)) { + LabeledContent { + Text(self.rootOwnerViewModel.currentCompany.email) + // TODO: (@ui/ux) - Design System - replace with Leka font + .font(.footnote) + .multilineTextAlignment(.leading) + } label: { + Text(l10n.SettingsView.CredentialsSection.emailLabel) + } + + Text(l10n.SettingsView.CredentialsSection.changeCredentialsButtonLabel) + .foregroundColor(.accentColor) + } + } + } +} + +#Preview { + Form { + SettingsView.CredentialsSection() + } +} From 64839aba0752d3aea6e53f0e68232002fc832e1e Mon Sep 17 00:00:00 2001 From: Hugo Pezziardi Date: Fri, 19 Jan 2024 17:11:39 +0100 Subject: [PATCH 5/8] :sparkles: (LekaApp): Add Appearance settings section --- ...iew+AppearanceSection+AccentColorRow.swift | 68 +++++++++++++++++++ ...View+AppearanceSection+AppearanceRow.swift | 42 ++++++++++++ .../SettingsView+AppearanceSection.swift | 26 +++++++ 3 files changed, 136 insertions(+) create mode 100644 Apps/LekaApp/Sources/_NEWCodeBase/Views/Settings/SettingsView+AppearanceSection+AccentColorRow.swift create mode 100644 Apps/LekaApp/Sources/_NEWCodeBase/Views/Settings/SettingsView+AppearanceSection+AppearanceRow.swift create mode 100644 Apps/LekaApp/Sources/_NEWCodeBase/Views/Settings/SettingsView+AppearanceSection.swift diff --git a/Apps/LekaApp/Sources/_NEWCodeBase/Views/Settings/SettingsView+AppearanceSection+AccentColorRow.swift b/Apps/LekaApp/Sources/_NEWCodeBase/Views/Settings/SettingsView+AppearanceSection+AccentColorRow.swift new file mode 100644 index 0000000000..f32e2602ad --- /dev/null +++ b/Apps/LekaApp/Sources/_NEWCodeBase/Views/Settings/SettingsView+AppearanceSection+AccentColorRow.swift @@ -0,0 +1,68 @@ +// Leka - iOS Monorepo +// Copyright APF France handicap +// SPDX-License-Identifier: Apache-2.0 + +import DesignKit +import LocalizationKit +import SwiftUI + +// swiftlint:disable nesting + +// MARK: - SettingsView.AppearanceSection.AccentColorRow + +extension SettingsView.AppearanceSection { + struct AccentColorRow: View { + // MARK: Internal + + // MARK: - ColorCircleView + + struct ColorCircleView: View { + let color: Color + let isSelected: Bool + + var body: some View { + VStack { + Circle() + .fill(self.color) + .frame(width: 25) + .overlay(Circle().fill(self.isSelected ? .white : .clear).frame(width: 8)) + .overlay(Circle().stroke(.gray, lineWidth: 0.5)) + } + .animation(.easeIn, value: self.isSelected) + } + } + + @ObservedObject var styleManager: StyleManager = .shared + + var body: some View { + HStack { + Text(l10n.SettingsView.AppearanceSection.AccentColorRow.title) + + Spacer() + + ForEach(self.colors, id: \.self) { color in + ColorCircleView(color: color, isSelected: self.selectedColor == color) + .onTapGesture { + self.styleManager.accentColor = color + } + } + } + } + + // MARK: Private + + private let colors: [Color] = [DesignKitAsset.Colors.lekaDarkBlue.swiftUIColor, .blue, .purple, .red, .orange, .yellow, .green, .gray] + + private var selectedColor: Color { + self.styleManager.accentColor ?? .clear + } + } +} + +// swiftlint:enable nesting + +#Preview { + Form { + SettingsView.AppearanceSection.AccentColorRow() + } +} diff --git a/Apps/LekaApp/Sources/_NEWCodeBase/Views/Settings/SettingsView+AppearanceSection+AppearanceRow.swift b/Apps/LekaApp/Sources/_NEWCodeBase/Views/Settings/SettingsView+AppearanceSection+AppearanceRow.swift new file mode 100644 index 0000000000..14c696ca26 --- /dev/null +++ b/Apps/LekaApp/Sources/_NEWCodeBase/Views/Settings/SettingsView+AppearanceSection+AppearanceRow.swift @@ -0,0 +1,42 @@ +// Leka - iOS Monorepo +// Copyright APF France handicap +// SPDX-License-Identifier: Apache-2.0 + +import DesignKit +import LocalizationKit +import SwiftUI + +// MARK: - SettingsView.AppearanceSection + +extension SettingsView.AppearanceSection { + struct AppearanceRow: View { + // MARK: Internal + + @ObservedObject var styleManager: StyleManager = .shared + + var body: some View { + HStack(spacing: 10) { + Text(l10n.SettingsView.AppearanceSection.AppearanceRow.title) + + Spacer() + + Toggle("", isOn: Binding( + get: { self.styleManager.colorScheme == .dark }, + set: { self.styleManager.colorScheme = $0 ? .dark : .light } + )) + } + } + + // MARK: Private + + private var selectedColorScheme: ColorScheme { + self.styleManager.colorScheme + } + } +} + +#Preview { + Form { + SettingsView.AppearanceSection() + } +} diff --git a/Apps/LekaApp/Sources/_NEWCodeBase/Views/Settings/SettingsView+AppearanceSection.swift b/Apps/LekaApp/Sources/_NEWCodeBase/Views/Settings/SettingsView+AppearanceSection.swift new file mode 100644 index 0000000000..e4ca0e28df --- /dev/null +++ b/Apps/LekaApp/Sources/_NEWCodeBase/Views/Settings/SettingsView+AppearanceSection.swift @@ -0,0 +1,26 @@ +// Leka - iOS Monorepo +// Copyright APF France handicap +// SPDX-License-Identifier: Apache-2.0 + +import DesignKit +import LocalizationKit +import SwiftUI + +// MARK: - SettingsView.AppearanceSection + +extension SettingsView { + struct AppearanceSection: View { + var body: some View { + Section(String(l10n.SettingsView.AppearanceSection.header.characters)) { + AppearanceRow() + AccentColorRow() + } + } + } +} + +#Preview { + Form { + SettingsView.AppearanceSection() + } +} From 44d261e37239756b5eb2d1cc59a6abe7a1f3e6d1 Mon Sep 17 00:00:00 2001 From: Hugo Pezziardi Date: Fri, 19 Jan 2024 17:12:14 +0100 Subject: [PATCH 6/8] :fire: (LekaApp): Remove appearance toggles in MianView --- .../_NEWCodeBase/Views/MainView/MainView.swift | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/Apps/LekaApp/Sources/_NEWCodeBase/Views/MainView/MainView.swift b/Apps/LekaApp/Sources/_NEWCodeBase/Views/MainView/MainView.swift index 18a7260204..333c2566e1 100644 --- a/Apps/LekaApp/Sources/_NEWCodeBase/Views/MainView/MainView.swift +++ b/Apps/LekaApp/Sources/_NEWCodeBase/Views/MainView/MainView.swift @@ -68,23 +68,6 @@ struct MainView: View { // .disabled(navigation.disableUICompletly) .navigationTitle(String(l10n.MainView.Sidebar.navigationTitle.characters)) .navigationBarTitleDisplayMode(.inline) - .toolbar { - ToolbarItem(placement: .topBarTrailing) { - Button { - self.styleManager.toggleAccentColor() - } label: { - Image(systemName: "eyedropper") - } - } - - ToolbarItem(placement: .topBarTrailing) { - Button { - self.styleManager.toggleColorScheme() - } label: { - Image(systemName: "circle.lefthalf.filled") - } - } - } } detail: { NavigationStack(path: self.$navigation.path) { switch self.navigation.selectedCategory { @@ -135,5 +118,4 @@ struct MainView: View { #Preview { MainView() .previewInterfaceOrientation(.landscapeLeft) - .environmentObject(StyleManager()) } From f7a8e96fcb54b8348375009d24d4bb943f868fd9 Mon Sep 17 00:00:00 2001 From: Hugo Pezziardi Date: Fri, 19 Jan 2024 17:13:14 +0100 Subject: [PATCH 7/8] :sparkles: (LekaApp): Add SettingsView --- .../Views/MainView/RootOwnerViewModel.swift | 4 ++ .../Views/Settings/SettingsView.swift | 40 +++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 Apps/LekaApp/Sources/_NEWCodeBase/Views/Settings/SettingsView.swift diff --git a/Apps/LekaApp/Sources/_NEWCodeBase/Views/MainView/RootOwnerViewModel.swift b/Apps/LekaApp/Sources/_NEWCodeBase/Views/MainView/RootOwnerViewModel.swift index ff4f0f04c7..ee178d8c44 100644 --- a/Apps/LekaApp/Sources/_NEWCodeBase/Views/MainView/RootOwnerViewModel.swift +++ b/Apps/LekaApp/Sources/_NEWCodeBase/Views/MainView/RootOwnerViewModel.swift @@ -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 diff --git a/Apps/LekaApp/Sources/_NEWCodeBase/Views/Settings/SettingsView.swift b/Apps/LekaApp/Sources/_NEWCodeBase/Views/Settings/SettingsView.swift new file mode 100644 index 0000000000..8c2a5cc67c --- /dev/null +++ b/Apps/LekaApp/Sources/_NEWCodeBase/Views/Settings/SettingsView.swift @@ -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() +} From 91e55783c93f043b97594cd199e20b01bc254466 Mon Sep 17 00:00:00 2001 From: Ladislas de Toldi Date: Wed, 24 Jan 2024 10:54:33 +0100 Subject: [PATCH 8/8] :children_crossing: (LekaApp): Use sheet to display settings view --- Apps/LekaApp/Sources/_NEWCodeBase/Views/MainView/MainView.swift | 2 +- .../Sources/_NEWCodeBase/Views/Settings/SettingsView.swift | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Apps/LekaApp/Sources/_NEWCodeBase/Views/MainView/MainView.swift b/Apps/LekaApp/Sources/_NEWCodeBase/Views/MainView/MainView.swift index 333c2566e1..fb67d14390 100644 --- a/Apps/LekaApp/Sources/_NEWCodeBase/Views/MainView/MainView.swift +++ b/Apps/LekaApp/Sources/_NEWCodeBase/Views/MainView/MainView.swift @@ -109,7 +109,7 @@ struct MainView: View { .fullScreenCover(isPresented: self.$viewModel.isRobotConnectionPresented) { RobotConnectionView(viewModel: RobotConnectionViewModel()) } - .fullScreenCover(isPresented: self.$rootOwnerViewModel.isSettingsViewPresented) { + .sheet(isPresented: self.$rootOwnerViewModel.isSettingsViewPresented) { SettingsView() } } diff --git a/Apps/LekaApp/Sources/_NEWCodeBase/Views/Settings/SettingsView.swift b/Apps/LekaApp/Sources/_NEWCodeBase/Views/Settings/SettingsView.swift index 8c2a5cc67c..4098d4dac7 100644 --- a/Apps/LekaApp/Sources/_NEWCodeBase/Views/Settings/SettingsView.swift +++ b/Apps/LekaApp/Sources/_NEWCodeBase/Views/Settings/SettingsView.swift @@ -23,6 +23,7 @@ struct SettingsView: View { } } .navigationTitle(String(l10n.SettingsView.navigationTitle.characters)) + .navigationBarTitleDisplayMode(.inline) .toolbar { ToolbarItem(placement: .topBarTrailing) { Button(String(l10n.SettingsView.closeButtonLabel.characters)) {