From 7ca818252393583c01cf4a9cde2f7105b4ccb1e4 Mon Sep 17 00:00:00 2001 From: Eric Bailey Date: Wed, 17 Apr 2024 12:52:07 -0500 Subject: [PATCH] Profile step only in v2 --- src/screens/Onboarding/StepFinished.tsx | 36 ++++++++++++------------- src/screens/Onboarding/state.ts | 12 +++------ 2 files changed, 21 insertions(+), 27 deletions(-) diff --git a/src/screens/Onboarding/StepFinished.tsx b/src/screens/Onboarding/StepFinished.tsx index 81725c09d9..a67ce106a0 100644 --- a/src/screens/Onboarding/StepFinished.tsx +++ b/src/screens/Onboarding/StepFinished.tsx @@ -76,25 +76,25 @@ export function StepFinished() { })(), ]) - await getAgent().upsertProfile(async existing => { - existing = existing ?? {} - - if (profileStepResults.imageUri && profileStepResults.imageMime) { - const res = await uploadBlob( - getAgent(), - profileStepResults.imageUri, - profileStepResults.imageMime, - ) - - if (res.data.blob) { - existing.avatar = res.data.blob - } - } - - return existing - }) - if (isV2Enabled) { + await getAgent().upsertProfile(async existing => { + existing = existing ?? {} + + if (profileStepResults.imageUri && profileStepResults.imageMime) { + const res = await uploadBlob( + getAgent(), + profileStepResults.imageUri, + profileStepResults.imageMime, + ) + + if (res.data.blob) { + existing.avatar = res.data.blob + } + } + + return existing + }) + await getAgent().setHomeAlgoPref({ enabled: true, uri: DISCOVER_FEED_URI, diff --git a/src/screens/Onboarding/state.ts b/src/screens/Onboarding/state.ts index 4f996d1397..9aa24a510c 100644 --- a/src/screens/Onboarding/state.ts +++ b/src/screens/Onboarding/state.ts @@ -80,7 +80,7 @@ export type ApiResponseMap = { export const initialState: OnboardingState = { hasPrev: false, - totalSteps: 8, + totalSteps: 7, activeStep: 'interests', activeStepIndex: 1, @@ -198,11 +198,8 @@ export function reducer( next.activeStep = 'moderation' next.activeStepIndex = 6 } else if (s.activeStep === 'moderation') { - next.activeStep = 'profile' - next.activeStepIndex = 7 - } else if (s.activeStep === 'profile') { next.activeStep = 'finished' - next.activeStepIndex = 8 + next.activeStepIndex = 7 } break } @@ -222,12 +219,9 @@ export function reducer( } else if (s.activeStep === 'moderation') { next.activeStep = 'topicalFeeds' next.activeStepIndex = 5 - } else if (s.activeStep === 'profile') { + } else if (s.activeStep === 'finished') { next.activeStep = 'moderation' next.activeStepIndex = 6 - } else if (s.activeStep === 'finished') { - next.activeStep = 'profile' - next.activeStepIndex = 7 } break }