MetaMask / metamask-sdk

The simplest yet most secure way to connect your blockchain-based applications to millions of MetaMask Wallet users.
https://metamask.io/sdk/
Other
177 stars 110 forks source link

[Bug]: WebGL game on mobile browser (safari) does not prompt the modal to open. #856

Closed mehsieh89 closed 4 months ago

mehsieh89 commented 5 months ago

SDK

Unity

Provide environment information

A WebGL game built in unity with metamask unity SDK to connect to wallets/do transactions, hosted in a react application hosted on AWS.

MetaMask SDK Version

1.3.1

MetaMask Mobile app Version

N/A

What browser are you using? (if relevant)

Safari

How are you deploying your application? (if relevant)

No response

Describe the Bug

closed issue with same problem from last year: https://github.com/MetaMask/metamask-sdk/issues/83

Deeplink is lost on iOS. I know there was a previous bug for this issue that was closed last year, but not sure if the fix was ever added. Currently using the metamask unity sdk for webgl and it works fine on desktop browser as well as mobile browser android. However in iOS (safari and chrome) it does not connect properly with metamask. Trying the website with the metamask browser (within the metamask app) does not prompt the connect modal. Trying the website from mobile browsers (safari and chrome) prompts user to go to app store to download/open metamask which then does not do anything.

Expected Behavior

going to website should prompt connection to wallet with metamask and be able to connect to metamask through modal

Link to reproduction - Issues with a link to complete (but minimal) reproduction code will be addressed faster

No response

To Reproduce

Going to the website that works on desktop and on android, but on iOS. Website also works fine on MacOS. Only on iOS it fails the connection and incorrectly prompts metamask from the mobile browser

christopherferreira9 commented 5 months ago

Hi @mehsieh89 . Can you please try to update the latest unity SDK version 2.0?

mehsieh89 commented 5 months ago

Hi @mehsieh89 . Can you please try to update the latest unity SDK version 2.0?

Hi!

We tried yesterday, but it broke our application so we reverted back to v1.31. Is there documentation i can forward to our unity engineer regarding the changes? Is this supposed to be fixed in 2.0? Thanks

christopherferreira9 commented 5 months ago

@mehsieh89 to give some background to this, 1.3.1 has the embedding of the JS SDK on WebGL builds meaning that when using WebGL you're in reality using the JS SDK with all the details being passed along from unity. The behaviour you're describing is the default behaviour for universal links and unfortunately where if you don't have the Wallet installed it'll redirect to the Appstore. The problem with this is that because of privacy reasons, there's no exact way of knowing if a user has MM installed or not, all we're able to do is guess and we use Branch io for this. We've had a few reports of users experiencing issues with branch io and getting redirected 100% of the times to the AppStore and we've seen this being related to using a VPN but in your case specifically you're able to connect with various other platforms so I don't think it is related.

On the JS SDK we have a special option to enable deeplinks only but unfortunately this is not being passed along to WebGL, we'll be including this in the upcoming release.

I've deployed an example dapp that uses the JS SDK, if the problem is indeed related to Branch io you should experience the same behaviour of the AppStore redirection. Can you please give it a try and let us know how it goes?

mehsieh89 commented 5 months ago

@mehsieh89 to give some background to this, 1.3.1 has the embedding of the JS SDK on WebGL builds meaning that when using WebGL you're in reality using the JS SDK with all the details being passed along from unity. The behaviour you're describing is the default behaviour for universal links and unfortunately where if you don't have the Wallet installed it'll redirect to the Appstore. The problem with this is that because of privacy reasons, there's no exact way of knowing if a user has MM installed or not, all we're able to do is guess and we use Branch io for this. We've had a few reports of users experiencing issues with branch io and getting redirected 100% of the times to the AppStore and we've seen this being related to using a VPN but in your case specifically you're able to connect with various other platforms so I don't think it is related.

On the JS SDK we have a special option to enable deeplinks only but unfortunately this is not being passed along to WebGL, we'll be including this in the upcoming release.

I've deployed an example dapp that uses the JS SDK, if the problem is indeed related to Branch io you should experience the same behaviour of the AppStore redirection. Can you please give it a try and let us know how it goes?

Sure will give this a shot. And report back! Thanks for the responses.

mehsieh89 commented 5 months ago

@mehsieh89 to give some background to this, 1.3.1 has the embedding of the JS SDK on WebGL builds meaning that when using WebGL you're in reality using the JS SDK with all the details being passed along from unity. The behaviour you're describing is the default behaviour for universal links and unfortunately where if you don't have the Wallet installed it'll redirect to the Appstore. The problem with this is that because of privacy reasons, there's no exact way of knowing if a user has MM installed or not, all we're able to do is guess and we use Branch io for this. We've had a few reports of users experiencing issues with branch io and getting redirected 100% of the times to the AppStore and we've seen this being related to using a VPN but in your case specifically you're able to connect with various other platforms so I don't think it is related. On the JS SDK we have a special option to enable deeplinks only but unfortunately this is not being passed along to WebGL, we'll be including this in the upcoming release. I've deployed an example dapp that uses the JS SDK, if the problem is indeed related to Branch io you should experience the same behaviour of the AppStore redirection. Can you please give it a try and let us know how it goes?

