fix: issue #148 - for onboarding first ask to rate today / tomorrow then the next screen shoudl be time. if the user select today make the default time 9pm, if hte user selects tomorrow default time is 9am
Automated fix by Tony CI v3. Refs #148 Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -11,7 +11,12 @@ import UserNotifications
|
||||
// this is getting passed around and filled out
|
||||
// class and vars
|
||||
final class OnboardingData: NSObject, ObservableObject, Codable {
|
||||
@Published var date: Date = Date()
|
||||
@Published var date: Date = {
|
||||
var components = Calendar.current.dateComponents([.year, .month, .day], from: Date())
|
||||
components.hour = 21 // 9 PM default (matches default .Today selection)
|
||||
components.minute = 0
|
||||
return Calendar.current.date(from: components) ?? Date()
|
||||
}()
|
||||
@Published var inputDay: DayOptions = .Today
|
||||
|
||||
enum CodingKeys: CodingKey {
|
||||
|
||||
@@ -65,7 +65,10 @@ struct OnboardingDay: View {
|
||||
example: "e.g. Tue reminder → Rate Tue",
|
||||
icon: "sun.max.fill",
|
||||
isSelected: onboardingData.inputDay == .Today,
|
||||
action: { onboardingData.inputDay = .Today },
|
||||
action: {
|
||||
onboardingData.inputDay = .Today
|
||||
onboardingData.date = defaultTime(hour: 21)
|
||||
},
|
||||
testID: AccessibilityID.Onboarding.dayToday
|
||||
)
|
||||
|
||||
@@ -75,7 +78,10 @@ struct OnboardingDay: View {
|
||||
example: "e.g. Tue reminder → Rate Mon",
|
||||
icon: "moon.fill",
|
||||
isSelected: onboardingData.inputDay == .Previous,
|
||||
action: { onboardingData.inputDay = .Previous },
|
||||
action: {
|
||||
onboardingData.inputDay = .Previous
|
||||
onboardingData.date = defaultTime(hour: 9)
|
||||
},
|
||||
testID: AccessibilityID.Onboarding.dayYesterday
|
||||
)
|
||||
}
|
||||
@@ -107,6 +113,13 @@ struct OnboardingDay: View {
|
||||
)
|
||||
.accessibilityIdentifier(AccessibilityID.Onboarding.dayScreen)
|
||||
}
|
||||
|
||||
private func defaultTime(hour: Int) -> Date {
|
||||
var components = Calendar.current.dateComponents([.year, .month, .day], from: Date())
|
||||
components.hour = hour
|
||||
components.minute = 0
|
||||
return Calendar.current.date(from: components) ?? Date()
|
||||
}
|
||||
}
|
||||
|
||||
struct DayOptionCard: View {
|
||||
|
||||
@@ -19,12 +19,12 @@ struct OnboardingMain: View {
|
||||
// 1. Welcome screen
|
||||
OnboardingWelcome()
|
||||
|
||||
// 2. Reminder time
|
||||
OnboardingTime(onboardingData: onboardingData)
|
||||
|
||||
// 3. Which day to rate
|
||||
// 2. Which day to rate
|
||||
OnboardingDay(onboardingData: onboardingData)
|
||||
|
||||
// 3. Reminder time
|
||||
OnboardingTime(onboardingData: onboardingData)
|
||||
|
||||
// 4. Style customization
|
||||
OnboardingStyle(onboardingData: onboardingData)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user