Skip to content

Commit

Permalink
fix: auto-sign not redirecting back to browser
Browse files Browse the repository at this point in the history
  • Loading branch information
akalogerakisunicorn committed Dec 9, 2024
1 parent ef41173 commit ff38105
Showing 1 changed file with 19 additions and 6 deletions.
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

0 comments on commit ff38105

Please sign in to comment.