diff --git a/src/CONST.js b/src/CONST.js index e328072a077c..dc6bc5e49432 100755 --- a/src/CONST.js +++ b/src/CONST.js @@ -1,4 +1,5 @@ const CLOUDFRONT_URL = 'https://d2k5nsl2zxldvw.cloudfront.net'; +const NEW_EXPENSIFY_URL = 'https://new.expensify.com'; const CONST = { // 50 megabytes in bytes @@ -6,7 +7,7 @@ const CONST = { APP_DOWNLOAD_LINKS: { ANDROID: 'https://play.google.com/store/apps/details?id=com.expensify.chat', IOS: 'https://apps.apple.com/us/app/expensify-cash/id1530278510', - DESKTOP: 'https://new.expensify.com/NewExpensify.dmg', + DESKTOP: `${NEW_EXPENSIFY_URL}/NewExpensify.dmg`, }, DATE: { MOMENT_FORMAT_STRING: 'YYYY-MM-DD', @@ -134,6 +135,7 @@ const CONST = { CFPB_PREPAID_URL: 'https://cfpb.gov/prepaid', STAGING_SECURE_URL: 'https://staging-secure.expensify.com/', NEWDOT: 'new.expensify.com', + NEW_EXPENSIFY_URL, OPTION_TYPE: { REPORT: 'report', PERSONAL_DETAIL: 'personalDetail', diff --git a/src/components/HTMLEngineProvider/BaseHTMLEngineProvider.js b/src/components/HTMLEngineProvider/BaseHTMLEngineProvider.js index 5dca7c8b00fe..c6d97a64098c 100755 --- a/src/components/HTMLEngineProvider/BaseHTMLEngineProvider.js +++ b/src/components/HTMLEngineProvider/BaseHTMLEngineProvider.js @@ -22,6 +22,8 @@ import variables from '../../styles/variables'; import themeColors from '../../styles/themes/default'; import Text from '../Text'; import withLocalize from '../withLocalize'; +import Navigation from '../../libs/Navigation/Navigation'; +import CONST from '../../CONST'; const propTypes = { /** Whether text elements should be selectable */ @@ -70,6 +72,20 @@ function AnchorRenderer({tnode, key, style}) { // An auth token is needed to download Expensify chat attachments const isAttachment = Boolean(htmlAttribs['data-expensify-source']); const fileName = lodashGet(tnode, 'domNode.children[0].data', ''); + const internalExpensifyPath = htmlAttribs.href.startsWith(CONST.NEW_EXPENSIFY_URL) && htmlAttribs.href.replace(CONST.NEW_EXPENSIFY_URL, ''); + + // 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 (internalExpensifyPath) { + return ( + Navigation.navigate(internalExpensifyPath)} + > + + + ); + } return (