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:
FuelBoard Contributor
2026-08-12 07:10:54 +01:00
parent 2ed18d81a3
commit fb79cf0788
4 changed files with 422 additions and 2 deletions
+13
View File
@@ -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? {