Skip to content

Commit b145bce

Browse files
Merge branch 'Expensify:main' into PiyushChandra17/refactor/splitphrase/preventFutureActivity
2 parents dcea80c + 5a66345 commit b145bce

3 files changed

Lines changed: 9 additions & 25 deletions

File tree

src/Expensify.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,10 @@ function Expensify() {
202202

203203
// If the app is opened from a deep link, get the reportID (if exists) from the deep link and navigate to the chat report
204204
Linking.getInitialURL().then((url) => {
205+
// We use custom deeplink handler in setup/hybridApp
206+
if (CONFIG.IS_HYBRID_APP) {
207+
return;
208+
}
205209
setInitialUrl(url);
206210
Report.openReportFromDeepLink(url ?? '');
207211
});

src/libs/actions/Report.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3407,7 +3407,7 @@ function openReportFromDeepLink(url: string) {
34073407
// We don't want to navigate to the exitTo route when creating a new workspace from a deep link,
34083408
// because we already handle creating the optimistic policy and navigating to it in App.setUpPoliciesAndNavigate,
34093409
// which is already called when AuthScreens mounts.
3410-
if (url && new URL(url).searchParams.get('exitTo') === ROUTES.WORKSPACE_NEW) {
3410+
if (!CONFIG.IS_HYBRID_APP && url && new URL(url).searchParams.get('exitTo') === ROUTES.WORKSPACE_NEW) {
34113411
return;
34123412
}
34133413

@@ -3428,10 +3428,6 @@ function openReportFromDeepLink(url: string) {
34283428
return;
34293429
}
34303430

3431-
if (isAuthenticated) {
3432-
return;
3433-
}
3434-
34353431
// Check if the report exists in the collection
34363432
const report = allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${reportID}`];
34373433
// If the report does not exist, navigate to the last accessed report or Concierge chat
Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,12 @@
1-
import {findFocusedRoute} from '@react-navigation/native';
21
import {Linking} from 'react-native';
3-
import Navigation, {navigationRef} from '@navigation/Navigation';
2+
import Navigation from '@navigation/Navigation';
3+
import {openReportFromDeepLink} from '@userActions/Report';
44
import CONFIG from '@src/CONFIG';
55
import type {Route} from '@src/ROUTES';
6-
import ROUTES from '@src/ROUTES';
7-
import SCREENS from '@src/SCREENS';
86

97
if (CONFIG.IS_HYBRID_APP) {
108
Linking.addEventListener('url', (state) => {
11-
handleHybridUrlNavigation(state.url as Route);
12-
});
13-
}
14-
15-
function handleHybridUrlNavigation(url: Route) {
16-
const parsedUrl = Navigation.parseHybridAppUrl(url);
17-
18-
Navigation.isNavigationReady().then(() => {
19-
if (parsedUrl.startsWith(`/${ROUTES.SHARE_ROOT}`)) {
20-
const focusRoute = findFocusedRoute(navigationRef.getRootState());
21-
if (focusRoute?.name === SCREENS.SHARE.SHARE_DETAILS || focusRoute?.name === SCREENS.SHARE.SUBMIT_DETAILS) {
22-
Navigation.goBack(ROUTES.SHARE_ROOT);
23-
return;
24-
}
25-
}
26-
Navigation.navigate(parsedUrl);
9+
const parsedUrl = Navigation.parseHybridAppUrl(state.url as Route);
10+
openReportFromDeepLink(parsedUrl);
2711
});
2812
}

0 commit comments

Comments
 (0)