From 320de61a509fbcae1ec5d2eba540b0be5b33b855 Mon Sep 17 00:00:00 2001 From: war-in Date: Mon, 2 Sep 2024 16:11:57 +0200 Subject: [PATCH] move ready to be hidden to InitialURLContextProvider --- src/components/InitialURLContextProvider.tsx | 4 +++- src/libs/actions/Session/index.ts | 8 ++------ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/components/InitialURLContextProvider.tsx b/src/components/InitialURLContextProvider.tsx index f3f9578a1ac5..01fbae7f3eb3 100644 --- a/src/components/InitialURLContextProvider.tsx +++ b/src/components/InitialURLContextProvider.tsx @@ -2,6 +2,7 @@ import React, {createContext, useEffect, useState} from 'react'; import type {ReactNode} from 'react'; import {Linking} from 'react-native'; import {signInAfterTransitionFromOldDot} from '@libs/actions/Session'; +import CONST from '@src/CONST'; import type {Route} from '@src/ROUTES'; import {useSplashScreenStateContext} from '@src/SplashScreenStateContext'; @@ -22,8 +23,9 @@ function InitialURLContextProvider({children, url}: InitialURLContextProviderPro useEffect(() => { if (url) { - signInAfterTransitionFromOldDot(url, setSplashScreenState); + signInAfterTransitionFromOldDot(url); setInitialURL(url); + setSplashScreenState(CONST.BOOT_SPLASH_STATE.READY_TO_BE_HIDDEN); return; } Linking.getInitialURL().then((initURL) => { diff --git a/src/libs/actions/Session/index.ts b/src/libs/actions/Session/index.ts index ab191e85fb05..6c821189e593 100644 --- a/src/libs/actions/Session/index.ts +++ b/src/libs/actions/Session/index.ts @@ -461,7 +461,7 @@ function signUpUser() { API.write(WRITE_COMMANDS.SIGN_UP_USER, params, {optimisticData, successData, failureData}); } -function signInAfterTransitionFromOldDot(transitionURL: string, setSplashScreenState: React.Dispatch>>) { +function signInAfterTransitionFromOldDot(transitionURL: string) { const queryParams = transitionURL.split('?')[1]; const {email, authToken, accountID, autoGeneratedLogin, autoGeneratedPassword, shouldClearOnyxOnStart} = Object.fromEntries( @@ -479,12 +479,8 @@ function signInAfterTransitionFromOldDot(transitionURL: string, setSplashScreenS }; if (shouldClearOnyxOnStart === 'true') { - Onyx.clear(KEYS_TO_PRESERVE).then(() => { - setSplashScreenState(CONST.BOOT_SPLASH_STATE.READY_TO_BE_HIDDEN); - setSessionDataAndOpenApp(); - }); + Onyx.clear(KEYS_TO_PRESERVE).then(setSessionDataAndOpenApp); } else { - setSplashScreenState(CONST.BOOT_SPLASH_STATE.READY_TO_BE_HIDDEN); setSessionDataAndOpenApp(); } }