Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: auto-sign not redirecting back to browser #3434

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
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
25 changes: 19 additions & 6 deletions src/composables/deepLinkApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@ import { useIonRouter } from '@ionic/vue';

import { ROUTE_ACCOUNT } from '@/popup/router/routeNames';
import { checkIfSuperheroCallbackUrl } from '@/utils';
import { IS_IOS, IS_MOBILE_APP, MODAL_TRANSFER_SEND } from '@/constants';
import {
IS_IOS,
IS_MOBILE_APP,
IS_WEB,
MODAL_TRANSFER_SEND,
} from '@/constants';
import { useModals } from '@/composables/modals';

export function useDeepLinkApi() {
Expand Down Expand Up @@ -45,11 +50,19 @@ export function useDeepLinkApi() {
decodeURIComponent(String(route.query[isSuccess ? 'x-success' : 'x-cancel'])),
) as string;
router.replace({ name: ROUTE_ACCOUNT });
if (IS_MOBILE_APP && !IS_IOS) {
window.open(callbackUrl, '_system');
} else {
window.open(callbackUrl, '_self');
}
/**
* When auto-sign is enabled (daily spend limit),
* there are cases (mostly on iOS) where it's not redirecting back to the callback URL.
* This might be due to the time it takes for iOS to animate the navigation.
* Adding a small delay fixes this
*/
setTimeout(() => {
if (IS_MOBILE_APP && !IS_IOS) {
window.open(callbackUrl, '_system');
} else {
window.open(callbackUrl, '_self');
}
}, IS_WEB ? 0 : 300);
}

return {
Expand Down
Loading