From eeb49cbf381f786700b6780d9e52af7dd75d141d Mon Sep 17 00:00:00 2001 From: Jack Nam Date: Mon, 3 Oct 2022 15:19:25 +0900 Subject: [PATCH 1/4] Update index.js --- src/components/WalletStatementModal/index.js | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/components/WalletStatementModal/index.js b/src/components/WalletStatementModal/index.js index 762bed5b6296..5a912498cd43 100644 --- a/src/components/WalletStatementModal/index.js +++ b/src/components/WalletStatementModal/index.js @@ -9,6 +9,7 @@ import ONYXKEYS from '../../ONYXKEYS'; import {walletStatementPropTypes, walletStatementDefaultProps} from './WalletStatementModalPropTypes'; import styles from '../../styles/styles'; import FullScreenLoadingIndicator from '../FullscreenLoadingIndicator'; +import * as Report from '../../libs/actions/Report'; import ROUTES from '../../ROUTES'; import Navigation from '../../libs/Navigation/Navigation'; @@ -27,13 +28,18 @@ class WalletStatementModal extends React.Component { * @param {MessageEvent} e */ navigate(e) { - if (!e.data || e.data.type !== 'STATEMENT_NAVIGATE' || !e.data.url) { + if (!e.data || !e.data.type || (e.data.type !== 'STATEMENT_NAVIGATE' && e.data.type !== 'CONCIERGE_NAVIGATE')) { return; } - const iouRoutes = [ROUTES.IOU_REQUEST, ROUTES.IOU_SEND, ROUTES.IOU_BILL]; - const navigateToIOURoute = _.find(iouRoutes, iouRoute => e.data.url.includes(iouRoute)); - if (navigateToIOURoute) { - Navigation.navigate(navigateToIOURoute); + + if (e.data.type === 'STATEMENT_NAVIGATE' && e.data.url) { + const iouRoutes = [ROUTES.IOU_REQUEST, ROUTES.IOU_SEND, ROUTES.IOU_BILL]; + const navigateToIOURoute = _.find(iouRoutes, iouRoute => e.data.url.includes(iouRoute)); + if (navigateToIOURoute) { + Navigation.navigate(navigateToIOURoute); + } + } else if (e.data.type === 'CONCIERGE_NAVIGATE') { + Report.navigateToConciergeChat(); } } From c5da2f26cec22ea7b25c54647c4db341c3368fed Mon Sep 17 00:00:00 2001 From: Jack Nam Date: Mon, 3 Oct 2022 15:31:13 +0900 Subject: [PATCH 2/4] remove trailing spaces --- src/components/WalletStatementModal/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/WalletStatementModal/index.js b/src/components/WalletStatementModal/index.js index 5a912498cd43..2f6d0ca387a1 100644 --- a/src/components/WalletStatementModal/index.js +++ b/src/components/WalletStatementModal/index.js @@ -31,7 +31,7 @@ class WalletStatementModal extends React.Component { if (!e.data || !e.data.type || (e.data.type !== 'STATEMENT_NAVIGATE' && e.data.type !== 'CONCIERGE_NAVIGATE')) { return; } - + if (e.data.type === 'STATEMENT_NAVIGATE' && e.data.url) { const iouRoutes = [ROUTES.IOU_REQUEST, ROUTES.IOU_SEND, ROUTES.IOU_BILL]; const navigateToIOURoute = _.find(iouRoutes, iouRoute => e.data.url.includes(iouRoute)); From d87b821d839eac4c187761ac834730a6262a5309 Mon Sep 17 00:00:00 2001 From: Jack Nam Date: Thu, 13 Oct 2022 18:23:56 +0900 Subject: [PATCH 3/4] replicate changes to index.native --- .../WalletStatementModal/index.native.js | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/components/WalletStatementModal/index.native.js b/src/components/WalletStatementModal/index.native.js index 9c525a12420c..6528aff3fb97 100644 --- a/src/components/WalletStatementModal/index.native.js +++ b/src/components/WalletStatementModal/index.native.js @@ -8,6 +8,7 @@ import ONYXKEYS from '../../ONYXKEYS'; import compose from '../../libs/compose'; import {walletStatementPropTypes, walletStatementDefaultProps} from './WalletStatementModalPropTypes'; import FullScreenLoadingIndicator from '../FullscreenLoadingIndicator'; +import * as Report from '../../libs/actions/Report'; import Navigation from '../../libs/Navigation/Navigation'; import ROUTES from '../../ROUTES'; @@ -25,15 +26,21 @@ class WalletStatementModal extends React.Component { * @param {Object} params * @param {String} params.url */ - navigate({url}) { - if (!this.webview || !url) { + navigate({type, url}) { + if (!this.webview || (type !== 'STATEMENT_NAVIGATE' && type !== 'CONCIERGE_NAVIGATE')) { return; } - const iouRoutes = [ROUTES.IOU_REQUEST, ROUTES.IOU_SEND, ROUTES.IOU_BILL]; - const navigateToIOURoute = _.find(iouRoutes, iouRoute => url.includes(iouRoute)); - if (navigateToIOURoute) { + + if (type === 'STATEMENT_NAVIGATE' && url) { + const iouRoutes = [ROUTES.IOU_REQUEST, ROUTES.IOU_SEND, ROUTES.IOU_BILL]; + const navigateToIOURoute = _.find(iouRoutes, iouRoute => url.includes(iouRoute)); + if (navigateToIOURoute) { + this.webview.stopLoading(); + Navigation.navigate(navigateToIOURoute); + } + } else if (type === 'CONCIERGE_NAVIGATE') { this.webview.stopLoading(); - Navigation.navigate(navigateToIOURoute); + Report.navigateToConciergeChat(); } } From 6083edaf9539684b58684bd2f11c0c2ebcafb6a3 Mon Sep 17 00:00:00 2001 From: Jack Nam Date: Fri, 14 Oct 2022 11:08:37 +0900 Subject: [PATCH 4/4] address type comment --- src/components/WalletStatementModal/index.native.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/WalletStatementModal/index.native.js b/src/components/WalletStatementModal/index.native.js index 6528aff3fb97..bbbd1bb4f636 100644 --- a/src/components/WalletStatementModal/index.native.js +++ b/src/components/WalletStatementModal/index.native.js @@ -23,7 +23,7 @@ class WalletStatementModal extends React.Component { /** * Handles in-app navigation for webview links * - * @param {Object} params + * @param {String} params.type * @param {String} params.url */ navigate({type, url}) {