Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deep link opening iOS AppStore even when MetaMask is installed #3965

Closed
epshtielsl opened this issue Mar 28, 2022 · 23 comments
Closed

Deep link opening iOS AppStore even when MetaMask is installed #3965

epshtielsl opened this issue Mar 28, 2022 · 23 comments
Assignees
Labels
Sev2-normal An issue that may lead to users misunderstanding some limited risks they are taking type-bug Something isn't working

Comments

@epshtielsl
Copy link

Describe the bug
Deep links are opening up the App Store and prompting users to install MetaMask, even when the app is already installed on the devicie.

Screenshots
https://community.metamask.io/t/deeplink-opens-appstore-when-app-installed/18199/12

To Reproduce
Open any app that utilizes deep links to integrate with MetaMask, i.e. dapps that utilize WalletConnect. When you attempt to sign a transaction, or other requests, MetaMask will open briefly, then the Apple AppStore opens up.

Expected behavior
MetaMask opens and performs the task requested.

Smartphone (please complete the following information):

  • Device: iPhone 12 Pro
  • OS: iOS 15.3.1
  • App Version: 4.2.2

to be added after bug submission by internal support / PM
Severity

  • How critical is the impact of this bug on a user?
  • Add stats if available on % of customers impacted
  • Is this visible to all users?
  • Is this tech debt?
@epshtielsl epshtielsl added the type-bug Something isn't working label Mar 28, 2022
@andreahaku
Copy link
Member

Thanks @epshtielsl for opening the issue. We are investigating it and trying to find the reason for this behaviour. Thanks again.

@gantunesr gantunesr added the Sev2-normal An issue that may lead to users misunderstanding some limited risks they are taking label Mar 29, 2022
@rafaelaugustos
Copy link

any update?

@zosim
Copy link

zosim commented Apr 12, 2022

any update?

yes also hoping for some news. Thanks.

@thunderball1
Copy link

@andreahaku is there any update? this is happening for very long time

@liho00
Copy link

liho00 commented Apr 23, 2022

same issue here, izit caused by IOS or IOS version?

@andreahaku
Copy link
Member

Did you try the latest version of the app (5.0.x) as most of the deep links related issue should be solved with it. Please let me know. Thanks!

@liho00
Copy link

liho00 commented Apr 26, 2022

Did you try the latest version of the app (5.0.x) as most of the deep links related issue should be solved with it. Please let me know. Thanks!

this is the code that i used to trigger the deep link navigation.
Im using IOS 15.3.1

window.open(`https://metamask.app.link/dapp/${window.location.host}`)

@andreahaku Same not working with latest v5.0.1, here is the screen recording https://user-images.githubusercontent.com/77238199/165326244-c9471c12-f88b-4ff8-b207-80f410623c51.MOV

@un7c0rn
Copy link

un7c0rn commented Apr 26, 2022

Same issue here, using Metamask version 5.0.1. The deeplink from WC is https://metamask.app.link/wc––is this to spec?

@un7c0rn
Copy link

un7c0rn commented Apr 27, 2022

Tried with:

https://metamask.app.link/wc:bdff4633-75ae-4477-a895-8a09cc971130@1?bridge=https%3A%2F%2F[redacted]-secure-bridge.com&key=[redacted]

which seems to match the spec here [1] but the deep link still goes to the app store.

[1] https://docs.walletconnect.com/mobile-linking

@andreahaku
Copy link
Member

So we have investigated the issue and unfortunately it does not depend on MetaMask mobile but on a mix of restrictions from mobile browsers and our deep link service provider.

The issue doesn't happen if the link is "tapped/clicked" by the user. It does happen with redirects and similar programmatic link openings.

So there are two potential workaround to it:

  1. make the link tappable by associating it to a button or something like that
  2. "simulate" a tap/click

About point 2 I just developed and tested a quick and simple JS function that does that.

function openMetaMaskUrl(url) {
    const a = document.createElement("a");
    a.href = url;
    a.target = "_self";
    document.body.appendChild(a);
    a.click();
    a.remove();
}

