From 2a04de5be10133b01a0a417260280f8087284749 Mon Sep 17 00:00:00 2001 From: Jasper Huang Date: Mon, 13 Mar 2023 12:33:34 -0400 Subject: [PATCH 1/5] Always call OpenReport when deeplinking within the app --- src/pages/home/ReportScreen.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/pages/home/ReportScreen.js b/src/pages/home/ReportScreen.js index d0de441dd08f..4051979a6ace 100644 --- a/src/pages/home/ReportScreen.js +++ b/src/pages/home/ReportScreen.js @@ -125,7 +125,10 @@ class ReportScreen extends React.Component { } componentDidUpdate(prevProps) { - if (this.props.route.params.reportID === prevProps.route.params.reportID) { + if (this.props.report.isLoadingReportActions) { + return; + } + if (this.props.report.reportID && this.props.route.params.reportID === prevProps.route.params.reportID) { return; } From 5119171646efc983aa3436791d7b13f6ff2ab969 Mon Sep 17 00:00:00 2001 From: Jasper Huang Date: Mon, 13 Mar 2023 13:10:08 -0400 Subject: [PATCH 2/5] call openReport when navigating to deeplinks within the App --- .../HTMLEngineProvider/HTMLRenderers/AnchorRenderer.js | 3 +++ src/pages/home/ReportScreen.js | 7 ++----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/components/HTMLEngineProvider/HTMLRenderers/AnchorRenderer.js b/src/components/HTMLEngineProvider/HTMLRenderers/AnchorRenderer.js index e966d38ab6cf..776e983b6eea 100644 --- a/src/components/HTMLEngineProvider/HTMLRenderers/AnchorRenderer.js +++ b/src/components/HTMLEngineProvider/HTMLRenderers/AnchorRenderer.js @@ -14,6 +14,7 @@ import styles from '../../../styles/styles'; import Navigation from '../../../libs/Navigation/Navigation'; import AnchorForCommentsOnly from '../../AnchorForCommentsOnly'; import AnchorForAttachmentsOnly from '../../AnchorForAttachmentsOnly'; +import {openReport} from '../../../libs/actions/Report'; import * as Url from '../../../libs/Url'; import ROUTES from '../../../ROUTES'; @@ -47,6 +48,8 @@ const AnchorRenderer = (props) => { // If we are handling a New Expensify link then we will assume this should be opened by the app internally. This ensures that the links are opened internally via react-navigation // instead of in a new tab or with a page refresh (which is the default behavior of an anchor tag) if (internalNewExpensifyPath) { + const reportID = attrPath.split('r/').pop(); + openReport(reportID); Navigation.navigate(internalNewExpensifyPath); return; } diff --git a/src/pages/home/ReportScreen.js b/src/pages/home/ReportScreen.js index 4051979a6ace..5ef7531cbcf7 100644 --- a/src/pages/home/ReportScreen.js +++ b/src/pages/home/ReportScreen.js @@ -125,10 +125,7 @@ class ReportScreen extends React.Component { } componentDidUpdate(prevProps) { - if (this.props.report.isLoadingReportActions) { - return; - } - if (this.props.report.reportID && this.props.route.params.reportID === prevProps.route.params.reportID) { + if (this.props.route.params.reportID === prevProps.route.params.reportID) { return; } @@ -224,7 +221,7 @@ class ReportScreen extends React.Component { )} > Date: Mon, 13 Mar 2023 13:42:42 -0400 Subject: [PATCH 3/5] style --- .../HTMLEngineProvider/HTMLRenderers/AnchorRenderer.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/HTMLEngineProvider/HTMLRenderers/AnchorRenderer.js b/src/components/HTMLEngineProvider/HTMLRenderers/AnchorRenderer.js index 776e983b6eea..10ddee284ff6 100644 --- a/src/components/HTMLEngineProvider/HTMLRenderers/AnchorRenderer.js +++ b/src/components/HTMLEngineProvider/HTMLRenderers/AnchorRenderer.js @@ -14,7 +14,7 @@ import styles from '../../../styles/styles'; import Navigation from '../../../libs/Navigation/Navigation'; import AnchorForCommentsOnly from '../../AnchorForCommentsOnly'; import AnchorForAttachmentsOnly from '../../AnchorForAttachmentsOnly'; -import {openReport} from '../../../libs/actions/Report'; +import * as Report from '../../../libs/actions/Report'; import * as Url from '../../../libs/Url'; import ROUTES from '../../../ROUTES'; @@ -49,7 +49,7 @@ const AnchorRenderer = (props) => { // instead of in a new tab or with a page refresh (which is the default behavior of an anchor tag) if (internalNewExpensifyPath) { const reportID = attrPath.split('r/').pop(); - openReport(reportID); + Report.openReport(reportID); Navigation.navigate(internalNewExpensifyPath); return; } From e24fce5b64571ee0fa4d62b94215f2f65f64b9d1 Mon Sep 17 00:00:00 2001 From: Jasper Huang Date: Mon, 13 Mar 2023 14:03:45 -0400 Subject: [PATCH 4/5] handle other url formats --- .../HTMLEngineProvider/HTMLRenderers/AnchorRenderer.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/components/HTMLEngineProvider/HTMLRenderers/AnchorRenderer.js b/src/components/HTMLEngineProvider/HTMLRenderers/AnchorRenderer.js index 10ddee284ff6..7cacb5d72397 100644 --- a/src/components/HTMLEngineProvider/HTMLRenderers/AnchorRenderer.js +++ b/src/components/HTMLEngineProvider/HTMLRenderers/AnchorRenderer.js @@ -48,8 +48,11 @@ const AnchorRenderer = (props) => { // If we are handling a New Expensify link then we will assume this should be opened by the app internally. This ensures that the links are opened internally via react-navigation // instead of in a new tab or with a page refresh (which is the default behavior of an anchor tag) if (internalNewExpensifyPath) { - const reportID = attrPath.split('r/').pop(); - Report.openReport(reportID); + if (attrPath.indexOf('r/') !== -1) { + const reportID = attrPath.split('/')[1]; + Report.openReport(reportID); + } + Navigation.navigate(internalNewExpensifyPath); return; } From 63aa70158603cb186478beac6455e732c547ab0e Mon Sep 17 00:00:00 2001 From: Jasper Huang Date: Mon, 13 Mar 2023 14:04:00 -0400 Subject: [PATCH 5/5] handle other url formats --- .../HTMLEngineProvider/HTMLRenderers/AnchorRenderer.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/HTMLEngineProvider/HTMLRenderers/AnchorRenderer.js b/src/components/HTMLEngineProvider/HTMLRenderers/AnchorRenderer.js index 7cacb5d72397..cac01ca0b238 100644 --- a/src/components/HTMLEngineProvider/HTMLRenderers/AnchorRenderer.js +++ b/src/components/HTMLEngineProvider/HTMLRenderers/AnchorRenderer.js @@ -48,7 +48,7 @@ const AnchorRenderer = (props) => { // If we are handling a New Expensify link then we will assume this should be opened by the app internally. This ensures that the links are opened internally via react-navigation // instead of in a new tab or with a page refresh (which is the default behavior of an anchor tag) if (internalNewExpensifyPath) { - if (attrPath.indexOf('r/') !== -1) { + if (attrPath.indexOf('r/') === 0) { const reportID = attrPath.split('/')[1]; Report.openReport(reportID); }