diff options
author | Ansh Nanda <anshnanda10@gmail.com> | 2023-08-28 18:53:58 -0700 |
---|---|---|
committer | Ansh Nanda <anshnanda10@gmail.com> | 2023-08-28 18:53:58 -0700 |
commit | 8f0f3be8fb6255df5be6b4650b0770e7829e1a60 (patch) | |
tree | dc75cf458e370692bfcdf0753df732e978a83ee1 /src | |
parent | bcef7400db65b1a1ce01c655bc0e16530254de5a (diff) | |
download | voidsky-8f0f3be8fb6255df5be6b4650b0770e7829e1a60.tar.zst |
start onboarding only for new account creations
Diffstat (limited to 'src')
-rw-r--r-- | src/state/models/discovery/onboarding.ts | 26 | ||||
-rw-r--r-- | src/state/models/ui/create-account.ts | 4 | ||||
-rw-r--r-- | src/state/models/ui/shell.ts | 7 |
3 files changed, 17 insertions, 20 deletions
diff --git a/src/state/models/discovery/onboarding.ts b/src/state/models/discovery/onboarding.ts index cb0c21371..664dc874c 100644 --- a/src/state/models/discovery/onboarding.ts +++ b/src/state/models/discovery/onboarding.ts @@ -14,7 +14,7 @@ type OnboardingStep = const OnboardingStepsArray = Object.values(OnboardingScreenSteps) export class OnboardingModel { // state - step: OnboardingStep = 'Welcome' + step: OnboardingStep = 'Home' constructor(public rootStore: RootStoreModel) { makeAutoObservable(this, { @@ -25,7 +25,6 @@ export class OnboardingModel { } serialize(): unknown { - console.log('serializing onboarding', this.step) return { step: this.step, } @@ -38,7 +37,6 @@ export class OnboardingModel { typeof v.step === 'string' && OnboardingStepsArray.includes(v.step as OnboardingStep) ) { - console.log('hydrating onboarding', v.step) this.step = v.step as OnboardingStep } } else { @@ -53,16 +51,12 @@ export class OnboardingModel { * @returns name of next screen in the onboarding process */ next(currentScreenName?: OnboardingStep) { - if (currentScreenName === 'Welcome' || this.step === 'Welcome') { - track('Onboarding:Begin') + currentScreenName = currentScreenName || this.step + if (currentScreenName === 'Welcome') { this.step = 'RecommendedFeeds' return this.step - } else if ( - this.step === 'RecommendedFeeds' || - currentScreenName === 'RecommendedFeeds' - ) { - track('Onboarding:Complete') - this.step = 'Home' + } else if (this.step === 'RecommendedFeeds') { + this.finish() return this.step } else { // if we get here, we're in an invalid state, let's just go Home @@ -70,6 +64,16 @@ export class OnboardingModel { } } + start() { + this.step = 'Welcome' + track('Onboarding:Begin') + } + + finish() { + this.step = 'Home' + track('Onboarding:Complete') + } + reset() { this.step = 'Welcome' } diff --git a/src/state/models/ui/create-account.ts b/src/state/models/ui/create-account.ts index 04e1554c6..d9d4f51b9 100644 --- a/src/state/models/ui/create-account.ts +++ b/src/state/models/ui/create-account.ts @@ -109,10 +109,10 @@ export class CreateAccountModel { this.setError('') this.setIsProcessing(true) - // open the onboarding modal after the session is created + // open the onboarding screens after the session is created const sessionReadySub = this.rootStore.onSessionReady(() => { sessionReadySub.remove() - this.rootStore.shell.openModal({name: 'onboarding'}) + this.rootStore.onboarding.start() }) try { diff --git a/src/state/models/ui/shell.ts b/src/state/models/ui/shell.ts index 6f6ed06bc..a64047f9f 100644 --- a/src/state/models/ui/shell.ts +++ b/src/state/models/ui/shell.ts @@ -140,10 +140,6 @@ export interface PreferencesHomeFeed { name: 'preferences-home-feed' } -export interface OnboardingModal { - name: 'onboarding' -} - export type Modal = // Account | AddAppPasswordModal @@ -176,9 +172,6 @@ export type Modal = | WaitlistModal | InviteCodesModal - // Onboarding - | OnboardingModal - // Generic | ConfirmModal |