and it can be used like this:

openMetaMaskUrl("https://metamask.app.link/dapp/google.com");

This works on Android and iOS Chrome. On iOS Safari still opens the app store instead of MetaMask mobile app.

Let me know if this helps you. Thanks.

@gsyndromes
Copy link

I've tried your implementation but it still open up appstore on iOS chrome, anyone else facing this issue?

@varseb
Copy link

varseb commented May 4, 2022

Same issue trying to integrate a dApp with WalletConnect.
Using Safari, after pressing MetaMask icon inside WalletConnect modal it opens the app store.

I saw the address bar changing to metamask.app.link.. and then app store is opened

MetaMask 5.0.1
IOS 15.4.1

@varseb
Copy link

varseb commented May 4, 2022


Similar behavior using Chrome, after pressing MetaMask icon inside WalletConnect modal, it prompts

"This page will open in another application"

and pressing "Open" redirects to app store as well

@KimJaekyoon
Copy link

this problem still goes on in safari, chrome, etc. only open app store

@anxolin
Copy link

anxolin commented May 5, 2022

Same issue in Safari, trying to connect to MM using web3-react library (with wallet connect provider). Users get a pretty bad UX

@un7c0rn
Copy link

un7c0rn commented May 5, 2022

You can fix this by overriding the default WalletConnect provider implementation of the URL redirect, which is specified as a handler of the call_request_sent event:

        if (isMobile) {
          provider.connector.off("call_request_sent");
          provider.connector.on("call_request_sent", () => {
            console.log(
              "passing call_request_sent event on with NOP"
            );
          });
        }

The logic above disables WalletConnects default handler, which sets window.location to the MM universal link (this doesn't work). Once disabled, make your own button to initiate the universal link action:

    <Button
      href={makeMobileUniversalTxSignLink()}
      rel={"noopener noreferrer"}
      target={"_blank"}
    >

@0x2me
Copy link

0x2me commented May 10, 2022

can you share the implementation of makeMobileUniversalTxSignLink()?

@andreahaku
Copy link
Member

As an alternative to https://metamask.app.link/dapp/ you can use dapp:// schema. So for example instead of using: https://metamask.app.link/dapp/google.com you can do dapp://google.com and this opens MetaMask app browser with Google.com.

This is not a deep link, so the only disadvantage is that it won't check if MM mobile is installed and if not take the user to stores. It only works if the app is already installed.

@un7c0rn
Copy link

un7c0rn commented May 10, 2022

can you share the implementation of makeMobileUniversalTxSignLink()?

@tuoomz yes

const FALLBACK_TRANSACTION_SIGNING_APP_LINK =
  "https://metamask.app.link";

function makeMobileUniversalTxSignLink() {
  let result = FALLBACK_TRANSACTION_SIGNING_APP_LINK;
  try {
    result = JSON.parse(
      localStorage.getItem("WALLETCONNECT_DEEPLINK_CHOICE")
    ).href;
  } catch (e) {
    console.error(e);
  }
  return result;
}

@andreahaku
Copy link
Member

Yesterday I developed a potential fix for this that you can find here: #4167

We are testing it internally and hopefully have it merged into one of the coming releases (hopefully 5.2.0).

If anyone has a way to test it and has some feedback it's more than welcome ;) Thanks

@liho98
Copy link

liho98 commented May 21, 2022

Yesterday I developed a potential fix for this that you can find here: #4167

We are testing it internally and hopefully have it merged into one of the coming releases (hopefully 5.2.0).

If anyone has a way to test it and has some feedback it's more than welcome ;) Thanks

Can release this app now? And let public test, 8 days testing deep link quite slow, let public test this new feature can be faster.

@Fatxx
Copy link
Contributor

Fatxx commented May 24, 2022

Close in favour of #4167

@Saddam-tech
Copy link

This one worked for me, thanks)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Sev2-normal An issue that may lead to users misunderstanding some limited risks they are taking type-bug Something isn't working
Projects
None yet
Development

No branches or pull requests