Sure will give this a shot. And report back! Thanks for the responses.

Okay so testing it on my phone. It seems navigating to the app via chrome and safari (directly) works and connects to metamask. Navigating to the website within the metamask browser connects, but the information on the wallet isn't there/reads undefined.

As the expected behavior for the branch.io issue was redirection, and this result is different and connects correctly. I assuming what we're trying to do should work. Is this deployed example with the 2.0 metamask sdk? or 1.31? What's the recommended path forward from here, as it sounds like 2.0 functions differently than 1.31 (this version embedding the JS SDK).

christopherferreira9 commented 5 months ago

1.3.1 already embeds the JS SDK in WebGL builds. Is there any link of your dapp deployed I could do some tests on?

mehsieh89 commented 5 months ago

1.3.1 already embeds the JS SDK in WebGL builds. Is there any link of your dapp deployed I could do some tests on?

yea sure, we have it deployed, but it's password protected, can I message you on linkedin?

christopherferreira9 commented 5 months ago

1.3.1 already embeds the JS SDK in WebGL builds. Is there any link of your dapp deployed I could do some tests on?

yea sure, we have it deployed, but it's password protected, can I message you on linkedin?

Of course. I might not be able to check it today or in the next couple of days but I'll surely get back to this issue.

mehsieh89 commented 5 months ago

1.3.1 already embeds the JS SDK in WebGL builds. Is there any link of your dapp deployed I could do some tests on?

yea sure, we have it deployed, but it's password protected, can I message you on linkedin?

Of course. I might not be able to check it today or in the next couple of days but I'll surely get back to this issue.

Okay, sent a connect request with the link and password. Thanks!

christopherferreira9 commented 4 months ago

Hi @mehsieh89 ! I'm sorry for the delay. We've been very busy on another feature. I've just gave it a try and it seems that the app has changed, was the MetaMask SDK removed from dapp? cc: @adamceresko

mehsieh89 commented 4 months ago

Yea we changed the app a lot. We removed unity sdk and tried using just the web sdk, but it still wasn’t working well. We ended up just switching to using particle network, but we still insist on running the app in MetaMask browser for mobile. We just had a really short timeframe and weren’t getting answers unfortunately. Thanks for getting back to me though!

Mel Hsieh (925) 278-8143

On Mon, Jun 3, 2024 at 10:42 AM Christopher Ferreira < @.***> wrote:

Hi @mehsieh89 https://github.com/mehsieh89 ! I'm sorry for the delay. We've been very busy on another feature. I've just gave it a try and it seems that the app has changed, was the MetaMask SDK removed from dapp? cc: @adamceresko https://github.com/adamceresko

— Reply to this email directly, view it on GitHub https://github.com/MetaMask/metamask-sdk/issues/856#issuecomment-2145383965, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGFHZ7B3UORQ7LVYYWIGWATZFR6GLAVCNFSM6AAAAABIACJ2O6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNBVGM4DGOJWGU . You are receiving this because you were mentioned.Message ID: @.***>

mehsieh89 commented 4 months ago

However!

While I have your attention. We've been running into rendering issues with the metamask browser for our website. We noticed that window.innerHeight does work very well and has differences between Android and iOS. Any thoughts here? We're having trouble standardizing our website to fit in both while accounting for the browser/metamask app and what not.

On Mon, Jun 3, 2024 at 11:23 AM Mel Hsieh @.***> wrote:

Yea we changed the app a lot. We removed unity sdk and tried using just the web sdk, but it still wasn’t working well. We ended up just switching to using particle network, but we still insist on running the app in MetaMask browser for mobile. We just had a really short timeframe and weren’t getting answers unfortunately. Thanks for getting back to me though!

Mel Hsieh (925) 278-8143

On Mon, Jun 3, 2024 at 10:42 AM Christopher Ferreira < @.***> wrote:

Hi @mehsieh89 https://github.com/mehsieh89 ! I'm sorry for the delay. We've been very busy on another feature. I've just gave it a try and it seems that the app has changed, was the MetaMask SDK removed from dapp? cc: @adamceresko https://github.com/adamceresko

— Reply to this email directly, view it on GitHub https://github.com/MetaMask/metamask-sdk/issues/856#issuecomment-2145383965, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGFHZ7B3UORQ7LVYYWIGWATZFR6GLAVCNFSM6AAAAABIACJ2O6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNBVGM4DGOJWGU . You are receiving this because you were mentioned.Message ID: @.***>

-- Mel Hsieh (925) 278-8143

christopherferreira9 commented 4 months ago

HI @mehsieh89 ! I'm sorry for the delay in replying, we've been very busy with some other topics. For the inapp browser, the best place to go is the MetaMask mobile repo. Are you trying to then switch to the JS SDK instead of using Unity?

christopherferreira9 commented 4 months ago

I'm closing this issue for the time being but please feel free to open a new issue at any time.