Skip to content

Commit

Permalink
Merge pull request #52793 from Expensify/revert-52694-loading-skeleto…
Browse files Browse the repository at this point in the history
…n-when-notification-tapped-ND

(cherry picked from commit b4830af)

(CP triggered by mountiny)
  • Loading branch information
mountiny authored and OSBotify committed Nov 20, 2024
1 parent aee19a2 commit 8e5d586
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 18 deletions.
12 changes: 3 additions & 9 deletions src/components/InitialURLContextProvider.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import React, {createContext, useEffect, useMemo, useState} from 'react';
import type {ReactNode} from 'react';
import {Linking} from 'react-native';
import {useOnyx} from 'react-native-onyx';
import {signInAfterTransitionFromOldDot} from '@libs/actions/Session';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import type {Route} from '@src/ROUTES';
import {useSplashScreenStateContext} from '@src/SplashScreenStateContext';

Expand All @@ -30,13 +28,10 @@ type InitialURLContextProviderProps = {
function InitialURLContextProvider({children, url}: InitialURLContextProviderProps) {
const [initialURL, setInitialURL] = useState<Route | undefined>();
const {setSplashScreenState} = useSplashScreenStateContext();
const [initialLastUpdateIDAppliedToClient, metadata] = useOnyx(ONYXKEYS.ONYX_UPDATES_LAST_UPDATE_ID_APPLIED_TO_CLIENT);

useEffect(() => {
if (metadata.status !== 'loaded') {
return;
}
if (url) {
signInAfterTransitionFromOldDot(url, initialLastUpdateIDAppliedToClient).then((route) => {
signInAfterTransitionFromOldDot(url).then((route) => {
setInitialURL(route);
setSplashScreenState(CONST.BOOT_SPLASH_STATE.READY_TO_BE_HIDDEN);
});
Expand All @@ -45,7 +40,7 @@ function InitialURLContextProvider({children, url}: InitialURLContextProviderPro
Linking.getInitialURL().then((initURL) => {
setInitialURL(initURL as Route);
});
}, [initialLastUpdateIDAppliedToClient, metadata.status, setSplashScreenState, url]);
}, [setSplashScreenState, url]);

const initialUrlContext = useMemo(
() => ({
Expand All @@ -61,5 +56,4 @@ function InitialURLContextProvider({children, url}: InitialURLContextProviderPro
InitialURLContextProvider.displayName = 'InitialURLContextProvider';

export default InitialURLContextProvider;

export {InitialURLContext};
11 changes: 2 additions & 9 deletions src/libs/actions/Session/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ function signUpUser() {
API.write(WRITE_COMMANDS.SIGN_UP_USER, params, {optimisticData, successData, failureData});
}

function signInAfterTransitionFromOldDot(transitionURL: string, lastUpdateId?: number) {
function signInAfterTransitionFromOldDot(transitionURL: string) {
const [route, queryParams] = transitionURL.split('?');

const {
Expand Down Expand Up @@ -528,14 +528,7 @@ function signInAfterTransitionFromOldDot(transitionURL: string, lastUpdateId?: n
[ONYXKEYS.NVP_TRYNEWDOT]: {classicRedirect: {completedHybridAppOnboarding: completedHybridAppOnboarding === 'true'}},
}),
)
.then(() => {
if (clearOnyxOnStart === 'true') {
// We clear Onyx when this flag is set to true so we have to download all data
App.openApp();
} else {
App.reconnectApp(lastUpdateId);
}
})
.then(App.openApp)
.catch((error) => {
Log.hmmm('[HybridApp] Initialization of HybridApp has failed. Forcing transition', {error});
})
Expand Down

0 comments on commit 8e5d586

Please sign in to comment.