From e52474edf37fc326e926c0432b992c58ae7fe7b9 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Fri, 20 Sep 2024 10:54:15 +0200 Subject: [PATCH 1/2] Fix for Deep linking to onboarding and signing up with new gmail bypasses onboarding flow --- src/libs/actions/Report.ts | 47 ++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 25 deletions(-) diff --git a/src/libs/actions/Report.ts b/src/libs/actions/Report.ts index 89eec7835e0b..9359427eea01 100644 --- a/src/libs/actions/Report.ts +++ b/src/libs/actions/Report.ts @@ -2694,32 +2694,29 @@ function openReportFromDeepLink(url: string) { return; } - const state = navigationRef.getRootState(); - const currentFocusedRoute = findFocusedRoute(state); - const hasCompletedGuidedSetupFlow = hasCompletedGuidedSetupFlowSelector(onboarding); - // We need skip deeplinking if the user hasn't completed the guided setup flow. - if (!hasCompletedGuidedSetupFlow) { - Welcome.isOnboardingFlowCompleted({ - onNotCompleted: () => OnboardingFlow.startOnboardingFlow(), - }); - return; - } - - if (isOnboardingFlowName(currentFocusedRoute?.name)) { - Welcome.setOnboardingErrorMessage(Localize.translateLocal('onboarding.purpose.errorBackButton')); - return; - } - - if (shouldSkipDeepLinkNavigation(route)) { - return; - } - - if (isAuthenticated) { - return; - } - - Navigation.navigate(route as Route, CONST.NAVIGATION.ACTION_TYPE.PUSH); + Welcome.isOnboardingFlowCompleted({ + onNotCompleted: () => OnboardingFlow.startOnboardingFlow(), + onCompleted: () => { + const state = navigationRef.getRootState(); + const currentFocusedRoute = findFocusedRoute(state); + + if (isOnboardingFlowName(currentFocusedRoute?.name)) { + Welcome.setOnboardingErrorMessage(Localize.translateLocal('onboarding.purpose.errorBackButton')); + return; + } + + if (shouldSkipDeepLinkNavigation(route)) { + return; + } + + if (isAuthenticated) { + return; + } + + Navigation.navigate(route as Route, CONST.NAVIGATION.ACTION_TYPE.PUSH); + }, + }); }); }, }); From 7e5d008ddf21d594ada112db96bb19a62e3b22e9 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Fri, 20 Sep 2024 10:59:52 +0200 Subject: [PATCH 2/2] Fix lint --- src/libs/actions/Report.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/libs/actions/Report.ts b/src/libs/actions/Report.ts index 9359427eea01..b038f16d003d 100644 --- a/src/libs/actions/Report.ts +++ b/src/libs/actions/Report.ts @@ -57,7 +57,6 @@ import {prepareDraftComment} from '@libs/DraftCommentUtils'; import * as EmojiUtils from '@libs/EmojiUtils'; import * as Environment from '@libs/Environment/Environment'; import * as ErrorUtils from '@libs/ErrorUtils'; -import hasCompletedGuidedSetupFlowSelector from '@libs/hasCompletedGuidedSetupFlowSelector'; import HttpUtils from '@libs/HttpUtils'; import isPublicScreenRoute from '@libs/isPublicScreenRoute'; import * as Localize from '@libs/Localize';