Skip to content

Commit

Permalink
Merge pull request #50134 from bernhardoj/fix/49812-dont-promp-to-ope…
Browse files Browse the repository at this point in the history
…n-in-desktop-if-coming-from-desktop

Don't promp to open in desktop if user is coming from desktop
  • Loading branch information
aldo-expensify authored Oct 5, 2024
2 parents c6c1cf8 + adfd632 commit b9d9686
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/components/DeeplinkWrapper/index.website.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ function promptToOpenInDesktopApp(initialUrl = '') {
// 2. There may be non-idempotent operations (e.g. create a new workspace), which obviously should not be executed again in the desktop app.
// So we need to wait until after sign-in and navigation are complete before starting the deeplink redirect.
if (Str.startsWith(window.location.pathname, Str.normalizeUrl(ROUTES.TRANSITION_BETWEEN_APPS))) {
const params = new URLSearchParams(window.location.search);
// If the user is redirected from the desktop app, don't prompt the user to open in desktop.
if (params.get('referrer') === 'desktop') {
return;
}
App.beginDeepLinkRedirectAfterTransition();
} else {
// Match any magic link (/v/<account id>/<6 digit code>)
Expand Down
3 changes: 2 additions & 1 deletion src/libs/actions/Link.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,8 @@ function buildURLWithAuthToken(url: string, shortLivedAuthToken?: string) {
const emailParam = `email=${encodeURIComponent(currentUserEmail)}`;
const exitTo = `exitTo=${url}`;
const accountID = `accountID=${currentUserAccountID}`;
const paramsArray = [accountID, emailParam, authTokenParam, exitTo];
const referrer = 'referrer=desktop';
const paramsArray = [accountID, emailParam, authTokenParam, exitTo, referrer];
const params = paramsArray.filter(Boolean).join('&');

return `${CONFIG.EXPENSIFY.NEW_EXPENSIFY_URL}transition?${params}`;
Expand Down

0 comments on commit b9d9686

Please sign in to comment.