a lot of theme work

This commit is contained in:
Trey t
2022-02-23 00:39:20 -06:00
parent 520119de85
commit d88c4e7a05
9 changed files with 76 additions and 27 deletions

View File

@@ -139,7 +139,7 @@ struct FilterView: View {
.frame(minWidth: 0, maxWidth: .infinity, minHeight: 44, maxHeight: 44)
.cornerRadius(10)
.padding([.leading, .trailing])
.foregroundColor(theme.currentTheme.labelColor)
.colorScheme(.light)
ZStack {
theme.currentTheme.secondaryBGColor
@@ -156,6 +156,7 @@ struct FilterView: View {
.cornerRadius(10)
.padding([.leading, .trailing])
.foregroundColor(theme.currentTheme.labelColor)
.colorScheme(.light)
ZStack {
theme.currentTheme.secondaryBGColor

View File

@@ -318,6 +318,7 @@ extension HomeView {
.foregroundColor(theme.currentTheme.labelColor)
Text(" - ")
.padding([.leading, .trailing], -10)
.foregroundColor(theme.currentTheme.labelColor)
Text(Random.dayFormat(fromDate:entry.forDate!))
.font(.title3)
.foregroundColor(theme.currentTheme.labelColor)

View File

@@ -102,6 +102,7 @@ extension HomeViewTwo {
Text("Vote")
}
Text("dis top")
.foregroundColor(theme.currentTheme.secondaryBGColor)
}
}

View File

@@ -10,6 +10,10 @@ import SwiftUI
struct MainTabView: View {
@AppStorage(UserDefaultsStore.Keys.needsOnboarding.rawValue, store: GroupUserDefaults.groupDefaults) private var needsOnboarding = true
@AppStorage(UserDefaultsStore.Keys.theme.rawValue, store: GroupUserDefaults.groupDefaults) private var theme: Theme = .system
@AppStorage(UserDefaultsStore.Keys.moodTint.rawValue, store: GroupUserDefaults.groupDefaults) private var moodTint: MoodTints = .Default
let onboardingData = OnboardingDataDataManager.shared.savedOnboardingData
var body: some View {
@@ -38,7 +42,9 @@ struct MainTabView: View {
.tabItem {
Label(String(localized: "content_view_tab_customize"), systemImage: "pencil")
}
}.sheet(isPresented: $needsOnboarding, onDismiss: {
}
.accentColor(moodTint.color(forMood: .average))
.sheet(isPresented: $needsOnboarding, onDismiss: {
}, content: {
OnboardingMain(onboardingData: onboardingData,
@@ -47,6 +53,31 @@ struct MainTabView: View {
OnboardingDataDataManager.shared.updateOnboardingData(onboardingData: onboardingData)
})
})
.onAppear(perform: {
switch theme {
case .system:
UIApplication.shared.windows.first?.overrideUserInterfaceStyle = .unspecified
case .iFeel:
UIApplication.shared.windows.first?.overrideUserInterfaceStyle = .unspecified
case .dark:
UIApplication.shared.windows.first?.overrideUserInterfaceStyle = .dark
case .light:
UIApplication.shared.windows.first?.overrideUserInterfaceStyle = .light
}
})
.onChange(of: theme, perform: { value in
print("changed to ", value)
switch theme {
case .system:
UIApplication.shared.windows.first?.overrideUserInterfaceStyle = .unspecified
case .iFeel:
UIApplication.shared.windows.first?.overrideUserInterfaceStyle = .unspecified
case .dark:
UIApplication.shared.windows.first?.overrideUserInterfaceStyle = .dark
case .light:
UIApplication.shared.windows.first?.overrideUserInterfaceStyle = .light
}
})
}
}

View File

@@ -84,11 +84,13 @@ struct SettingsView: View {
}
}, label: {
Text(String(localized: "settings_view_special_thanks_to_title"))
.foregroundColor(theme.currentTheme.labelColor)
})
.padding()
if showSpecialThanks {
Text(String(localized: "settings_view_special_thanks_to_body"))
.foregroundColor(theme.currentTheme.labelColor)
.padding()
}
}
@@ -105,6 +107,7 @@ struct SettingsView: View {
editedDataClosure()
}, label: {
Text("Add test data")
.foregroundColor(theme.currentTheme.labelColor)
})
.padding()
}
@@ -120,6 +123,7 @@ struct SettingsView: View {
editedDataClosure()
}, label: {
Text("Clear DB")
.foregroundColor(theme.currentTheme.labelColor)
})
.padding()
}
@@ -137,10 +141,12 @@ struct SettingsView: View {
}
}, label: {
Text(String(localized: "settings_view_why_bg_mode_title"))
.foregroundColor(theme.currentTheme.labelColor)
})
.padding()
if showWhyBGMode {
Text(String(localized: "settings_view_why_bg_mode_body"))
.foregroundColor(theme.currentTheme.labelColor)
.padding()
}
}
@@ -160,6 +166,7 @@ struct SettingsView: View {
showOnboarding.toggle()
}, label: {
Text(String(localized: "settings_view_show_onboarding"))
.foregroundColor(theme.currentTheme.labelColor)
})
.padding()
}
@@ -171,13 +178,13 @@ struct SettingsView: View {
ZStack {
theme.currentTheme.secondaryBGColor
VStack {
Toggle(String(localized: "settings_use_cloudkit_title"),
isOn: $useCloudKit)
.onChange(of: useCloudKit) { value in
PersistenceController.shared.switchContainer()
}
Toggle(isOn: $useCloudKit, label: {
Text(String(localized: "settings_use_cloudkit_title"))
.foregroundColor(theme.currentTheme.labelColor)
})
.padding()
Text(String(localized: "settings_use_cloudkit_body"))
.foregroundColor(theme.currentTheme.labelColor)
}
.padding(.bottom)
}
@@ -192,6 +199,7 @@ struct SettingsView: View {
Image(systemName: syncMonitor.syncStateSummary.symbolName)
.foregroundColor(syncMonitor.syncStateSummary.symbolColor)
Text( syncMonitor.syncStateSummary.isBroken ? "cloudkit is broken" : "cloudkit is good")
.foregroundColor(theme.currentTheme.labelColor)
}
.padding()
}
@@ -205,6 +213,7 @@ struct SettingsView: View {
VStack {
Toggle(String(localized: "settings_use_delete_enable"),
isOn: $deleteEnabled)
.foregroundColor(theme.currentTheme.labelColor)
.padding()
}
}

View File

@@ -118,7 +118,7 @@ struct SharingListView: View {
.frame(minWidth: 0, maxWidth: .infinity)
.frame(height: 44)
.background(
Color(UIColor.secondarySystemBackground)
theme.currentTheme.secondaryBGColor
)
.opacity(0.9)
}
@@ -132,15 +132,17 @@ struct SharingListView: View {
})
}
}.background(
theme.currentTheme.bg
.edgesIgnoringSafeArea(.all)
)
}
}
.background(
theme.currentTheme.bg
.edgesIgnoringSafeArea(.top)
)
.sheet(isPresented: $selectedShare.showFuckingSheet,
onDismiss: didDismiss) {
selectedShare.fuckingWrappedShrable?.destination
}
}
}