Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update handling so that Concierge link redirects to chat #11527

Merged
merged 5 commits into from
Oct 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions src/components/WalletStatementModal/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand All @@ -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();
}
}

Expand Down
21 changes: 14 additions & 7 deletions src/components/WalletStatementModal/index.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand All @@ -22,18 +23,24 @@ class WalletStatementModal extends React.Component {
/**
* Handles in-app navigation for webview links
*
* @param {Object} params
* @param {String} params.type
* @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();
}
}

Expand Down