Skip to content

Commit

Permalink
Open Expensify desktop upon arrival to an authorized screen
Browse files Browse the repository at this point in the history
  • Loading branch information
silasjmatson authored and lindboe committed May 25, 2023
1 parent 13133eb commit 081bb61
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
5 changes: 2 additions & 3 deletions src/Expensify.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import withLocalize, {withLocalizePropTypes} from './components/withLocalize';
import * as User from './libs/actions/User';
import NetworkConnection from './libs/NetworkConnection';
import Navigation from './libs/Navigation/Navigation';
import DeeplinkWrapper from './components/DeeplinkWrapper';
import PopoverReportActionContextMenu from './pages/home/report/ContextMenu/PopoverReportActionContextMenu';
import * as ReportActionContextMenu from './pages/home/report/ContextMenu/ReportActionContextMenu';
import KeyboardShortcutsModal from './components/KeyboardShortcutsModal';
Expand Down Expand Up @@ -178,7 +177,7 @@ function Expensify(props) {
}

return (
<DeeplinkWrapper>
<>
{!isSplashShown && (
<>
<KeyboardShortcutsModal />
Expand All @@ -204,7 +203,7 @@ function Expensify(props) {
onReady={setNavigationReady}
authenticated={isAuthenticated}
/>
</DeeplinkWrapper>
</>
);
}

Expand Down
6 changes: 1 addition & 5 deletions src/components/DeeplinkWrapper/index.website.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,7 @@ class DeeplinkWrapper extends PureComponent {
const expensifyUrl = new URL(CONFIG.EXPENSIFY.NEW_EXPENSIFY_URL);
const params = new URLSearchParams();
params.set('exitTo', `${window.location.pathname}${window.location.search}${window.location.hash}`);
if (!this.props.session.authToken) {
const expensifyDeeplinkUrl = `${CONST.DEEPLINK_BASE_URL}${expensifyUrl.host}/transition?${params.toString()}`;
this.openRouteInDesktopApp(expensifyDeeplinkUrl);
return;
}

Authentication.getShortLivedAuthToken()
.then((shortLivedAuthToken) => {
params.set('email', this.props.session.email);
Expand Down
7 changes: 6 additions & 1 deletion src/libs/Navigation/AppNavigator/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React from 'react';
import PropTypes from 'prop-types';
import DeeplinkWrapper from '../../../components/DeeplinkWrapper';

const propTypes = {
/** If we have an authToken this is true */
Expand All @@ -11,7 +12,11 @@ const AppNavigator = (props) => {
const AuthScreens = require('./AuthScreens').default;

// These are the protected screens and only accessible when an authToken is present
return <AuthScreens />;
return (
<DeeplinkWrapper>
<AuthScreens />
</DeeplinkWrapper>
);
}
const PublicScreens = require('./PublicScreens').default;
return <PublicScreens />;
Expand Down

0 comments on commit 081bb61

Please sign in to comment.