From 1eaaf8be26b29aad660e26d05ee8a78f9076edc8 Mon Sep 17 00:00:00 2001 From: tienifr Date: Wed, 29 Nov 2023 11:15:14 +0700 Subject: [PATCH 1/3] add dekstop app origin to linking prefix --- src/libs/Navigation/linkingConfig.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/libs/Navigation/linkingConfig.ts b/src/libs/Navigation/linkingConfig.ts index ae48d8e49201..52d42410266f 100644 --- a/src/libs/Navigation/linkingConfig.ts +++ b/src/libs/Navigation/linkingConfig.ts @@ -7,7 +7,16 @@ import SCREENS from '@src/SCREENS'; import {RootStackParamList} from './types'; const linkingConfig: LinkingOptions = { - prefixes: ['new-expensify://', 'https://www.expensify.cash', 'https://staging.expensify.cash', 'https://dev.new.expensify.com', CONST.NEW_EXPENSIFY_URL, CONST.STAGING_NEW_EXPENSIFY_URL], + prefixes: [ + 'app://-/', + 'new-expensify://', + 'https://www.expensify.cash', + 'https://staging.expensify.cash', + 'https://dev.new.expensify.com', + 'https://127.0.0.1', + CONST.NEW_EXPENSIFY_URL, + CONST.STAGING_NEW_EXPENSIFY_URL, + ], config: { initialRouteName: SCREENS.HOME, screens: { From 9ca0a508bf6c7692e41119d9348c7da90522b940 Mon Sep 17 00:00:00 2001 From: tienifr Date: Wed, 29 Nov 2023 11:43:10 +0700 Subject: [PATCH 2/3] fix link prefix on mweb android --- src/libs/Navigation/linkingConfig.ts | 1 - src/libs/ReportUtils.ts | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/libs/Navigation/linkingConfig.ts b/src/libs/Navigation/linkingConfig.ts index 52d42410266f..f15e00009e1c 100644 --- a/src/libs/Navigation/linkingConfig.ts +++ b/src/libs/Navigation/linkingConfig.ts @@ -13,7 +13,6 @@ const linkingConfig: LinkingOptions = { 'https://www.expensify.cash', 'https://staging.expensify.cash', 'https://dev.new.expensify.com', - 'https://127.0.0.1', CONST.NEW_EXPENSIFY_URL, CONST.STAGING_NEW_EXPENSIFY_URL, ], diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index d93661778b83..83615ace9e9e 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -3592,7 +3592,7 @@ function getRouteFromLink(url: string | null): string { // Get the reportID from URL let route = url; linkingConfig.prefixes.forEach((prefix) => { - const localWebAndroidRegEx = /^(http:\/\/([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3}))/; + const localWebAndroidRegEx = /^(https:\/\/([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3}))/; if (route.startsWith(prefix)) { route = route.replace(prefix, ''); } else if (localWebAndroidRegEx.test(route)) { From 2ee09dbc674302c0daf23eddc20ea78dd3bb099b Mon Sep 17 00:00:00 2001 From: tienifr Date: Wed, 6 Dec 2023 14:38:59 +0700 Subject: [PATCH 3/3] move regex outside loop --- src/libs/ReportUtils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index f3ced9e781b5..52444a558214 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -3631,8 +3631,8 @@ function getRouteFromLink(url: string | null): string { // Get the reportID from URL let route = url; + const localWebAndroidRegEx = /^(https:\/\/([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3}))/; linkingConfig.prefixes.forEach((prefix) => { - const localWebAndroidRegEx = /^(https:\/\/([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3}))/; if (route.startsWith(prefix)) { route = route.replace(prefix, ''); } else if (localWebAndroidRegEx.test(route)) {