Best Value: announce the page to existing users, once per announcement version
Users who finished onboarding before Best Value existed are "completed, not fresh" forever, so the first-run gate never fires again for them and the feature stayed invisible unless they went looking in Settings. They now get the Best Value page on its own, once per announcement version — deliberately NOT a replay of the onboarding flow, which would re-run permission pages they answered long ago and has no skip. - FuelStore: "fuelboard.bestValueIntroVersion", stored through the same saveString/loadString path as the onboarding flag and compared against a CODE-SIDE "currentBestValueIntroVersion". Deliberately not CFBundleShortVersionString: keying on the bundle version would re-announce on every bugfix release. Bump the constant to re-announce on purpose. - FuelStore.shouldAnnounceBestValue(settings:hasSeen:onboardingDue:isSuppressed:) holds the rule, with every fact injectable so it is unit-tested instead of being driven through a simulator. It declines when onboarding is due or on screen, when this announcement version has been seen, and when the user has already configured Best Value themselves. - BestValueAnnouncementHost wraps the app's content and owns the presentation state, so ContentView's change is a single wrapper and the whole feature lives in the new file. It reloads the stored settings on dismiss, because the page writes straight to the store rather than through ContentView's binding. - The page is now ONE view, BestValueIntroContent, used by first-run onboarding (page 5 of 6) and by the announcement, so the copy, the sliders and the "declining is a decision" rule cannot drift. OnboardingView drops its private duplicate of the page, its bindings and its read-outs, and finish() marks the announcement seen so a new user never sees the page twice. QA hooks (DEBUG): -showBestValueIntro forces the announcement, and -skipOnboarding suppresses it. Worth knowing now that a returning install announces on a PLAIN launch, so tab screenshots need -skipOnboarding. Verified on the simulator (OCR of the rendered screens): a plain launch of an install that has completed onboarding shows the single announcement page — Best Value title, explanation, "Turn on Best Value", the "Settings, under Fuel Savings" note and a "Not now" button, with no page dots; -skipOnboarding shows no cover at all; -showBestValueIntro forces it. 180 tests, 0 failures (8 new).
This commit is contained in:
@@ -408,7 +408,22 @@ struct ContentView: View {
|
||||
|
||||
private var presentedContent: AnyView {
|
||||
AnyView(
|
||||
mainContent
|
||||
// The Best Value announcement for users who updated into the feature
|
||||
// (see `BestValueAnnouncementHost`): a one-page cover, shown once per
|
||||
// announcement version, never while first-run onboarding is due.
|
||||
BestValueAnnouncementHost(
|
||||
isSuppressed: showOnboarding,
|
||||
onDismiss: {
|
||||
// The page writes straight to the store — it is its own cover
|
||||
// with its own copy of the settings — so pull the stored
|
||||
// values back in, or the choice wouldn't take effect until
|
||||
// the next launch.
|
||||
fuelSavingsSettings = FuelStore.loadFuelSavingsSettings()
|
||||
sessionFuelSavingsAmount = fuelSavingsSettings.preferredAmount
|
||||
}
|
||||
) {
|
||||
mainContent
|
||||
}
|
||||
.fullScreenCover(isPresented: $showOnboarding) {
|
||||
OnboardingView {
|
||||
showOnboarding = false
|
||||
|
||||
Reference in New Issue
Block a user