fix(): deeplink for android wc (#7573)

This commit is contained in:
Thomas Thachil 2023-11-14 00:46:15 +03:00 committed by GitHub
parent c6b44bb5c9
commit 9f06747958
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -3,7 +3,7 @@ import { URI_AVAILABLE, WalletConnect, WalletConnectConstructorArgs } from '@web
import { sendAnalyticsEvent } from 'analytics' import { sendAnalyticsEvent } from 'analytics'
import { L1_CHAIN_IDS, L2_CHAIN_IDS } from 'constants/chains' import { L1_CHAIN_IDS, L2_CHAIN_IDS } from 'constants/chains'
import { Z_INDEX } from 'theme/zIndex' import { Z_INDEX } from 'theme/zIndex'
import { isIOS } from 'utils/userAgent' import { isAndroid, isIOS } from 'utils/userAgent'
import { RPC_URLS } from '../constants/networks' import { RPC_URLS } from '../constants/networks'
@ -83,7 +83,7 @@ export class UniwalletConnect extends WalletConnectV2 {
this.events.emit(UniwalletConnect.UNI_URI_AVAILABLE, `https://uniswap.org/app/wc?uri=${uri}`) this.events.emit(UniwalletConnect.UNI_URI_AVAILABLE, `https://uniswap.org/app/wc?uri=${uri}`)
// Opens deeplink to Uniswap Wallet if on iOS // Opens deeplink to Uniswap Wallet if on iOS
if (isIOS) { if (isIOS || isAndroid) {
// Using window.location.href to open the deep link ensures smooth navigation and leverages OS handling for installed apps, // 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 // avoiding potential popup blockers or inconsistent behavior associated with window.open
window.location.href = `uniswap://wc?uri=${encodeURIComponent(uri)}` window.location.href = `uniswap://wc?uri=${encodeURIComponent(uri)}`