mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-11-08 05:43:04 +00:00
Hold the settings-restore prompt until the onboarding tour is done
The "restore storage/wallet from Nostr" confirm was popping over the guided tour (both fire on login). Gate the restore dialog behind a "tour gate": - maybeOfferOnboardingTour opens the gate synchronously when the tour will run (shouldOfferOnboarding), before its own start delay — so ordering can't race. The tour offer is now called before the restore offer on login. - launchBitvidTour gains an onEnd(status) hook (fires on finish AND skip); startOnboardingTour closes the gate on end, and also closes it if the tour never starts (logged out, no eligible steps) so restore can't hang. - The restore prompt's confirm now awaits whenOnboardingTourInactive() before showing — the remote existence check still runs in parallel, only the dialog is held back. No tour → gate stays closed → restore behaves as before. Co-Authored-By: Claude Opus 4.8 <[email protected]>
This commit is contained in:
1 parent
0e2f81d222
commit
c562d9ee65
2 files changed
+75
-8
No files matched your search
@@ -74,19 +74,32 @@ export function launchBitvidTour({
|
||||
openProfilePane,
|
||||
document: doc,
|
||||
force = false,
|
||||
onEnd,
|
||||
} = {}) {
|
||||
if (!force && !shouldOfferOnboarding(pubkey)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Fire onEnd on both finish and skip so callers can release anything they
|
||||
// deferred for the tour's duration (e.g. the settings-restore prompt).
|
||||
const end = (status) => {
|
||||
markOnboarding(pubkey, status);
|
||||
try {
|
||||
onEnd?.(status);
|
||||
} catch (error) {
|
||||
// best-effort
|
||||
}
|
||||
};
|
||||
|
||||
const tour = createTour({
|
||||
steps: buildBitvidTourSteps({ openProfilePane }),
|
||||
document: doc,
|
||||
onFinish: () => markOnboarding(pubkey, "completed"),
|
||||
onSkip: () => markOnboarding(pubkey, "skipped"),
|
||||
onFinish: () => end("completed"),
|
||||
onSkip: () => end("skipped"),
|
||||
});
|
||||
|
||||
return Boolean(tour?.start());
|
||||
const started = Boolean(tour?.start());
|
||||
return started;
|
||||
}
|
||||
|
||||
export default launchBitvidTour;
|
||||
Reference in new issue
Block a user