Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
GolnazCh committed Nov 15, 2023
2 parents 6af00ec + 1ccf935 commit 8e59433
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 5 deletions.
Binary file not shown.
3 changes: 3 additions & 0 deletions UpgradeUpsell/UpgradeUpsellApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import FirebaseFirestore
@main
struct UpgradeUpsellApp: App {
let authHelper = FireAuthController()
@StateObject private var themeManager = ThemeManager()

init() {
FirebaseApp.configure()
Expand All @@ -32,6 +33,8 @@ struct UpgradeUpsellApp: App {
)
.ignoresSafeArea()
)
.preferredColorScheme(themeManager.currentTheme)
.environmentObject(themeManager)
//.background(BackgroundView()) // Apply the gradient background
}
}
Expand Down
3 changes: 2 additions & 1 deletion UpgradeUpsell/Views/settings/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import SwiftUI
struct ContentView: View {
@EnvironmentObject var authHelper: FireAuthController
private var dbHelper = FirestoreController.getInstance()
@EnvironmentObject var themeManager : ThemeManager

@State private var root: RootView = .Login

Expand Down Expand Up @@ -47,7 +48,7 @@ struct ContentView: View {
//switch dbHelper.userProfile?.role
ChangePasswordView(rootScreen: $root).environmentObject(self.authHelper).environmentObject(self.dbHelper)
case .Settings:
SettingsView(rootScreen: $root ).environmentObject(self.authHelper).environmentObject(self.dbHelper)
SettingsView(rootScreen: $root ).environmentObject(self.authHelper).environmentObject(self.dbHelper).environmentObject(self.themeManager)
}
}
.padding()
Expand Down
16 changes: 12 additions & 4 deletions UpgradeUpsell/Views/settings/SettingsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import SwiftUI
struct SettingsView: View {
@EnvironmentObject var authHelper: FireAuthController
@EnvironmentObject var dbHelper: FirestoreController
@EnvironmentObject var themeManager: ThemeManager

//@Environment(\.presentationMode) var presentationMode
@State private var pushNotifFromUI = false
@State private var notificationsEmail = false
Expand All @@ -27,10 +29,16 @@ struct SettingsView: View {
VStack {
Form {
Section(header: Text("Preferences")) {
Picker("Theme", selection: $themeFromUI) {
Text("Light").tag("light")
Text("Dark").tag("dark")
}
// Picker("Theme", selection: $themeFromUI) {
// Text("Light").tag("light")
// Text("Dark").tag("dark")
// }

Toggle("Dark Mode", isOn: Binding(
get: { themeManager.selectedTheme == "dark" },
set: { _ in themeManager.toggleTheme() }
))
.padding()

Picker("Language", selection: $langFromUI) {
Text("English")//.tag("en_CA")
Expand Down

0 comments on commit 8e59433

Please sign in to comment.