diff --git a/src/libs/HybridApp.ts b/src/libs/HybridApp.ts index 257516ddef74..c97c3b6563e3 100644 --- a/src/libs/HybridApp.ts +++ b/src/libs/HybridApp.ts @@ -68,11 +68,6 @@ function handleChangeInHybridAppSignInFlow(hybridApp: OnyxEntry, tryN } if (hybridApp?.newDotSignInState === CONST.HYBRID_APP_SIGN_IN_STATE.FINISHED && tryNewDot !== undefined) { - if (!shouldUseOldApp(tryNewDot)) { - Log.info('[HybridApp] The user should see NewDot. There is no need to block the user on the `SignInPage` until the sign-in process is completed on the OldDot side.'); - HybridAppActions.setReadyToShowAuthScreens(true); - } - Log.info(`[HybridApp] Performing sign-in${shouldUseOldApp(tryNewDot) ? '' : ' (in background)'} on OldDot side`); NativeModules.HybridAppModule.signInToOldDot( credentials?.autoGeneratedLogin ?? '', @@ -85,11 +80,12 @@ function handleChangeInHybridAppSignInFlow(hybridApp: OnyxEntry, tryN ); if (shouldUseOldApp(tryNewDot)) { - Onyx.merge(ONYXKEYS.HYBRID_APP, { - useNewDotSignInPage: false, - }).then(() => { + HybridAppActions.setUseNewDotSignInPage(false).then(() => { NativeModules.HybridAppModule.closeReactNativeApp(false, false); }); + } else { + Log.info('[HybridApp] The user should see NewDot. There is no need to block the user on the `SignInPage` until the sign-in process is completed on the OldDot side.'); + HybridAppActions.setReadyToShowAuthScreens(true); } } diff --git a/src/libs/Navigation/AppNavigator/PublicScreens.tsx b/src/libs/Navigation/AppNavigator/PublicScreens.tsx index fa880a5246f2..3a4e867e8e84 100644 --- a/src/libs/Navigation/AppNavigator/PublicScreens.tsx +++ b/src/libs/Navigation/AppNavigator/PublicScreens.tsx @@ -1,5 +1,4 @@ import React from 'react'; -import {NativeModules} from 'react-native'; import createPlatformStackNavigator from '@libs/Navigation/PlatformStackNavigation/createPlatformStackNavigator'; import type {PublicScreensParamList} from '@navigation/types'; import ConnectionCompletePage from '@pages/ConnectionCompletePage'; diff --git a/src/libs/actions/HybridApp/index.ts b/src/libs/actions/HybridApp/index.ts index b90152c6fc09..3b3d5458c30d 100644 --- a/src/libs/actions/HybridApp/index.ts +++ b/src/libs/actions/HybridApp/index.ts @@ -27,23 +27,15 @@ function setNewDotSignInState(newDotSignInState: ValueOf { Onyx.merge(ONYXKEYS.SESSION, {errors: ErrorUtils.getMicroSecondOnyxErrorWithMessage(errorMessage)}); if (NativeModules.HybridAppModule) { - HybridAppActions.resetStateAfterSignOut(); + HybridAppActions.resetSignInFlow(); } }); } diff --git a/src/pages/settings/InitialSettingsPage.tsx b/src/pages/settings/InitialSettingsPage.tsx index 85c85ecbaf2b..20dd27499049 100755 --- a/src/pages/settings/InitialSettingsPage.tsx +++ b/src/pages/settings/InitialSettingsPage.tsx @@ -239,9 +239,7 @@ function InitialSettingsPage({currentUserPersonalDetails}: InitialSettingsPagePr ...(NativeModules.HybridAppModule ? { action: () => { - Onyx.merge(ONYXKEYS.HYBRID_APP, { - useNewDotSignInPage: false, - }).then(() => { + HybridAppActions.setUseNewDotSignInPage(false).then(() => { NativeModules.HybridAppModule.closeReactNativeApp(false, true); setInitialURL(undefined); }); @@ -279,7 +277,7 @@ function InitialSettingsPage({currentUserPersonalDetails}: InitialSettingsPagePr icon: Expensicons.Exit, action: () => { signOut(false); - HybridAppActions.resetStateAfterSignOut(); + HybridAppActions.resetSignInFlow(); }, }, ], diff --git a/src/pages/signin/ValidateCodeForm/BaseValidateCodeForm.tsx b/src/pages/signin/ValidateCodeForm/BaseValidateCodeForm.tsx index df1e29b60bb9..64b4d83284a6 100755 --- a/src/pages/signin/ValidateCodeForm/BaseValidateCodeForm.tsx +++ b/src/pages/signin/ValidateCodeForm/BaseValidateCodeForm.tsx @@ -181,7 +181,7 @@ function BaseValidateCodeForm({autoComplete, isUsingRecoveryCode, setIsUsingReco const clearSignInData = useCallback(() => { clearLocalSignInData(); SessionActions.clearSignInData(); - }, [clearLocalSignInData, session?.authToken]); + }, [clearLocalSignInData]); useImperativeHandle(forwardedRef, () => ({ clearSignInData,