customize text color
This commit is contained in:
@@ -13,6 +13,7 @@ import CoreData
|
||||
struct AddMoodHeaderView: View {
|
||||
@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
|
||||
@AppStorage(UserDefaultsStore.Keys.textColor.rawValue, store: GroupUserDefaults.groupDefaults) private var textColor: Color = .black
|
||||
|
||||
@State var onboardingData = OnboardingDataDataManager.shared.savedOnboardingData
|
||||
|
||||
@@ -29,7 +30,7 @@ struct AddMoodHeaderView: View {
|
||||
VStack {
|
||||
Text(ShowBasedOnVoteLogics.getVotingTitle(onboardingData: onboardingData))
|
||||
.font(.title)
|
||||
.foregroundColor(theme.currentTheme.labelColor)
|
||||
.foregroundColor(textColor)
|
||||
.padding()
|
||||
HStack{
|
||||
ForEach(Mood.allValues) { mood in
|
||||
|
||||
@@ -10,7 +10,8 @@ import SwiftUI
|
||||
struct CreateWidgetView: View {
|
||||
@AppStorage(UserDefaultsStore.Keys.theme.rawValue, store: GroupUserDefaults.groupDefaults) private var theme: Theme = .system
|
||||
@Environment(\.dismiss) var dismiss
|
||||
|
||||
@AppStorage(UserDefaultsStore.Keys.textColor.rawValue, store: GroupUserDefaults.groupDefaults) private var textColor: Color = .black
|
||||
|
||||
@StateObject private var customWidget: CustomWidgetModel
|
||||
|
||||
@State private var mouth: CustomWidgetMouthOptions = CustomWidgetMouthOptions.defaultOption
|
||||
@@ -115,7 +116,7 @@ struct CreateWidgetView: View {
|
||||
})
|
||||
}
|
||||
}
|
||||
.foregroundColor(theme.currentTheme.labelColor)
|
||||
.foregroundColor(textColor)
|
||||
}
|
||||
Spacer()
|
||||
VStack(alignment: .center) {
|
||||
@@ -128,7 +129,7 @@ struct CreateWidgetView: View {
|
||||
})
|
||||
}
|
||||
}
|
||||
.foregroundColor(theme.currentTheme.labelColor)
|
||||
.foregroundColor(textColor)
|
||||
}
|
||||
Spacer()
|
||||
VStack(alignment: .center) {
|
||||
@@ -141,7 +142,7 @@ struct CreateWidgetView: View {
|
||||
})
|
||||
}
|
||||
}
|
||||
.foregroundColor(theme.currentTheme.labelColor)
|
||||
.foregroundColor(textColor)
|
||||
}
|
||||
Spacer()
|
||||
}
|
||||
|
||||
@@ -18,6 +18,10 @@ struct CustomizeView: View {
|
||||
|
||||
@AppStorage(UserDefaultsStore.Keys.customMoodTintUpdateNumber.rawValue, store: GroupUserDefaults.groupDefaults) private var customMoodTintUpdateNumber: Int = 0
|
||||
|
||||
@AppStorage(UserDefaultsStore.Keys.textColor.rawValue, store: GroupUserDefaults.groupDefaults) private var textColor: Color = .black
|
||||
|
||||
@State private var sampleListEntry = PersistenceController.shared.randomEntries(count: 1).first!
|
||||
|
||||
@StateObject private var customMoodTint = UserDefaultsStore.getCustomMoodTint()
|
||||
|
||||
class StupidAssCustomWidgetObservableObject: ObservableObject {
|
||||
@@ -43,8 +47,14 @@ struct CustomizeView: View {
|
||||
createCustomWidget
|
||||
changeIcon
|
||||
themePicker
|
||||
Divider()
|
||||
sampleEntryView
|
||||
pickMoodImagePack
|
||||
pickMoodTintPack
|
||||
Group {
|
||||
pickMoodTintPack
|
||||
pickTextColor
|
||||
}
|
||||
Divider()
|
||||
pickPeronsalityPack
|
||||
}
|
||||
}
|
||||
@@ -316,6 +326,48 @@ struct CustomizeView: View {
|
||||
.cornerRadius(10, corners: [.topLeft, .topRight, .bottomLeft, .bottomRight])
|
||||
}
|
||||
|
||||
private var pickTextColor: some View {
|
||||
ZStack {
|
||||
theme.currentTheme.secondaryBGColor
|
||||
ColorPicker(String(localized: "customize_view_view_text_color"), selection: $textColor)
|
||||
.padding()
|
||||
.foregroundColor(textColor)
|
||||
}
|
||||
.fixedSize(horizontal: false, vertical: true)
|
||||
.cornerRadius(10, corners: [.topLeft, .topRight, .bottomLeft, .bottomRight])
|
||||
}
|
||||
|
||||
private var sampleEntryView: some View {
|
||||
ZStack {
|
||||
theme.currentTheme.secondaryBGColor
|
||||
|
||||
VStack {
|
||||
HStack {
|
||||
Spacer()
|
||||
Image(systemName: "arrow.triangle.2.circlepath.circle")
|
||||
.resizable()
|
||||
.frame(width: 20, height: 20, alignment: .trailing)
|
||||
.foregroundColor(Color(UIColor.systemGray))
|
||||
.onTapGesture {
|
||||
sampleListEntry = PersistenceController.shared.randomEntries(count: 1).first!
|
||||
}
|
||||
}
|
||||
Spacer()
|
||||
}.padding()
|
||||
|
||||
VStack(alignment:.leading) {
|
||||
Text(String(localized: "customize_view_view_example_row"))
|
||||
.padding([.leading, .top])
|
||||
.foregroundColor(textColor)
|
||||
Divider()
|
||||
EntryListView(entry: sampleListEntry)
|
||||
.padding()
|
||||
}
|
||||
}
|
||||
.fixedSize(horizontal: false, vertical: true)
|
||||
.cornerRadius(10, corners: [.topLeft, .topRight, .bottomLeft, .bottomRight])
|
||||
}
|
||||
|
||||
private func saveCustomMoodTint() {
|
||||
UserDefaultsStore.saveCustomMoodTint(customTint: customMoodTint)
|
||||
moodTint = .Custom
|
||||
@@ -330,7 +382,7 @@ struct CustomizeView: View {
|
||||
VStack(spacing: 10) {
|
||||
Text(String(aPack.title()))
|
||||
.font(.body)
|
||||
.foregroundColor(theme.currentTheme.labelColor)
|
||||
.foregroundColor(textColor)
|
||||
|
||||
Text(aPack.randomPushNotificationStrings().title)
|
||||
.font(.body)
|
||||
@@ -364,3 +416,14 @@ struct CustomizeView: View {
|
||||
.cornerRadius(10, corners: [.topLeft, .topRight, .bottomLeft, .bottomRight])
|
||||
}
|
||||
}
|
||||
|
||||
struct CustomizeView_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
Group {
|
||||
CustomizeView()
|
||||
|
||||
CustomizeView()
|
||||
.preferredColorScheme(.dark)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,8 @@ import SwiftUI
|
||||
|
||||
struct EmptyHomeView: View {
|
||||
@AppStorage(UserDefaultsStore.Keys.theme.rawValue, store: GroupUserDefaults.groupDefaults) private var theme: Theme = .system
|
||||
|
||||
@AppStorage(UserDefaultsStore.Keys.textColor.rawValue, store: GroupUserDefaults.groupDefaults) private var textColor: Color = .black
|
||||
|
||||
let viewModel: HomeViewViewModel
|
||||
|
||||
var body: some View {
|
||||
@@ -19,12 +20,12 @@ struct EmptyHomeView: View {
|
||||
VStack {
|
||||
Text(String(localized: "content_view_empty_title"))
|
||||
.font(.title)
|
||||
.foregroundColor(theme.currentTheme.labelColor)
|
||||
.foregroundColor(textColor)
|
||||
.padding()
|
||||
|
||||
Text(String(localized: "content_view_empty_title"))
|
||||
.font(.body)
|
||||
.foregroundColor(theme.currentTheme.labelColor)
|
||||
.foregroundColor(textColor)
|
||||
.padding()
|
||||
AddMoodHeaderView(addItemHeaderClosure: { (mood, date) in
|
||||
withAnimation {
|
||||
|
||||
56
Shared/views/EntryListView.swift
Normal file
56
Shared/views/EntryListView.swift
Normal file
@@ -0,0 +1,56 @@
|
||||
//
|
||||
// EntryListView.swift
|
||||
// Feels (iOS)
|
||||
//
|
||||
// Created by Trey Tartt on 3/6/22.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct EntryListView: View {
|
||||
@AppStorage(UserDefaultsStore.Keys.moodImages.rawValue, store: GroupUserDefaults.groupDefaults) private var imagePack: MoodImages = .FontAwesome
|
||||
@AppStorage(UserDefaultsStore.Keys.moodTint.rawValue, store: GroupUserDefaults.groupDefaults) private var moodTint: MoodTints = .Default
|
||||
@AppStorage(UserDefaultsStore.Keys.textColor.rawValue, store: GroupUserDefaults.groupDefaults) private var textColor: Color = .black
|
||||
|
||||
public let entry: MoodEntry
|
||||
|
||||
var body: some View {
|
||||
HStack {
|
||||
imagePack.icon(forMood: entry.mood)
|
||||
.resizable()
|
||||
.aspectRatio(contentMode: .fit)
|
||||
.frame(width: 40, height: 40, alignment: .center)
|
||||
.foregroundColor(moodTint.color(forMood: entry.mood))
|
||||
.padding(.leading, 5)
|
||||
|
||||
VStack {
|
||||
HStack {
|
||||
Text(Random.weekdayName(fromDate:entry.forDate!))
|
||||
.font(.title3)
|
||||
.foregroundColor(textColor)
|
||||
Text(" - ")
|
||||
.padding([.leading, .trailing], -10)
|
||||
.foregroundColor(textColor)
|
||||
Text(Random.dayFormat(fromDate:entry.forDate!))
|
||||
.font(.title3)
|
||||
.foregroundColor(textColor)
|
||||
Spacer()
|
||||
}
|
||||
.multilineTextAlignment(.leading)
|
||||
|
||||
Text(entry.moodValue == Mood.missing.rawValue ? String(localized: "mood_value_missing_tap_to_add") : "\(entry.moodString)")
|
||||
.font(.body)
|
||||
.foregroundColor(Color(UIColor.systemGray))
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct EntryListView_Previews: PreviewProvider {
|
||||
static let fakeData = PersistenceController.shared.randomEntries(count: 1).first!
|
||||
|
||||
static var previews: some View {
|
||||
EntryListView(entry: EntryListView_Previews.fakeData)
|
||||
}
|
||||
}
|
||||
@@ -22,6 +22,7 @@ struct FilterView: View {
|
||||
|
||||
@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
|
||||
@AppStorage(UserDefaultsStore.Keys.textColor.rawValue, store: GroupUserDefaults.groupDefaults) private var textColor: Color = .black
|
||||
|
||||
@StateObject private var viewModel = FilterViewModel()
|
||||
//[
|
||||
@@ -55,7 +56,7 @@ struct FilterView: View {
|
||||
|
||||
Text(String(localized: "filter_view_total") + ": \(self.viewModel.numberOfRatings)")
|
||||
.font(.title2)
|
||||
.foregroundColor(theme.currentTheme.labelColor)
|
||||
.foregroundColor(textColor)
|
||||
|
||||
if showFilter {
|
||||
filterView
|
||||
@@ -82,7 +83,7 @@ struct FilterView: View {
|
||||
Text(showFilter ? String(localized: "filter_view_hide_filters") : String(localized: "filter_view_show_filters"))
|
||||
.frame(maxWidth: .infinity)
|
||||
.frame(height: 44)
|
||||
.foregroundColor(theme.currentTheme.labelColor)
|
||||
.foregroundColor(textColor)
|
||||
.background(theme.currentTheme.secondaryBGColor)
|
||||
.cornerRadius(10)
|
||||
}).frame(maxWidth: .infinity)
|
||||
@@ -91,7 +92,8 @@ struct FilterView: View {
|
||||
struct StatsSubView: View {
|
||||
@AppStorage(UserDefaultsStore.Keys.moodTint.rawValue, store: GroupUserDefaults.groupDefaults) private var moodTint: MoodTints = .Default
|
||||
@AppStorage(UserDefaultsStore.Keys.theme.rawValue, store: GroupUserDefaults.groupDefaults) private var theme: Theme = .system
|
||||
|
||||
@AppStorage(UserDefaultsStore.Keys.textColor.rawValue, store: GroupUserDefaults.groupDefaults) private var textColor: Color = .black
|
||||
|
||||
let data: [MoodEntry]
|
||||
let mood: Mood
|
||||
|
||||
@@ -100,7 +102,7 @@ struct FilterView: View {
|
||||
Text(String(Stats.getCountFor(moodType: mood,
|
||||
inData: data)))
|
||||
.font(.title)
|
||||
.foregroundColor(theme.currentTheme.labelColor)
|
||||
.foregroundColor(textColor)
|
||||
Text(mood.strValue)
|
||||
.foregroundColor(moodTint.color(forMood: mood))
|
||||
}
|
||||
@@ -139,8 +141,8 @@ struct FilterView: View {
|
||||
.frame(minWidth: 0, maxWidth: .infinity, minHeight: 44, maxHeight: 44)
|
||||
.cornerRadius(10)
|
||||
.padding([.leading, .trailing])
|
||||
.foregroundColor(theme.currentTheme.labelColor)
|
||||
.accentColor(theme.currentTheme.labelColor)
|
||||
.foregroundColor(textColor)
|
||||
.accentColor(textColor)
|
||||
|
||||
ZStack {
|
||||
theme.currentTheme.secondaryBGColor
|
||||
@@ -156,8 +158,8 @@ struct FilterView: View {
|
||||
.frame(minWidth: 0, maxWidth: .infinity, minHeight: 44, maxHeight: 44)
|
||||
.cornerRadius(10)
|
||||
.padding([.leading, .trailing])
|
||||
.foregroundColor(theme.currentTheme.labelColor)
|
||||
.accentColor(theme.currentTheme.labelColor)
|
||||
.foregroundColor(textColor)
|
||||
.accentColor(textColor)
|
||||
|
||||
ZStack {
|
||||
theme.currentTheme.secondaryBGColor
|
||||
@@ -196,7 +198,7 @@ struct FilterView: View {
|
||||
ForEach(months, id: \.self.0) { item in
|
||||
Text(item.1)
|
||||
.textCase(.uppercase)
|
||||
.foregroundColor(theme.currentTheme.labelColor)
|
||||
.foregroundColor(textColor)
|
||||
}
|
||||
}.padding([.leading, .trailing, .top])
|
||||
}
|
||||
@@ -213,7 +215,7 @@ struct FilterView: View {
|
||||
let yearData = self.viewModel.data[yearKey]!
|
||||
Text(String(yearKey))
|
||||
.font(.title)
|
||||
.foregroundColor(theme.currentTheme.labelColor)
|
||||
.foregroundColor(textColor)
|
||||
yearGridView(yearData: yearData, columns: columns)
|
||||
.background(
|
||||
theme.currentTheme.secondaryBGColor
|
||||
|
||||
@@ -12,11 +12,13 @@ struct HeaderStatsView : UIViewRepresentable {
|
||||
//Bar chart accepts data as array of BarChartDataEntry objects
|
||||
var entries : [BarChartDataEntry]
|
||||
var moodTints: [Color]
|
||||
var textColor: Color
|
||||
|
||||
var tmpHolderToMakeViewDiffefrent: Color
|
||||
|
||||
init(fakeData: Bool, backDays: Int, moodTint: [Color]) {
|
||||
init(fakeData: Bool, backDays: Int, moodTint: [Color], textColor: Color) {
|
||||
self.moodTints = moodTint
|
||||
self.textColor = textColor
|
||||
guard moodTints.count == 5 else {
|
||||
fatalError("mood tint count dont match")
|
||||
}
|
||||
@@ -105,8 +107,8 @@ struct HeaderStatsView : UIViewRepresentable {
|
||||
|
||||
// change bars color to green
|
||||
dataSet.colors = moodTints.map({ NSUIColor( $0 ) })
|
||||
dataSet.secondaryTextColor = UIColor.systemGray
|
||||
dataSet.valueColors = [.white]
|
||||
dataSet.secondaryTextColor = UIColor(textColor)
|
||||
dataSet.valueColors = [UIColor(textColor)]
|
||||
dataSet.highlightAlpha = 0.0
|
||||
dataSet.roundedCornerValue = 10
|
||||
|
||||
@@ -128,6 +130,6 @@ struct HeaderStatsView : UIViewRepresentable {
|
||||
|
||||
struct HeaderStatsView_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
HeaderStatsView(fakeData: true, backDays: 30, moodTint: [Color.green, Color.blue, Color.yellow, Color.red, Color.orange]).frame(minHeight: 85, maxHeight: 90)
|
||||
HeaderStatsView(fakeData: true, backDays: 30, moodTint: [Color.green, Color.blue, Color.yellow, Color.red, Color.orange], textColor: .white).frame(minHeight: 85, maxHeight: 90)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ struct HomeView: View {
|
||||
|
||||
@AppStorage(UserDefaultsStore.Keys.moodImages.rawValue, store: GroupUserDefaults.groupDefaults) private var imagePack: MoodImages = .FontAwesome
|
||||
@AppStorage(UserDefaultsStore.Keys.moodTint.rawValue, store: GroupUserDefaults.groupDefaults) private var moodTint: MoodTints = .Default
|
||||
@AppStorage(UserDefaultsStore.Keys.textColor.rawValue, store: GroupUserDefaults.groupDefaults) private var textColor: Color = .black
|
||||
|
||||
// store a value that gets changed when user updates custom colors to update the view since the moodTint doesn't change
|
||||
@AppStorage(UserDefaultsStore.Keys.customMoodTintUpdateNumber.rawValue, store: GroupUserDefaults.groupDefaults) private var customMoodTintUpdateNumber: Int = 0
|
||||
@@ -280,7 +281,7 @@ extension HomeView {
|
||||
private func SectionHeaderView(month: Int, year: Int) -> some View {
|
||||
Text("\(Random.monthName(fromMonthInt: month)) \(String(year))")
|
||||
.font(.title)
|
||||
.foregroundColor(theme.currentTheme.labelColor)
|
||||
.foregroundColor(textColor)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.padding()
|
||||
.background(
|
||||
@@ -294,7 +295,7 @@ extension HomeView {
|
||||
ForEach(entries.sorted(by: {
|
||||
return $0.forDate! > $1.forDate!
|
||||
}), id: \.self) { entry in
|
||||
entryListView(entry: entry)
|
||||
EntryListView(entry: entry)
|
||||
.contentShape(Rectangle())
|
||||
.onTapGesture(perform: {
|
||||
selectedEntry = entry
|
||||
@@ -303,38 +304,6 @@ extension HomeView {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private func entryListView(entry: MoodEntry) -> some View {
|
||||
HStack {
|
||||
imagePack.icon(forMood: entry.mood)
|
||||
.resizable()
|
||||
.aspectRatio(contentMode: .fit)
|
||||
.frame(width: 40, height: 40, alignment: .center)
|
||||
.foregroundColor(moodTint.color(forMood: entry.mood))
|
||||
.padding(.leading, 5)
|
||||
|
||||
VStack {
|
||||
HStack {
|
||||
Text(Random.weekdayName(fromDate:entry.forDate!))
|
||||
.font(.title3)
|
||||
.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)
|
||||
Spacer()
|
||||
}
|
||||
.multilineTextAlignment(.leading)
|
||||
|
||||
Text(entry.moodValue == Mood.missing.rawValue ? String(localized: "mood_value_missing_tap_to_add") : "\(entry.moodString)")
|
||||
.font(.body)
|
||||
.foregroundColor(Color(UIColor.systemGray))
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct ViewOffsetKey: PreferenceKey {
|
||||
|
||||
@@ -11,6 +11,7 @@ struct MonthDetailView: View {
|
||||
@AppStorage(UserDefaultsStore.Keys.theme.rawValue, store: GroupUserDefaults.groupDefaults) private var theme: Theme = .system
|
||||
@AppStorage(UserDefaultsStore.Keys.deleteEnable.rawValue, store: GroupUserDefaults.groupDefaults) private var deleteEnabled = true
|
||||
@AppStorage(UserDefaultsStore.Keys.moodTint.rawValue, store: GroupUserDefaults.groupDefaults) private var moodTint: MoodTints = .Default
|
||||
@AppStorage(UserDefaultsStore.Keys.textColor.rawValue, store: GroupUserDefaults.groupDefaults) private var textColor: Color = .black
|
||||
|
||||
@State private var showingSheet = false
|
||||
@State private var selectedEntry: MoodEntry?
|
||||
@@ -36,7 +37,7 @@ struct MonthDetailView: View {
|
||||
VStack {
|
||||
Text("\(Random.monthName(fromMonthInt: monthInt)) \(String(yearInt))")
|
||||
.font(.title)
|
||||
.foregroundColor(theme.currentTheme.labelColor)
|
||||
.foregroundColor(textColor)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.padding()
|
||||
.background(
|
||||
@@ -112,7 +113,7 @@ struct MonthDetailView: View {
|
||||
Text(entry.forDate!,
|
||||
format: Date.FormatStyle().day())
|
||||
.font(.title3)
|
||||
.foregroundColor(theme.currentTheme.labelColor)
|
||||
.foregroundColor(textColor)
|
||||
}
|
||||
|
||||
if entry.mood == .placeholder {
|
||||
|
||||
@@ -13,7 +13,8 @@ struct MonthView: View {
|
||||
@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
|
||||
|
||||
@AppStorage(UserDefaultsStore.Keys.textColor.rawValue, store: GroupUserDefaults.groupDefaults) private var textColor: Color = .black
|
||||
|
||||
// store a value that gets changed when user updates custom colors to update the view since the moodTint doesn't change
|
||||
@AppStorage(UserDefaultsStore.Keys.customMoodTintUpdateNumber.rawValue, store: GroupUserDefaults.groupDefaults) private var customMoodTintUpdateNumber: Int = 0
|
||||
|
||||
@@ -127,7 +128,7 @@ extension MonthView {
|
||||
ZStack {
|
||||
Text("\(Random.monthName(fromMonthInt: month)) \(String(year))")
|
||||
.font(.body)
|
||||
.foregroundColor(theme.currentTheme.labelColor)
|
||||
.foregroundColor(textColor)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
Text(String(customMoodTintUpdateNumber))
|
||||
.hidden()
|
||||
|
||||
@@ -20,7 +20,8 @@ struct SettingsView: View {
|
||||
@AppStorage(UserDefaultsStore.Keys.useCloudKit.rawValue, store: GroupUserDefaults.groupDefaults) private var useCloudKit = false
|
||||
@AppStorage(UserDefaultsStore.Keys.deleteEnable.rawValue, store: GroupUserDefaults.groupDefaults) private var deleteEnabled = true
|
||||
@AppStorage(UserDefaultsStore.Keys.theme.rawValue, store: GroupUserDefaults.groupDefaults) private var theme: Theme = .system
|
||||
|
||||
@AppStorage(UserDefaultsStore.Keys.textColor.rawValue, store: GroupUserDefaults.groupDefaults) private var textColor: Color = .black
|
||||
|
||||
var body: some View {
|
||||
ScrollView {
|
||||
VStack {
|
||||
@@ -86,13 +87,13 @@ struct SettingsView: View {
|
||||
}
|
||||
}, label: {
|
||||
Text(String(localized: "settings_view_special_thanks_to_title"))
|
||||
.foregroundColor(theme.currentTheme.labelColor)
|
||||
.foregroundColor(textColor)
|
||||
})
|
||||
.padding()
|
||||
|
||||
if showSpecialThanks {
|
||||
Text(String(localized: "settings_view_special_thanks_to_body"))
|
||||
.foregroundColor(theme.currentTheme.labelColor)
|
||||
.foregroundColor(textColor)
|
||||
.padding()
|
||||
}
|
||||
}
|
||||
@@ -108,7 +109,7 @@ struct SettingsView: View {
|
||||
PersistenceController.shared.populateTestData()
|
||||
}, label: {
|
||||
Text("Add test data")
|
||||
.foregroundColor(theme.currentTheme.labelColor)
|
||||
.foregroundColor(textColor)
|
||||
})
|
||||
.padding()
|
||||
}
|
||||
@@ -123,7 +124,7 @@ struct SettingsView: View {
|
||||
PersistenceController.shared.clearDB()
|
||||
}, label: {
|
||||
Text("Clear DB")
|
||||
.foregroundColor(theme.currentTheme.labelColor)
|
||||
.foregroundColor(textColor)
|
||||
})
|
||||
.padding()
|
||||
}
|
||||
@@ -141,12 +142,12 @@ struct SettingsView: View {
|
||||
}
|
||||
}, label: {
|
||||
Text(String(localized: "settings_view_why_bg_mode_title"))
|
||||
.foregroundColor(theme.currentTheme.labelColor)
|
||||
.foregroundColor(textColor)
|
||||
})
|
||||
.padding()
|
||||
if showWhyBGMode {
|
||||
Text(String(localized: "settings_view_why_bg_mode_body"))
|
||||
.foregroundColor(theme.currentTheme.labelColor)
|
||||
.foregroundColor(textColor)
|
||||
.padding()
|
||||
}
|
||||
}
|
||||
@@ -166,7 +167,7 @@ struct SettingsView: View {
|
||||
showOnboarding.toggle()
|
||||
}, label: {
|
||||
Text(String(localized: "settings_view_show_onboarding"))
|
||||
.foregroundColor(theme.currentTheme.labelColor)
|
||||
.foregroundColor(textColor)
|
||||
})
|
||||
.padding()
|
||||
}
|
||||
@@ -180,11 +181,11 @@ struct SettingsView: View {
|
||||
VStack {
|
||||
Toggle(isOn: $useCloudKit, label: {
|
||||
Text(String(localized: "settings_use_cloudkit_title"))
|
||||
.foregroundColor(theme.currentTheme.labelColor)
|
||||
.foregroundColor(textColor)
|
||||
})
|
||||
.padding()
|
||||
Text(String(localized: "settings_use_cloudkit_body"))
|
||||
.foregroundColor(theme.currentTheme.labelColor)
|
||||
.foregroundColor(textColor)
|
||||
}
|
||||
.padding(.bottom)
|
||||
}
|
||||
@@ -199,7 +200,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)
|
||||
.foregroundColor(textColor)
|
||||
}
|
||||
.padding()
|
||||
}
|
||||
@@ -213,7 +214,7 @@ struct SettingsView: View {
|
||||
VStack {
|
||||
Toggle(String(localized: "settings_use_delete_enable"),
|
||||
isOn: $deleteEnabled)
|
||||
.foregroundColor(theme.currentTheme.labelColor)
|
||||
.foregroundColor(textColor)
|
||||
.padding()
|
||||
}
|
||||
}
|
||||
@@ -344,7 +345,7 @@ struct SettingsView: View {
|
||||
|
||||
}, label: {
|
||||
Text("Create random icons")
|
||||
.foregroundColor(theme.currentTheme.labelColor)
|
||||
.foregroundColor(textColor)
|
||||
})
|
||||
.padding()
|
||||
}
|
||||
|
||||
@@ -24,7 +24,8 @@ struct WrappedSharable: Hashable, Equatable {
|
||||
|
||||
struct SharingListView: View {
|
||||
@AppStorage(UserDefaultsStore.Keys.theme.rawValue, store: GroupUserDefaults.groupDefaults) private var theme: Theme = .system
|
||||
|
||||
@AppStorage(UserDefaultsStore.Keys.textColor.rawValue, store: GroupUserDefaults.groupDefaults) private var textColor: Color = .black
|
||||
|
||||
class StupidAssObservableObject: ObservableObject {
|
||||
@Published var fuckingWrappedShrable: WrappedSharable? = nil
|
||||
@Published var showFuckingSheet = false
|
||||
@@ -111,7 +112,7 @@ struct SharingListView: View {
|
||||
Spacer()
|
||||
Text(item.description)
|
||||
.font(.title)
|
||||
.foregroundColor(theme.currentTheme.labelColor)
|
||||
.foregroundColor(textColor)
|
||||
.fontWeight(.bold)
|
||||
.frame(minWidth: 0, maxWidth: .infinity)
|
||||
.frame(height: 44)
|
||||
|
||||
@@ -20,7 +20,8 @@ struct AllMoodsTotalTemplate: View, SharingTemplate {
|
||||
@Environment(\.presentationMode) var presentationMode
|
||||
@AppStorage(UserDefaultsStore.Keys.moodTint.rawValue, store: GroupUserDefaults.groupDefaults) private var moodTint: MoodTints = .Default
|
||||
@AppStorage(UserDefaultsStore.Keys.theme.rawValue, store: GroupUserDefaults.groupDefaults) private var theme: Theme = .system
|
||||
|
||||
@AppStorage(UserDefaultsStore.Keys.textColor.rawValue, store: GroupUserDefaults.groupDefaults) private var textColor: Color = .black
|
||||
|
||||
@StateObject private var shareImage = StupidAssShareObservableObject()
|
||||
private var entries = [MoodMetrics]()
|
||||
init(isPreview: Bool, startDate: Date, endDate: Date, fakeData: Bool) {
|
||||
@@ -126,7 +127,7 @@ struct AllMoodsTotalTemplate: View, SharingTemplate {
|
||||
VStack {
|
||||
Text(String(format: String(localized: "share_view_all_moods_total_template_title"), totalEntryCount))
|
||||
.font(.title)
|
||||
.foregroundColor(theme.currentTheme.labelColor)
|
||||
.foregroundColor(textColor)
|
||||
.frame(maxWidth: .infinity, alignment: .center)
|
||||
.padding()
|
||||
|
||||
|
||||
@@ -23,7 +23,8 @@ struct CurrentStreakTemplate: View, SharingTemplate {
|
||||
@Environment(\.presentationMode) var presentationMode
|
||||
@AppStorage(UserDefaultsStore.Keys.moodTint.rawValue, store: GroupUserDefaults.groupDefaults) private var moodTint: MoodTints = .Default
|
||||
@AppStorage(UserDefaultsStore.Keys.theme.rawValue, store: GroupUserDefaults.groupDefaults) private var theme: Theme = .system
|
||||
|
||||
@AppStorage(UserDefaultsStore.Keys.textColor.rawValue, store: GroupUserDefaults.groupDefaults) private var textColor: Color = .black
|
||||
|
||||
let columns = [
|
||||
GridItem(.flexible(minimum: 5, maximum: .infinity), alignment: .center),
|
||||
GridItem(.flexible(minimum: 5, maximum: .infinity), alignment: .center),
|
||||
@@ -76,7 +77,7 @@ struct CurrentStreakTemplate: View, SharingTemplate {
|
||||
VStack {
|
||||
Text(String(format: String(localized: "share_view_current_streak_template_title")))
|
||||
.font(.title)
|
||||
.foregroundColor(theme.currentTheme.labelColor)
|
||||
.foregroundColor(textColor)
|
||||
.frame(maxWidth: .infinity, alignment: .center)
|
||||
.padding(.top)
|
||||
|
||||
|
||||
@@ -33,7 +33,8 @@ struct LongestStreakTemplate: View, SharingTemplate {
|
||||
@Environment(\.presentationMode) var presentationMode
|
||||
@AppStorage(UserDefaultsStore.Keys.moodTint.rawValue, store: GroupUserDefaults.groupDefaults) private var moodTint: MoodTints = .Default
|
||||
@AppStorage(UserDefaultsStore.Keys.theme.rawValue, store: GroupUserDefaults.groupDefaults) private var theme: Theme = .system
|
||||
|
||||
@AppStorage(UserDefaultsStore.Keys.textColor.rawValue, store: GroupUserDefaults.groupDefaults) private var textColor: Color = .black
|
||||
|
||||
let columns = [
|
||||
GridItem(.flexible(minimum: 5, maximum: .infinity), alignment: .center),
|
||||
GridItem(.flexible(minimum: 5, maximum: .infinity), alignment: .center),
|
||||
@@ -115,7 +116,7 @@ struct LongestStreakTemplate: View, SharingTemplate {
|
||||
VStack {
|
||||
Text(String(format: String(localized: "share_view_longest_streak_template_title"), self.selectedMood.strValue))
|
||||
.font(.title)
|
||||
.foregroundColor(theme.currentTheme.labelColor)
|
||||
.foregroundColor(textColor)
|
||||
.frame(maxWidth: .infinity, alignment: .center)
|
||||
.padding()
|
||||
|
||||
@@ -127,19 +128,19 @@ struct LongestStreakTemplate: View, SharingTemplate {
|
||||
VStack {
|
||||
Text(self.moodEntries.first?.forDate ?? Date(), formatter: itemFormatter)
|
||||
.font(.title)
|
||||
.foregroundColor(theme.currentTheme.labelColor)
|
||||
.foregroundColor(textColor)
|
||||
.frame(maxWidth: .infinity, alignment: .center)
|
||||
.padding(.top, 1)
|
||||
|
||||
Text("-")
|
||||
.font(.title)
|
||||
.foregroundColor(theme.currentTheme.labelColor)
|
||||
.foregroundColor(textColor)
|
||||
.frame(maxWidth: .infinity, alignment: .center)
|
||||
.padding(.top, 1)
|
||||
|
||||
Text(self.moodEntries.last?.forDate ?? Date(), formatter: itemFormatter)
|
||||
.font(.title)
|
||||
.foregroundColor(theme.currentTheme.labelColor)
|
||||
.foregroundColor(textColor)
|
||||
.frame(maxWidth: .infinity, alignment: .center)
|
||||
.padding(.top, 1)
|
||||
}
|
||||
@@ -168,7 +169,7 @@ struct LongestStreakTemplate: View, SharingTemplate {
|
||||
}, label: {
|
||||
Text("Pick Mood")
|
||||
.font(.title)
|
||||
.foregroundColor(theme.currentTheme.labelColor)
|
||||
.foregroundColor(textColor)
|
||||
.padding()
|
||||
})
|
||||
.frame(maxWidth: .infinity, alignment: .center)
|
||||
|
||||
@@ -25,7 +25,8 @@ struct MonthTotalTemplate: View, SharingTemplate {
|
||||
@Environment(\.presentationMode) var presentationMode
|
||||
@AppStorage(UserDefaultsStore.Keys.moodTint.rawValue, store: GroupUserDefaults.groupDefaults) private var moodTint: MoodTints = .Default
|
||||
@AppStorage(UserDefaultsStore.Keys.theme.rawValue, store: GroupUserDefaults.groupDefaults) private var theme: Theme = .system
|
||||
|
||||
@AppStorage(UserDefaultsStore.Keys.textColor.rawValue, store: GroupUserDefaults.groupDefaults) private var textColor: Color = .black
|
||||
|
||||
private var moodMetrics = [MoodMetrics]()
|
||||
private var moodEntries = [MoodEntry]()
|
||||
|
||||
@@ -104,7 +105,7 @@ struct MonthTotalTemplate: View, SharingTemplate {
|
||||
VStack {
|
||||
Text(String(format: String(localized: "share_view_month_moods_total_template_title"), Random.monthName(fromMonthInt: month), moodEntries.count))
|
||||
.font(.title)
|
||||
.foregroundColor(theme.currentTheme.labelColor)
|
||||
.foregroundColor(textColor)
|
||||
.frame(maxWidth: .infinity, alignment: .center)
|
||||
.padding()
|
||||
|
||||
|
||||
@@ -29,7 +29,8 @@ struct SwitchableView: View {
|
||||
|
||||
@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
|
||||
|
||||
@AppStorage(UserDefaultsStore.Keys.textColor.rawValue, store: GroupUserDefaults.groupDefaults) private var textColor: Color = .white
|
||||
|
||||
// store a value that gets changed when user updates custom colors to update the view since the moodTint doesn't change
|
||||
@AppStorage(UserDefaultsStore.Keys.customMoodTintUpdateNumber.rawValue, store: GroupUserDefaults.groupDefaults) private var customMoodTintUpdateNumber: Int = 0
|
||||
|
||||
@@ -52,7 +53,7 @@ struct SwitchableView: View {
|
||||
moodTint.color(forMood: .average),
|
||||
moodTint.color(forMood: .bad),
|
||||
moodTint.color(forMood: .horrible)
|
||||
])
|
||||
], textColor: textColor)
|
||||
.padding([.leading, .trailing], -15)
|
||||
.padding([.top, .bottom], 8)
|
||||
.allowsHitTesting(false)
|
||||
|
||||
Reference in New Issue
Block a user