-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🔀 Merge branch 'hugo/feature/Update-Settings'
- Loading branch information
Showing
14 changed files
with
1,294 additions
and
438 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
Apps/LekaApp/Sources/_NEWCodeBase/Views/MainView/SettingsLabel.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() | ||
} |
62 changes: 62 additions & 0 deletions
62
Apps/LekaApp/Sources/_NEWCodeBase/Views/Settings/SettingsView+AccountSection.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() | ||
} |
68 changes: 68 additions & 0 deletions
68
...p/Sources/_NEWCodeBase/Views/Settings/SettingsView+AppearanceSection+AccentColorRow.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
...pp/Sources/_NEWCodeBase/Views/Settings/SettingsView+AppearanceSection+AppearanceRow.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
Apps/LekaApp/Sources/_NEWCodeBase/Views/Settings/SettingsView+AppearanceSection.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
Apps/LekaApp/Sources/_NEWCodeBase/Views/Settings/SettingsView+CredentialsSection.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() | ||
} | ||
} |
Oops, something went wrong.