diff --git a/src/Expensify.tsx b/src/Expensify.tsx index aa374ff935ae..3b79b7d6f01e 100644 --- a/src/Expensify.tsx +++ b/src/Expensify.tsx @@ -97,6 +97,7 @@ function Expensify() { const [focusModeNotification] = useOnyx(ONYXKEYS.FOCUS_MODE_NOTIFICATION, {initWithStoredValues: false}); const [lastVisitedPath] = useOnyx(ONYXKEYS.LAST_VISITED_PATH); const [useNewDotSignInPage] = useOnyx(ONYXKEYS.USE_NEWDOT_SIGN_IN_PAGE); + const [useLoggedOutFromOldDot] = useOnyx(ONYXKEYS.LOGGED_OUT_FROM_OLDDOT); useEffect(() => { if (!account?.needsTwoFactorAuthSetup || account.requiresTwoFactorAuth) { @@ -117,11 +118,13 @@ function Expensify() { const isAuthenticated = useMemo(() => !!(session?.authToken ?? null), [session]); const autoAuthState = useMemo(() => session?.autoAuthState ?? '', [session]); - const shouldInit = isNavigationReady && hasAttemptedToOpenPublicRoom; + const isHybridApp = !!NativeModules.HybridAppModule; + + const shouldInit = isHybridApp ? !useLoggedOutFromOldDot && isNavigationReady && hasAttemptedToOpenPublicRoom : isNavigationReady && hasAttemptedToOpenPublicRoom; const shouldHideSplash = shouldInit && - (NativeModules.HybridAppModule - ? splashScreenState === CONST.BOOT_SPLASH_STATE.READY_TO_BE_HIDDEN && (isAuthenticated || useNewDotSignInPage) + (isHybridApp + ? splashScreenState === CONST.BOOT_SPLASH_STATE.READY_TO_BE_HIDDEN && (isAuthenticated || !!useNewDotSignInPage) : splashScreenState === CONST.BOOT_SPLASH_STATE.VISIBLE); const initializeClient = () => { diff --git a/src/ONYXKEYS.ts b/src/ONYXKEYS.ts index 2222ace5c411..78b70d24eed9 100755 --- a/src/ONYXKEYS.ts +++ b/src/ONYXKEYS.ts @@ -455,6 +455,9 @@ const ONYXKEYS = { /** Stores the information if HybridApp uses NewDot's sign in flow */ USE_NEWDOT_SIGN_IN_PAGE: 'useNewDotSignInPage', + /** Stores the information if user logged out from OldDot when using hybrid app */ + LOGGED_OUT_FROM_OLDDOT: 'loggedOutFromOldDot', + HYBRID_APP: 'hybridApp', /** Collection Keys */ @@ -1027,6 +1030,7 @@ type OnyxValuesMapping = { [ONYXKEYS.SHOULD_SHOW_SAVED_SEARCH_RENAME_TOOLTIP]: boolean; [ONYXKEYS.NVP_EXPENSIFY_COMPANY_CARDS_CUSTOM_NAMES]: Record; [ONYXKEYS.USE_NEWDOT_SIGN_IN_PAGE]: boolean; + [ONYXKEYS.LOGGED_OUT_FROM_OLDDOT]: boolean; [ONYXKEYS.HYBRID_APP]: OnyxTypes.HybridApp; }; type OnyxValues = OnyxValuesMapping & OnyxCollectionValuesMapping & OnyxFormValuesMapping & OnyxFormDraftValuesMapping; diff --git a/src/libs/actions/Session/index.ts b/src/libs/actions/Session/index.ts index 96bd7589d288..64a4184cec9a 100644 --- a/src/libs/actions/Session/index.ts +++ b/src/libs/actions/Session/index.ts @@ -490,7 +490,7 @@ function signInAfterTransitionFromOldDot(transitionURL: string) { ) : {}; - const {useNewDotSignInPage, isSingleNewDotEntry} = queryParamsObject; + const {useNewDotSignInPage, isSingleNewDotEntry, loggedOut} = queryParamsObject; const clearOnyxBeforeSignIn = () => { if (useNewDotSignInPage !== 'true') { @@ -513,6 +513,7 @@ function signInAfterTransitionFromOldDot(transitionURL: string) { .then(() => Onyx.multiSet({ [ONYXKEYS.USE_NEWDOT_SIGN_IN_PAGE]: useNewDotSignInPage === 'true', + [ONYXKEYS.LOGGED_OUT_FROM_OLDDOT]: loggedOut === 'true', [ONYXKEYS.NVP_TRYNEWDOT]: {classicRedirect: {dismissed: 'true'}}, // This data is mocked and should be returned by BeginSignUp/SignInUser API commands }), )