fix: use deeplink instead of universal link (#7017)
* fix: use deeplink instead of universal link * docs: added comment
This commit is contained in:
parent
6a3abbfb56
commit
1fde2504b4
@ -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<string>()
|
||||
|
||||
// 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
|
||||
|
@ -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)}`
|
||||
}
|
||||
})
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user