From ba1ea2cd3cc92b46795a8e296d9df95b2fd2ccc7 Mon Sep 17 00:00:00 2001 From: Pedro Rosario Date: Fri, 23 Feb 2024 19:11:25 -0300 Subject: [PATCH 1/3] fix redirecting on webviews --- packages/wallet-sdk/src/relay/mobile/MobileRelayUI.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/wallet-sdk/src/relay/mobile/MobileRelayUI.ts b/packages/wallet-sdk/src/relay/mobile/MobileRelayUI.ts index bdfa014d96..e8a32783ae 100644 --- a/packages/wallet-sdk/src/relay/mobile/MobileRelayUI.ts +++ b/packages/wallet-sdk/src/relay/mobile/MobileRelayUI.ts @@ -37,10 +37,10 @@ export class MobileRelayUI implements RelayUI { url.searchParams.append('wl_url', walletLinkUrl); } - this.openedWindow = window.open(url.href, 'cbw-opener'); - if (this.openedWindow) { - setTimeout(() => this.closeOpenedWindow(), 5000); - } + window.location.href = url.href; + + setTimeout(() => this.closeOpenedWindow(), 5000); + } openCoinbaseWalletDeeplink(walletLinkUrl?: string): void { From 187a86a0372b3b6937ed06f65b5b60e8a3124ef9 Mon Sep 17 00:00:00 2001 From: Pedro Rosario Date: Fri, 23 Feb 2024 20:58:43 -0300 Subject: [PATCH 2/3] remove dead code --- packages/wallet-sdk/src/relay/mobile/MobileRelayUI.ts | 9 --------- 1 file changed, 9 deletions(-) diff --git a/packages/wallet-sdk/src/relay/mobile/MobileRelayUI.ts b/packages/wallet-sdk/src/relay/mobile/MobileRelayUI.ts index e8a32783ae..3ceecd397b 100644 --- a/packages/wallet-sdk/src/relay/mobile/MobileRelayUI.ts +++ b/packages/wallet-sdk/src/relay/mobile/MobileRelayUI.ts @@ -7,7 +7,6 @@ export class MobileRelayUI implements RelayUI { private readonly redirectDialog: RedirectDialog; private attached = false; private darkMode = false; - private openedWindow: Window | null = null; constructor(options: Readonly) { this.redirectDialog = new RedirectDialog(); @@ -24,10 +23,6 @@ export class MobileRelayUI implements RelayUI { setConnected(_connected: boolean) {} // no-op - closeOpenedWindow() { - this.openedWindow?.close(); - this.openedWindow = null; - } private redirectToCoinbaseWallet(walletLinkUrl?: string): void { const url = new URL('https://go.cb-w.com/walletlink'); @@ -39,8 +34,6 @@ export class MobileRelayUI implements RelayUI { window.location.href = url.href; - setTimeout(() => this.closeOpenedWindow(), 5000); - } openCoinbaseWalletDeeplink(walletLinkUrl?: string): void { @@ -65,13 +58,11 @@ export class MobileRelayUI implements RelayUI { }): () => void { // it uses the return callback to clear the dialog return () => { - this.closeOpenedWindow(); this.redirectDialog.clear(); }; } hideRequestEthereumAccounts() { - this.closeOpenedWindow(); this.redirectDialog.clear(); } From fb6455403c8da57d343122db765ecaba020a01c4 Mon Sep 17 00:00:00 2001 From: Pedro Rosario Date: Fri, 23 Feb 2024 21:12:39 -0300 Subject: [PATCH 3/3] fix: typecheck --- packages/wallet-sdk/src/relay/mobile/MobileRelay.ts | 4 ---- 1 file changed, 4 deletions(-) diff --git a/packages/wallet-sdk/src/relay/mobile/MobileRelay.ts b/packages/wallet-sdk/src/relay/mobile/MobileRelay.ts index 3c1c00aa8c..12df68c412 100644 --- a/packages/wallet-sdk/src/relay/mobile/MobileRelay.ts +++ b/packages/wallet-sdk/src/relay/mobile/MobileRelay.ts @@ -76,10 +76,6 @@ export class MobileRelay extends WalletLinkRelay { // override handleWeb3ResponseMessage(message: WalletLinkResponseEventData) { super.handleWeb3ResponseMessage(message); - - if (this._enableMobileWalletLink && this.ui instanceof MobileRelayUI) { - this.ui.closeOpenedWindow(); - } } connectAndSignIn(params: {