goon/mobile/src/lib/onboardingBus.ts
goon-foss e1dd46c6f2 feat(mobile): first-launch tutorial (pages, features, long-presses, player gestures)
A 7-slide carousel shown once on first launch:
- the three tabs (Scenes/Movies/Sites)
- search, filters, saved searches, Performers/Tags/Favorites
- long-press actions (hide/duplicate a scene, remove a wrong performer, link diagnostics)
- player gestures (tap controls, double-tap ±15s, swipe to scrub, unmute)
- favorites, Hidden content, PIN lock, the ? report button, Sites ★ ratings

Gated by a SecureStore flag; replayable from Settings ⚙ → Replay tutorial (via a
tiny onboarding bus). Suppresses the What's-new popup for brand-new users (the tour
covers it) and marks the changelog seen on finish.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-22 10:08:56 +02:00

17 lines
504 B
TypeScript

/**
* Mini event-bus do ręcznego odpalenia tutoriala ("Replay tutorial" w ustawieniach).
* OnboardingModal subskrybuje `onReplay`, ekran ustawień woła `replayOnboarding()`.
* Zero zależności — lista listenerów w module scope.
*/
type Listener = () => void;
const listeners = new Set<Listener>();
export function onReplay(cb: Listener): () => void {
listeners.add(cb);
return () => listeners.delete(cb);
}
export function replayOnboarding(): void {
listeners.forEach((cb) => cb());
}