From 1fde2504b4c676ccd6fead08455787c39c2d0ffe Mon Sep 17 00:00:00 2001 From: cartcrom <39385577+cartcrom@users.noreply.github.com> Date: Fri, 28 Jul 2023 10:58:01 -0400 Subject: [PATCH] fix: use deeplink instead of universal link (#7017) * fix: use deeplink instead of universal link * docs: added comment --- src/components/AccountDrawer/UniwalletModal.tsx | 4 +++- src/connection/WalletConnectV2.ts | 7 +++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/components/AccountDrawer/UniwalletModal.tsx b/src/components/AccountDrawer/UniwalletModal.tsx index b6dcd350d5..e9d5614659 100644 --- a/src/components/AccountDrawer/UniwalletModal.tsx +++ b/src/components/AccountDrawer/UniwalletModal.tsx @@ -13,6 +13,7 @@ import { QRCodeSVG } from 'qrcode.react' import { useEffect, useState } from 'react' import styled, { useTheme } from 'styled-components/macro' import { CloseIcon, ThemedText } from 'theme' +import { isIOS } from 'utils/userAgent' import uniPng from '../../assets/images/uniwallet_modal_icon.png' import { DownloadButton } from './DownloadButton' @@ -41,8 +42,9 @@ export default function UniwalletModal() { const { activationState, cancelActivation } = useActivationState() const [uri, setUri] = useState() - // Displays the modal if a Uniswap Wallet Connection is pending & qrcode URI is available + // Displays the modal if not on iOS, a Uniswap Wallet Connection is pending, & qrcode URI is available const open = + !isIOS && activationState.status === ActivationStatus.PENDING && activationState.connection.type === ConnectionType.UNISWAP_WALLET_V2 && !!uri diff --git a/src/connection/WalletConnectV2.ts b/src/connection/WalletConnectV2.ts index 9f0f83b527..02d4a64d17 100644 --- a/src/connection/WalletConnectV2.ts +++ b/src/connection/WalletConnectV2.ts @@ -83,10 +83,9 @@ export class UniwalletConnect extends WalletConnectV2 { // Opens deeplink to Uniswap Wallet if on iOS if (isIOS) { - const newTab = window.open(`https://uniswap.org/app/wc?uri=${encodeURIComponent(uri)}`) - - // Fixes blank tab opening on mobile Chrome - newTab?.close() + // Using window.location.href to open the deep link ensures smooth navigation and leverages OS handling for installed apps, + // avoiding potential popup blockers or inconsistent behavior associated with window.open + window.location.href = `uniswap://wc?uri=${encodeURIComponent(uri)}` } }) }