diff --git a/src/Expensify.tsx b/src/Expensify.tsx index 5d9ab88f6806..24647a6c5d6a 100644 --- a/src/Expensify.tsx +++ b/src/Expensify.tsx @@ -117,10 +117,12 @@ function Expensify() { const isAuthenticated = useMemo(() => !!(session?.authToken ?? null), [session]); const autoAuthState = useMemo(() => session?.autoAuthState ?? '', [session]); - const shouldInit = isNavigationReady && hasAttemptedToOpenPublicRoom; + const shouldInit = !!NativeModules.HybridAppModule + ? !hybridApp?.loggedOutFromOldDot && isNavigationReady && hasAttemptedToOpenPublicRoom + : isNavigationReady && hasAttemptedToOpenPublicRoom; const shouldHideSplash = shouldInit && - (NativeModules.HybridAppModule + (!!NativeModules.HybridAppModule ? splashScreenState === CONST.BOOT_SPLASH_STATE.READY_TO_BE_HIDDEN && (isAuthenticated || !!hybridApp?.useNewDotSignInPage) : splashScreenState === CONST.BOOT_SPLASH_STATE.VISIBLE); diff --git a/src/libs/actions/HybridApp.ts b/src/libs/actions/HybridApp.ts index 9bf7c79694a1..db9dd1b08584 100644 --- a/src/libs/actions/HybridApp.ts +++ b/src/libs/actions/HybridApp.ts @@ -25,4 +25,8 @@ function setUseNewDotSignInPage(useNewDotSignInPage: boolean) { Onyx.merge(ONYXKEYS.HYBRID_APP, {useNewDotSignInPage}); } -export {setOldDotSignInError, setIsSigningIn, setReadyToShowAuthScreens, setReadyToSwitchToClassicExperience, setShouldResetSigningInLogic, setUseNewDotSignInPage}; +function setLoggedOutFromOldDot(loggedOutFromOldDot: boolean) { + Onyx.merge(ONYXKEYS.HYBRID_APP, {loggedOutFromOldDot}); +} + +export {setOldDotSignInError, setIsSigningIn, setReadyToShowAuthScreens, setReadyToSwitchToClassicExperience, setShouldResetSigningInLogic, setUseNewDotSignInPage, setLoggedOutFromOldDot}; diff --git a/src/libs/actions/Session/index.ts b/src/libs/actions/Session/index.ts index 81d61530bcce..91e597d10164 100644 --- a/src/libs/actions/Session/index.ts +++ b/src/libs/actions/Session/index.ts @@ -42,7 +42,7 @@ import {hideContextMenu} from '@pages/home/report/ContextMenu/ReportActionContex import * as App from '@userActions/App'; import {KEYS_TO_PRESERVE, openApp} from '@userActions/App'; import * as Device from '@userActions/Device'; -import {setReadyToShowAuthScreens, setReadyToSwitchToClassicExperience, setUseNewDotSignInPage} from '@userActions/HybridApp'; +import {setLoggedOutFromOldDot, setReadyToShowAuthScreens, setReadyToSwitchToClassicExperience, setUseNewDotSignInPage} from '@userActions/HybridApp'; import * as PriorityMode from '@userActions/PriorityMode'; import redirectToSignIn from '@userActions/SignInRedirect'; import Timing from '@userActions/Timing'; @@ -482,14 +482,14 @@ function signUpUser() { function signInAfterTransitionFromOldDot(transitionURL: string) { const [route, queryParams] = transitionURL.split('?'); - const {useNewDotSignInPage, isSingleNewDotEntry} = queryParams + const {useNewDotSignInPage, isSingleNewDotEntry, loggedOutFromOldDot} = queryParams ? Object.fromEntries( queryParams.split('&').map((param) => { const [key, value] = param.split('='); return [key, value]; }), ) - : {useNewDotSignInPage: undefined, isSingleNewDotEntry: undefined}; + : {useNewDotSignInPage: undefined, isSingleNewDotEntry: undefined, loggedOutFromOldDot: undefined}; const clearOnyxBeforeSignIn = () => { if (useNewDotSignInPage !== 'true') { @@ -513,6 +513,7 @@ function signInAfterTransitionFromOldDot(transitionURL: string) { clearOnyxBeforeSignIn() .then(() => { setUseNewDotSignInPage(useNewDotSignInPage === 'true'); + setLoggedOutFromOldDot(loggedOutFromOldDot === 'true'); const useOldDot = 'true'; const dismissed = useNewDotSignInPage === 'true' ? useOldDot : 'false'; Onyx.multiSet({ diff --git a/src/types/onyx/HybridApp.ts b/src/types/onyx/HybridApp.ts index 8e248f4148b4..d77412caaf37 100644 --- a/src/types/onyx/HybridApp.ts +++ b/src/types/onyx/HybridApp.ts @@ -17,6 +17,9 @@ type HybridApp = { /** */ shouldResetSigningInLogic?: boolean; + + /** stores infromation if last log out was performed from OldDot */ + loggedOutFromOldDot?: boolean; }; export default HybridApp;