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

@@ -21,9 +21,13 @@ class AppDelegate: NSObject, UIApplicationDelegate {
UNUserNotificationCenter.current().delegate = self UNUserNotificationCenter.current().delegate = self
let theme = UserDefaultsStore.theme() let theme = UserDefaultsStore.theme()
UIPageControl.appearance().currentPageIndicatorTintColor = UIColor.label UIPageControl.appearance().currentPageIndicatorTintColor = UIColor(theme.currentTheme.labelColor)
UIPageControl.appearance().pageIndicatorTintColor = UIColor.systemGray UIPageControl.appearance().pageIndicatorTintColor = UIColor.systemGray
UITabBar.appearance().backgroundColor = UIColor(cgColor: theme.currentTheme.secondaryBGColor.cgColor ?? UIColor.secondarySystemBackground.cgColor)
let appearance = UITabBarAppearance()
appearance.configureWithOpaqueBackground()
UITabBar.appearance().standardAppearance = appearance
UITabBar.appearance().scrollEdgeAppearance = appearance
return true return true
} }

View File

@@ -79,9 +79,9 @@ final class DefaultMoodTint: MoodTintable {
case .great: case .great:
return Color(hex: "31d158") return Color(hex: "31d158")
case .missing: case .missing:
return Color(uiColor: UIColor.systemGray4) return Color(uiColor: UIColor.lightGray)
case .placeholder: case .placeholder:
return Color(uiColor: UIColor.systemGray4) return Color(uiColor: UIColor.lightGray)
} }
} }
@@ -98,9 +98,9 @@ final class DefaultMoodTint: MoodTintable {
case .great: case .great:
return Color(hex: "208939") return Color(hex: "208939")
case .missing: case .missing:
return Color(uiColor: UIColor.label) return Color(uiColor: UIColor.lightGray)
case .placeholder: case .placeholder:
return Color(uiColor: UIColor.label) return Color(uiColor: UIColor.lightGray)
} }
} }
} }
@@ -189,19 +189,19 @@ final class MonoChromeTint: MoodTintable {
static func color(forMood mood: Mood) -> Color { static func color(forMood mood: Mood) -> Color {
switch mood { switch mood {
case .horrible: case .horrible:
return .black return Color(hex: "#000000")
case .bad: case .bad:
return Color(uiColor: UIColor.systemGray) return Color(hex: "#47474a")
case .average: case .average:
return Color(uiColor: UIColor.systemGray) return Color(hex: "#7b7b81")
case .good: case .good:
return Color(uiColor: UIColor.systemGray2) return Color(hex: "#a3a3ab")
case .great: case .great:
return Color(uiColor: UIColor.systemGray3) return Color(hex: "#c2c1cb")
case .missing: case .missing:
return Color(uiColor: UIColor.systemGray2) return Color(hex: "#ff0000")
case .placeholder: case .placeholder:
return Color(uiColor: UIColor.systemGray4) return Color(hex: "#efeffb")
} }
} }

View File

@@ -85,7 +85,7 @@ extension ChartDataBuildable {
filledOutArray.append(view) filledOutArray.append(view)
} else { } else {
let thisDate = Calendar.current.date(bySetting: .day, value: day, of: month)! let thisDate = Calendar.current.date(bySetting: .day, value: day, of: month)!
let view = ChartType(color: Mood.missing.color, let view = ChartType(color: Mood.placeholder.color,
weekDay: Calendar.current.component(.weekday, from: thisDate), weekDay: Calendar.current.component(.weekday, from: thisDate),
viewType: .square) viewType: .square)
filledOutArray.append(view) filledOutArray.append(view)
@@ -93,7 +93,7 @@ extension ChartDataBuildable {
} }
for _ in filledOutArray.count...32 { for _ in filledOutArray.count...32 {
let view = ChartType(color: Mood.missing.color, let view = ChartType(color: Mood.placeholder.color,
weekDay: 2, weekDay: 2,
viewType: .cicle) viewType: .cicle)
filledOutArray.append(view) filledOutArray.append(view)

View File

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

View File

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

View File

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

View File

@@ -10,6 +10,10 @@ import SwiftUI
struct MainTabView: View { struct MainTabView: View {
@AppStorage(UserDefaultsStore.Keys.needsOnboarding.rawValue, store: GroupUserDefaults.groupDefaults) private var needsOnboarding = true @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 let onboardingData = OnboardingDataDataManager.shared.savedOnboardingData
var body: some View { var body: some View {
@@ -38,7 +42,9 @@ struct MainTabView: View {
.tabItem { .tabItem {
Label(String(localized: "content_view_tab_customize"), systemImage: "pencil") Label(String(localized: "content_view_tab_customize"), systemImage: "pencil")
} }
}.sheet(isPresented: $needsOnboarding, onDismiss: { }
.accentColor(moodTint.color(forMood: .average))
.sheet(isPresented: $needsOnboarding, onDismiss: {
}, content: { }, content: {
OnboardingMain(onboardingData: onboardingData, OnboardingMain(onboardingData: onboardingData,
@@ -47,6 +53,31 @@ struct MainTabView: View {
OnboardingDataDataManager.shared.updateOnboardingData(onboardingData: onboardingData) 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: { }, label: {
Text(String(localized: "settings_view_special_thanks_to_title")) Text(String(localized: "settings_view_special_thanks_to_title"))
.foregroundColor(theme.currentTheme.labelColor)
}) })
.padding() .padding()
if showSpecialThanks { if showSpecialThanks {
Text(String(localized: "settings_view_special_thanks_to_body")) Text(String(localized: "settings_view_special_thanks_to_body"))
.foregroundColor(theme.currentTheme.labelColor)
.padding() .padding()
} }
} }
@@ -105,6 +107,7 @@ struct SettingsView: View {
editedDataClosure() editedDataClosure()
}, label: { }, label: {
Text("Add test data") Text("Add test data")
.foregroundColor(theme.currentTheme.labelColor)
}) })
.padding() .padding()
} }
@@ -120,6 +123,7 @@ struct SettingsView: View {
editedDataClosure() editedDataClosure()
}, label: { }, label: {
Text("Clear DB") Text("Clear DB")
.foregroundColor(theme.currentTheme.labelColor)
}) })
.padding() .padding()
} }
@@ -137,10 +141,12 @@ struct SettingsView: View {
} }
}, label: { }, label: {
Text(String(localized: "settings_view_why_bg_mode_title")) Text(String(localized: "settings_view_why_bg_mode_title"))
.foregroundColor(theme.currentTheme.labelColor)
}) })
.padding() .padding()
if showWhyBGMode { if showWhyBGMode {
Text(String(localized: "settings_view_why_bg_mode_body")) Text(String(localized: "settings_view_why_bg_mode_body"))
.foregroundColor(theme.currentTheme.labelColor)
.padding() .padding()
} }
} }
@@ -160,6 +166,7 @@ struct SettingsView: View {
showOnboarding.toggle() showOnboarding.toggle()
}, label: { }, label: {
Text(String(localized: "settings_view_show_onboarding")) Text(String(localized: "settings_view_show_onboarding"))
.foregroundColor(theme.currentTheme.labelColor)
}) })
.padding() .padding()
} }
@@ -171,13 +178,13 @@ struct SettingsView: View {
ZStack { ZStack {
theme.currentTheme.secondaryBGColor theme.currentTheme.secondaryBGColor
VStack { VStack {
Toggle(String(localized: "settings_use_cloudkit_title"), Toggle(isOn: $useCloudKit, label: {
isOn: $useCloudKit) Text(String(localized: "settings_use_cloudkit_title"))
.onChange(of: useCloudKit) { value in .foregroundColor(theme.currentTheme.labelColor)
PersistenceController.shared.switchContainer() })
}
.padding() .padding()
Text(String(localized: "settings_use_cloudkit_body")) Text(String(localized: "settings_use_cloudkit_body"))
.foregroundColor(theme.currentTheme.labelColor)
} }
.padding(.bottom) .padding(.bottom)
} }
@@ -192,6 +199,7 @@ struct SettingsView: View {
Image(systemName: syncMonitor.syncStateSummary.symbolName) Image(systemName: syncMonitor.syncStateSummary.symbolName)
.foregroundColor(syncMonitor.syncStateSummary.symbolColor) .foregroundColor(syncMonitor.syncStateSummary.symbolColor)
Text( syncMonitor.syncStateSummary.isBroken ? "cloudkit is broken" : "cloudkit is good") Text( syncMonitor.syncStateSummary.isBroken ? "cloudkit is broken" : "cloudkit is good")
.foregroundColor(theme.currentTheme.labelColor)
} }
.padding() .padding()
} }
@@ -205,6 +213,7 @@ struct SettingsView: View {
VStack { VStack {
Toggle(String(localized: "settings_use_delete_enable"), Toggle(String(localized: "settings_use_delete_enable"),
isOn: $deleteEnabled) isOn: $deleteEnabled)
.foregroundColor(theme.currentTheme.labelColor)
.padding() .padding()
} }
} }

View File

@@ -118,7 +118,7 @@ struct SharingListView: View {
.frame(minWidth: 0, maxWidth: .infinity) .frame(minWidth: 0, maxWidth: .infinity)
.frame(height: 44) .frame(height: 44)
.background( .background(
Color(UIColor.secondarySystemBackground) theme.currentTheme.secondaryBGColor
) )
.opacity(0.9) .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, .sheet(isPresented: $selectedShare.showFuckingSheet,
onDismiss: didDismiss) { onDismiss: didDismiss) {
selectedShare.fuckingWrappedShrable?.destination selectedShare.fuckingWrappedShrable?.destination
} }
} }
} }