Skip to content
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
4 changes: 3 additions & 1 deletion src/CONST.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions src/components/HTMLEngineProvider/BaseHTMLEngineProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down Expand Up @@ -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 (
<Text
style={styles.link}
onPress={() => Navigation.navigate(internalExpensifyPath)}
>
<TNodeChildrenRenderer tnode={tnode} />
</Text>
);
}

return (
<AnchorForCommentsOnly
Expand Down
4 changes: 2 additions & 2 deletions src/libs/Navigation/linkingConfig.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import ROUTES from '../../ROUTES';
import SCREENS from '../../SCREENS';
import CONST from '../../CONST';

export default {
prefixes: [
'new-expensify://',
'expensify-cash://', // DEPRECATED
'https://new.expensify.com',
'https://www.expensify.cash',
'https://staging.expensify.cash',
'http://localhost',
'https://new.expensify.com',
CONST.NEW_EXPENSIFY_URL,
'https://staging.new.expensify.com',
],
config: {
Expand Down