diff --git a/Shared/Models/Mood.swift b/Shared/Models/Mood.swift index 7e90fc5..470195d 100644 --- a/Shared/Models/Mood.swift +++ b/Shared/Models/Mood.swift @@ -17,6 +17,15 @@ enum Mood: Int { case missing case placeholder + var next: Mood { + var moodValue = self.rawValue + moodValue -= 1 + if moodValue < 0 { + moodValue = 4 + } + return Mood.init(rawValue: moodValue) ?? Mood.horrible + } + var strValue: String { switch self { case .horrible: diff --git a/Shared/Onboarding/views/OnboardingCustomizeOne.swift b/Shared/Onboarding/views/OnboardingCustomizeOne.swift index c09caf9..5663011 100644 --- a/Shared/Onboarding/views/OnboardingCustomizeOne.swift +++ b/Shared/Onboarding/views/OnboardingCustomizeOne.swift @@ -35,13 +35,13 @@ struct OnboardingCustomizeOne: View { .font(.title) .padding() .fixedSize(horizontal: false, vertical: true) - .foregroundColor(Color(UIColor.white)) + .foregroundColor(.black) Text(String(localized: "onboarding_title_customize_one_section_one_title")) .font(.title3) .fixedSize(horizontal: false, vertical: true) .padding() - .foregroundColor(Color(UIColor.white)) + .foregroundColor(.black) .multilineTextAlignment(.leading) IconPickerView() @@ -49,7 +49,7 @@ struct OnboardingCustomizeOne: View { .font(.title3) .padding() .fixedSize(horizontal: false, vertical: true) - .foregroundColor(Color(UIColor.white)) + .foregroundColor(.black) DayFilterPickerView() @@ -57,7 +57,7 @@ struct OnboardingCustomizeOne: View { .font(.title3) .padding() .fixedSize(horizontal: false, vertical: true) - .foregroundColor(Color(UIColor.white)) + .foregroundColor(.black) } } .padding() diff --git a/Shared/Onboarding/views/OnboardingCustomizeTwo.swift b/Shared/Onboarding/views/OnboardingCustomizeTwo.swift index b09a89f..b369d60 100644 --- a/Shared/Onboarding/views/OnboardingCustomizeTwo.swift +++ b/Shared/Onboarding/views/OnboardingCustomizeTwo.swift @@ -28,31 +28,30 @@ struct OnboardingCustomizeTwo: View { Spacer() } - VStack { + VStack(alignment: .leading) { + Text(String(localized: "onboarding_title_customize_two_title")) + .font(.title) + .padding() + .fixedSize(horizontal: false, vertical: true) + .foregroundColor(.white) + SampleEntryView() .padding([.top]) ScrollView { VStack(alignment: .leading) { - Text(String(localized: "onboarding_title_customize_two_title")) - .font(.title) - .padding() - .fixedSize(horizontal: false, vertical: true) - .foregroundColor(Color(UIColor.white)) - - Text(String(localized: "onboarding_title_customize_two_section_one_title")) .font(.title3) .padding() .fixedSize(horizontal: false, vertical: true) - .foregroundColor(Color(UIColor.white)) + .foregroundColor(.white) ImagePackPickerView() Text(String(localized: "onboarding_title_customize_two_section_two_title")) .font(.title3) .padding() .fixedSize(horizontal: false, vertical: true) - .foregroundColor(Color(UIColor.white)) + .foregroundColor(.white) TintPickerView() @@ -61,7 +60,7 @@ struct OnboardingCustomizeTwo: View { .font(.title3) .padding() .fixedSize(horizontal: false, vertical: true) - .foregroundColor(Color(UIColor.white)) + .foregroundColor(.white) TextColorPickerView() diff --git a/Shared/Onboarding/views/OnboardingDay.swift b/Shared/Onboarding/views/OnboardingDay.swift index 5bf5ee4..f9d8a83 100644 --- a/Shared/Onboarding/views/OnboardingDay.swift +++ b/Shared/Onboarding/views/OnboardingDay.swift @@ -52,7 +52,7 @@ struct OnboardingDay: View { .font(.title) .padding() .fixedSize(horizontal: false, vertical: true) - .foregroundColor(.black) + .foregroundColor(.white) Picker(selection: $onboardingData.inputDay, @@ -61,15 +61,17 @@ struct OnboardingDay: View { Text(day.localizedValue) } } + .labelsHidden() + .frame(minWidth: 0, maxWidth: .infinity) .padding() - .padding([.trailing, .leading], 55) .pickerStyle(SegmentedPickerStyle()) + .colorScheme(.dark) Text(previewText) .font(.title3) .padding() .fixedSize(horizontal: false, vertical: true) - .foregroundColor(.black) + .foregroundColor(.white) } } .padding() diff --git a/Shared/Onboarding/views/OnboardingWrapup.swift b/Shared/Onboarding/views/OnboardingWrapup.swift index eed152a..75de41f 100644 --- a/Shared/Onboarding/views/OnboardingWrapup.swift +++ b/Shared/Onboarding/views/OnboardingWrapup.swift @@ -36,6 +36,7 @@ struct OnboardingWrapup: View { Spacer() Text(String(localized: "onboarding_wrap_up_1")) + .padding(.top) .padding() .font(.title) .foregroundColor(Color(UIColor.white)) @@ -66,7 +67,7 @@ struct OnboardingWrapup: View { Text(String(localized: "onboarding_wrap_up_complete_button")) .font(.title) .fontWeight(.bold) - .foregroundColor(.yellow) + .foregroundColor(Color(hex: "31d158")) .padding() .background(RoundedRectangle(cornerRadius: 10).fill().foregroundColor(Color.white)) .cornerRadius(10) diff --git a/Shared/views/CustomIcon/CreateWidgetView.swift b/Shared/views/CustomIcon/CreateWidgetView.swift index ca8cb0f..9961a15 100644 --- a/Shared/views/CustomIcon/CreateWidgetView.swift +++ b/Shared/views/CustomIcon/CreateWidgetView.swift @@ -105,8 +105,8 @@ struct CreateWidgetView: View { }, label: { Image(systemName: "shuffle") .font(.title) - .foregroundColor(Color(UIColor.white)) - + .foregroundColor(.white) + .padding([.top, .bottom]) }) .frame(minWidth: 0, maxWidth: .infinity) .frame(minHeight: 40, maxHeight: .infinity) @@ -122,7 +122,8 @@ struct CreateWidgetView: View { Text(String(localized: "create_widget_save")) .font(.title) .fontWeight(.bold) - .foregroundColor(Color(UIColor.white)) + .foregroundColor(.white) + .padding([.top, .bottom]) }) .frame(minWidth: 0, maxWidth: .infinity) @@ -139,7 +140,8 @@ struct CreateWidgetView: View { Text(String(localized: "create_widget_use")) .font(.title) .fontWeight(.bold) - .foregroundColor(Color(UIColor.white)) + .foregroundColor(.white) + .padding([.top, .bottom]) }) .frame(minWidth: 0, maxWidth: .infinity) @@ -156,7 +158,8 @@ struct CreateWidgetView: View { }, label: { Image(systemName: "trash") .font(.title) - .foregroundColor(Color(UIColor.white)) + .foregroundColor(.white) + .padding([.top, .bottom]) }) .frame(minWidth: 0, maxWidth: .infinity) diff --git a/Shared/views/CustomizeView/SubViews/ShapePickerView.swift b/Shared/views/CustomizeView/SubViews/ShapePickerView.swift index b0890c7..6e5b699 100644 --- a/Shared/views/CustomizeView/SubViews/ShapePickerView.swift +++ b/Shared/views/CustomizeView/SubViews/ShapePickerView.swift @@ -18,29 +18,23 @@ struct ShapePickerView: View { ZStack { theme.currentTheme.secondaryBGColor - VStack { - HStack { - Spacer() - Text(shapeRefreshToggleThing.description.localizedLowercase) - .hidden() - Image(systemName: "arrow.triangle.2.circlepath.circle") - .resizable() - .frame(width: 20, height: 20, alignment: .trailing) - .foregroundColor(Color(UIColor.systemGray)) - .onTapGesture { - shapeRefreshToggleThing.toggle() - } - } - Spacer() - } - .padding() + VStack(alignment:.leading) { - Text(String(localized: "customize_view_view_pick_shape")) - .padding([.leading]) - .foregroundColor(textColor) - - Divider() + VStack { + HStack { + Spacer() + Text(shapeRefreshToggleThing.description.localizedLowercase) + .hidden() + Image(systemName: "arrow.triangle.2.circlepath.circle") + .resizable() + .frame(width: 20, height: 20, alignment: .trailing) + .foregroundColor(Color(UIColor.systemGray)) + .onTapGesture { + shapeRefreshToggleThing.toggle() + } + } + } HStack { ForEach(BGShape.allCases, id: \.rawValue) { ashape in diff --git a/Shared/views/DayView/DayView.swift b/Shared/views/DayView/DayView.swift index 286af45..35fa10d 100644 --- a/Shared/views/DayView/DayView.swift +++ b/Shared/views/DayView/DayView.swift @@ -126,7 +126,7 @@ struct DayView: View { settingsButtonView if viewModel.hasNoData { Spacer() - EmptyHomeView(viewModel: viewModel) + EmptyHomeView(showVote: true, viewModel: viewModel) Spacer() } else { ZStack { diff --git a/Shared/views/EmptyView.swift b/Shared/views/EmptyView.swift index 3291de4..d84cc9b 100644 --- a/Shared/views/EmptyView.swift +++ b/Shared/views/EmptyView.swift @@ -11,18 +11,31 @@ 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 = DefaultTextColor.textColor - let viewModel: DayViewViewModel + let showVote: Bool + let viewModel: DayViewViewModel? var body: some View { ZStack { theme.currentTheme.secondaryBGColor VStack { - AddMoodHeaderView(addItemHeaderClosure: { (mood, date) in - withAnimation { - viewModel.add(mood: mood, forDate: date, entryType: .header) + if showVote { + AddMoodHeaderView(addItemHeaderClosure: { (mood, date) in + withAnimation { + viewModel?.add(mood: mood, forDate: date, entryType: .header) + } + }) + } else { + VStack { + Spacer() + Text(String(localized: "view_no_data")) + .font(.title) + .padding() + .fixedSize(horizontal: false, vertical: true) + .foregroundColor(textColor) + Spacer() } - }) + } } } .fixedSize(horizontal: false, vertical: true) @@ -32,6 +45,10 @@ struct EmptyHomeView: View { struct EmptyHomeView_Previews: PreviewProvider { static var previews: some View { - EmptyHomeView(viewModel: DayViewViewModel(addMonthStartWeekdayPadding: false)) + Group { + EmptyHomeView(showVote: true, viewModel: DayViewViewModel(addMonthStartWeekdayPadding: false)) + + EmptyHomeView(showVote: false, viewModel: nil) + } } } diff --git a/Shared/views/MonthView/MonthView.swift b/Shared/views/MonthView/MonthView.swift index 47caf14..94ad186 100644 --- a/Shared/views/MonthView/MonthView.swift +++ b/Shared/views/MonthView/MonthView.swift @@ -48,15 +48,8 @@ struct MonthView: View { var body: some View { ZStack { if viewModel.hasNoData { - VStack { - Spacer() - Text(String(localized: "month_view_no_data")) - .font(.title) - .padding() - .fixedSize(horizontal: false, vertical: true) - .foregroundColor(textColor) - Spacer() - } + EmptyHomeView(showVote: false, viewModel: nil) + .padding() } else { ScrollView { VStack(spacing: 5) { @@ -178,17 +171,6 @@ extension MonthView { VStack { HStack { homeViewTwoSectionHeaderView(month: month, year: year) - -// Image(systemName: "square.and.arrow.up") -// .foregroundColor(textColor) -// .onTapGesture { -// let impactMed = UIImpactFeedbackGenerator(style: .heavy) -// impactMed.impactOccurred() -// -// let _image = shareViewImage(month: month, year: year, entries: entries).asImage(size: CGSize(width: 400, height: 260)) -// self.shareImage.showFuckingSheet = true -// self.shareImage.fuckingWrappedShrable = _image -// } } Divider() LazyVGrid(columns: columns, spacing: 15) { diff --git a/Shared/views/SampleEntryView.swift b/Shared/views/SampleEntryView.swift index 5b1f956..81c71a8 100644 --- a/Shared/views/SampleEntryView.swift +++ b/Shared/views/SampleEntryView.swift @@ -8,7 +8,7 @@ import SwiftUI struct SampleEntryView: View { - @State private var sampleListEntry = PersistenceController.shared.randomEntries(count: 1).first! + @State private var sampleListEntry = PersistenceController.shared.generateObjectNotInArray(forDate: Date(), withMood: Mood.great) @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 = DefaultTextColor.textColor @@ -24,17 +24,13 @@ struct SampleEntryView: View { .frame(width: 20, height: 20, alignment: .trailing) .foregroundColor(Color(UIColor.systemGray)) .onTapGesture { - sampleListEntry = PersistenceController.shared.randomEntries(count: 1).first! + sampleListEntry = PersistenceController.shared.generateObjectNotInArray(forDate: Date(), withMood: sampleListEntry.mood.next) } } Spacer() }.padding() VStack(alignment:.leading) { - Text(String(localized: "customize_view_view_example_row")) - .padding([.leading, .top]) - .foregroundColor(textColor) - Divider() EntryListView(entry: sampleListEntry) .padding() } diff --git a/Shared/views/YearView/YearView.swift b/Shared/views/YearView/YearView.swift index 0e7ad98..5264e82 100644 --- a/Shared/views/YearView/YearView.swift +++ b/Shared/views/YearView/YearView.swift @@ -44,13 +44,20 @@ struct YearView: View { ] var body: some View { - ScrollView { - gridView - .onAppear(perform: { - self.viewModel.filterEntries(startDate: Date(timeIntervalSince1970: 0), endDate: Date()) - }) + ZStack { + if self.viewModel.data.keys.isEmpty { + EmptyHomeView(showVote: false, viewModel: nil) + .padding() + } else { + ScrollView { + gridView + } + .padding(.bottom, 5) + } } - .padding(.bottom, 5) + .onAppear(perform: { + self.viewModel.filterEntries(startDate: Date(timeIntervalSince1970: 0), endDate: Date()) + }) .background( theme.currentTheme.bg .edgesIgnoringSafeArea(.all) diff --git a/en.lproj/Localizable.strings b/en.lproj/Localizable.strings index 3cffa6c..7231327 100644 --- a/en.lproj/Localizable.strings +++ b/en.lproj/Localizable.strings @@ -6,35 +6,27 @@ */ -"onboarding_time_title" = "What time do you want to unlock your rating"; -"onboarding_time_body" = "Voting will be unlocked at %@ daily, you will also recieve a notification at this time"; +"onboarding_time_title" = "What time do you want to unlock your rating?"; +"onboarding_time_body" = "Voting will be unlocked at %@ daily, you will also recieve a notification at this time as a reminder."; -"onboarding_day_title" = "Will this rating be for current day or previous day"; -"onboarding_day_body" = "When you vote your vote will be for the %@"; -"onboarding_day_preview_text_today" = "Example: If you pick on a Tuesday, the value will be recorded for Tuesday"; -"onboarding_day_preview_text_yesterday" = "Example: If you pick on a Tuesday, the value will be recorded for Monday, the day before."; +"onboarding_day_title" = "Will this rating be for the current day or the previous day?"; +"onboarding_day_preview_text_today" = "If you pick on a Tuesday, the value will be recorded for that Tuesday."; +"onboarding_day_preview_text_yesterday" = "If you pick on a Tuesday, the value will be recorded for Monday, the previous day."; "onboarding_day_options_today" = "Current Day"; "onboarding_day_options_yesterday" = "Previous Day"; -"onboarding_title_title" = "What would you like the reminder to say?"; -"onboarding_title_type_your_own" = "-- or type your own--"; -"onboarding_title_title_option_1" = "Its time to select."; -"onboarding_title_title_option_2" = "Pick your shit!"; -"onboarding_title_title_option_3" = "How was your day?"; - -"onboarding_title_customize_one_title" = "Lets make ifeel yours"; -"onboarding_title_customize_one_section_one_title" = "Pick an app icon"; +"onboarding_title_customize_one_title" = ""; +"onboarding_title_customize_one_section_one_title" = "Pick an app icon."; "onboarding_title_customize_one_section_two_title" = "What days would you like to see on the charts?"; "onboarding_title_customize_one_section_two_note" = "Note: you will still be asked to pick a feeling for every day"; -"onboarding_title_customize_two_title" = ""; +"onboarding_title_customize_two_title" = "Pick your style."; "onboarding_title_customize_two_section_one_title" = "What icon set would you like to use?"; -"onboarding_title_customize_two_section_two_title" = "Pick colors for each feeling or create your own"; -"onboarding_title_customize_two_section_three_title" = "Pick a text color"; +"onboarding_title_customize_two_section_two_title" = "Pick colors for each feeling or create your own."; +"onboarding_title_customize_two_section_three_title" = "Pick a text color."; "onboarding_wrap_up_1" = "At"; -"onboarding_wrap_up_2" = "you will get notified that"; "onboarding_wrap_up_3" = "you'll be notified its time to pick a mood for the"; "onboarding_wrap_up_complete_button" = "Complete"; @@ -43,33 +35,21 @@ "add_mood_header_view_title" = "How was %@?"; "content_view_tab_main" = "Day"; -"content_view_tab_month" = "Months"; +"content_view_tab_month" = "Month"; "content_view_tab_filter" = "Year"; -"content_view_tab_share" = "Share"; "content_view_tab_customize" = "Customize"; "content_view_fill_in_missing_entry" = "Update %@"; "content_view_fill_in_missing_entry_cancel" = "Cancel"; "content_view_delete_entry" = "Delete this entry"; "content_view_header_title" = "Past %d days"; -"content_view_empty_title" = "There are no entries to display."; "filter_view_total" = "Total"; -"filter_view_show_filters" = "Show Filters"; -"filter_view_hide_filters" = "Hide Filters"; -"filter_view_begin_date" = "Begin Date"; -"filter_view_end_date" = "End Date"; "settings_view_exit" = "Exit"; "settings_view_special_thanks_to_title" = "Special thanks"; -"settings_view_special_thanks_to_body" = "Special body"; -"settings_view_why_bg_mode_title" = "What do we use background task for?"; -"settings_view_why_bg_mode_body" = "We use it to update the database for any missing day. For example: if you rate Monday and Wednesday you'll see that Tuesday will show on the view as missing, and by tapping that row you can then rate the day that is missing. We need a time to search for and add missing days, we do this nightly and while your device is not being used. It's a quick process and doesn't impact battery life."; "settings_view_show_onboarding" = "Show onboarding"; -"settings_use_cloudkit_title" = "Use CloudKit"; -"settings_use_cloudkit_body" = "CloudKit fucking sucks"; "settings_use_delete_enable" = "Allow deletion of entry"; - "mood_value_great" = "Great"; "mood_value_good" = "Good"; "mood_value_average" = "Average"; @@ -78,22 +58,11 @@ "mood_value_missing" = "Missing"; "mood_value_missing_tap_to_add" = "Missing - Tap to add"; -"share_view_all_moods_total_template_title" = "Total Entries: %d"; -"share_view_month_moods_total_template_title" = "Total Entries for %@ - %d"; -"share_view_current_streak_template_title" = "Last 10 Days"; -"share_view_longest_streak_template_title" = "Longest consecutive days I was %@"; - -"customize_view_title" = "Make ifeel yours!!!"; -"customize_view_custom_widget_title" = "Custom Widgets"; -"customize_view_background_title" = "Pick a theme"; -"customize_view_view_change_icon" = "Change App Icon"; "customize_view_view_text_color" = "Text Color"; -"customize_view_view_example_row" = "Example row"; "customize_view_over18alert_title" = "Are you over 18?"; -"customize_view_over18alert_body" = "Some of this is explicit, are you over 18?"; -"customize_view_over18alert_ok" = "Sure"; -"customize_view_over18alert_no" = "Nah, I'm good"; -"customize_view_view_pick_shape" = "Pick a shape"; +"customize_view_over18alert_body" = "Some of the text might be explicit."; +"customize_view_over18alert_ok" = "Yes"; +"customize_view_over18alert_no" = "No"; "create_widget_view_left_eye" = "Left Eye"; "create_widget_view_right_eye" = "Right Eye"; @@ -107,5 +76,23 @@ "create_widget_save" = "Save"; "create_widget_use" = "Use"; -"month_view_no_data" = "There are no entries to display."; -"day_picker_view_text" = "Only shows these days"; +"view_no_data" = "There are no entries."; +"day_picker_view_text" = "Only shows these days on the Day, Month, Year views."; + +/* not used */ +"onboarding_title_title" = "What would you like the reminder to say?"; +"onboarding_title_type_your_own" = "-- or type your own--"; +"onboarding_title_title_option_1" = "Its time to select."; +"onboarding_title_title_option_2" = "Pick your shit!"; +"onboarding_title_title_option_3" = "How was your day?"; + +"settings_use_cloudkit_title" = "Use CloudKit"; +"settings_use_cloudkit_body" = "CloudKit fucking sucks"; +"settings_view_why_bg_mode_title" = "What do we use background task for?"; +"settings_view_why_bg_mode_body" = "We use it to update the database for any missing day. For example: if you rate Monday and Wednesday you'll see that Tuesday will show on the view as missing, and by tapping that row you can then rate the day that is missing. We need a time to search for and add missing days, we do this nightly and while your device is not being used. It's a quick process and doesn't impact battery life."; + +"share_view_all_moods_total_template_title" = "Total Entries: %d"; +"share_view_month_moods_total_template_title" = "Total Entries for %@ - %d"; +"share_view_current_streak_template_title" = "Last 10 Days"; +"share_view_longest_streak_template_title" = "Longest consecutive days I was %@"; +/* end not used */