1- import { findFocusedRoute } from '@react-navigation/native' ;
21import React , { createContext , useEffect , useMemo , useState } from 'react' ;
32import type { ReactNode } from 'react' ;
43import { Linking } from 'react-native' ;
5- import { signInAfterTransitionFromOldDot } from '@libs/actions/Session' ;
6- import Navigation , { navigationRef } from '@navigation/Navigation' ;
74import type { AppProps } from '@src/App' ;
8- import CONST from '@src/CONST' ;
95import type { Route } from '@src/ROUTES' ;
10- import ROUTES from '@src/ROUTES' ;
11- import SCREENS from '@src/SCREENS' ;
12- import { useSplashScreenStateContext } from '@src/SplashScreenStateContext' ;
136
147type InitialUrlContextType = {
158 initialURL : Route | undefined ;
@@ -27,40 +20,18 @@ type InitialURLContextProviderProps = AppProps & {
2720 children : ReactNode ;
2821} ;
2922
30- function InitialURLContextProvider ( { children, url, hybridAppSettings , timestamp } : InitialURLContextProviderProps ) {
23+ function InitialURLContextProvider ( { children, url} : InitialURLContextProviderProps ) {
3124 const [ initialURL , setInitialURL ] = useState < Route | undefined > ( ) ;
32- const { splashScreenState, setSplashScreenState} = useSplashScreenStateContext ( ) ;
3325
3426 useEffect ( ( ) => {
35- if ( url && hybridAppSettings ) {
36- signInAfterTransitionFromOldDot ( hybridAppSettings ) . then ( ( ) => {
37- setInitialURL ( url ) ;
38-
39- const parsedUrl = Navigation . parseHybridAppUrl ( url ) ;
40-
41- Navigation . isNavigationReady ( ) . then ( ( ) => {
42- if ( parsedUrl . startsWith ( `/${ ROUTES . SHARE_ROOT } ` ) ) {
43- const focusRoute = findFocusedRoute ( navigationRef . getRootState ( ) ) ;
44- if ( focusRoute ?. name === SCREENS . SHARE . SHARE_DETAILS || focusRoute ?. name === SCREENS . SHARE . SUBMIT_DETAILS ) {
45- Navigation . goBack ( ROUTES . SHARE_ROOT ) ;
46- return ;
47- }
48- }
49- Navigation . navigate ( parsedUrl ) ;
50- } ) ;
51-
52- if ( splashScreenState === CONST . BOOT_SPLASH_STATE . HIDDEN ) {
53- return ;
54- }
55- setSplashScreenState ( CONST . BOOT_SPLASH_STATE . READY_TO_BE_HIDDEN ) ;
56- } ) ;
27+ if ( url ) {
28+ setInitialURL ( url ) ;
5729 return ;
5830 }
5931 Linking . getInitialURL ( ) . then ( ( initURL ) => {
6032 setInitialURL ( initURL as Route ) ;
6133 } ) ;
62- // eslint-disable-next-line react-compiler/react-compiler, react-hooks/exhaustive-deps
63- } , [ url , hybridAppSettings , timestamp ] ) ;
34+ } , [ url ] ) ;
6435
6536 const initialUrlContext = useMemo (
6637 ( ) => ( {
0 commit comments