Add first-launch onboarding with location + notification permission prompts
- OnboardingView: 4-page flow (welcome + features, location, notifications, done) - Triggers system prompts in-context via OnboardingPermissionPrompter - Shown at initial launch only (FuelStore.onboardingCompleted flag, app-group defaults) - Test hook: 'Show onboarding (testing)' button at bottom of Alerts tab
This commit is contained in:
@@ -182,6 +182,7 @@ struct FuelStore {
|
||||
static let favouritesKey = "fuelboard.favourites" // [FuelStation] JSON
|
||||
static let alertsEnabledKey = "fuelboard.alertsEnabled" // Bool
|
||||
static let alertsRadiusKey = "fuelboard.alertsRadius" // Double km
|
||||
static let onboardingCompletedKey = "fuelboard.onboardingCompleted" // Bool
|
||||
static let lastRefreshKey = "fuelboard.lastRefresh" // TimeInterval (seconds since 1970)
|
||||
|
||||
// MARK: Stations
|
||||
@@ -358,6 +359,18 @@ struct FuelStore {
|
||||
return Date().timeIntervalSince(last) < refreshInterval
|
||||
}
|
||||
|
||||
// MARK: Onboarding — the app shows the intro screen on first launch only
|
||||
// (a test button in the Alerts tab re-opens it). Stored in the app group
|
||||
// so the widget can see it too if ever needed.
|
||||
|
||||
static func loadHasCompletedOnboarding() -> Bool {
|
||||
UserDefaults(suiteName: appGroupSuite)?.bool(forKey: onboardingCompletedKey) ?? false
|
||||
}
|
||||
|
||||
static func saveHasCompletedOnboarding(_ completed: Bool) {
|
||||
UserDefaults(suiteName: appGroupSuite)?.set(completed, forKey: onboardingCompletedKey)
|
||||
}
|
||||
|
||||
// MARK: Low-level keychain helpers
|
||||
|
||||
private static func keychainData(service: String) -> Data? {
|
||||
|
||||
Reference in New Issue
Block a user