Skip to content

Commit

Permalink
allow deeplink popup for all routes on mac
Browse files Browse the repository at this point in the history
Signed-off-by: Prince Mendiratta <prince.mendi@gmail.com>
  • Loading branch information
Prince-Mendiratta committed Apr 3, 2023
1 parent 4ee21e9 commit 8b9ad23
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 78 deletions.
51 changes: 0 additions & 51 deletions src/components/DeeplinkWrapper/deeplinkRoutes.js

This file was deleted.

29 changes: 2 additions & 27 deletions src/components/DeeplinkWrapper/index.website.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,14 @@
import _ from 'underscore';
import PropTypes from 'prop-types';
import React, {PureComponent} from 'react';
import {withOnyx} from 'react-native-onyx';
import deeplinkRoutes from './deeplinkRoutes';
import FullScreenLoadingIndicator from '../FullscreenLoadingIndicator';
import styles from '../../styles/styles';
import CONST from '../../CONST';
import CONFIG from '../../CONFIG';
import * as Browser from '../../libs/Browser';
import ONYXKEYS from '../../ONYXKEYS';

const propTypes = {
/** Children to render. */
children: PropTypes.node.isRequired,

/** List of betas available to current user */
betas: PropTypes.arrayOf(PropTypes.string),
};

const defaultProps = {
betas: [],
};

class DeeplinkWrapper extends PureComponent {
Expand Down Expand Up @@ -51,18 +40,7 @@ class DeeplinkWrapper extends PureComponent {
}
}, 500);

// check if pathname matches with deeplink routes
const matchedRoute = _.find(deeplinkRoutes, (route) => {
if (route.isDisabled && route.isDisabled(this.props.betas)) {
return false;
}
const routeRegex = new RegExp(route.pattern);
return routeRegex.test(window.location.pathname);
});

if (matchedRoute) {
this.openRouteInDesktopApp();
}
this.openRouteInDesktopApp();
}

openRouteInDesktopApp() {
Expand Down Expand Up @@ -113,7 +91,4 @@ class DeeplinkWrapper extends PureComponent {
}

DeeplinkWrapper.propTypes = propTypes;
DeeplinkWrapper.defaultProps = defaultProps;
export default withOnyx({
betas: {key: ONYXKEYS.BETAS},
})(DeeplinkWrapper);
export default DeeplinkWrapper;

0 comments on commit 8b9ad23

Please sign in to comment.