Skip to content

Commit

Permalink
fix: #1020;
Browse files Browse the repository at this point in the history
  • Loading branch information
migbash committed Feb 21, 2023
1 parent e7effb8 commit bffaf1f
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/lib/components/page/profile/Modal-ConnectWallet.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,20 @@ COMPONENT JS (w/ TS)
* @returns {Promise<void>}
*/
async function connect_wallet_action(): Promise<void> {
// NOTE: detect mobile device
// if (typeof screen.orientation !== 'undefined') {
// if (navigator?.userAgentData?.mobile) {
if (/Mobi/i.test(window.navigator.userAgent)) {
// [ℹ] navigate to MetaMask in-app browser
// await goto('https://metamask.app.link/dapp/scores.betarena.com/?dappLogin=true') // ✅ works
// await goto('https://metamask.app.link/dapp/http://192.168.0.28:3050/') // does not work
// await goto('https://metamask.app.link/dapp/192.168.0.28:3050/?dappLogin=true') // does not work
const dappUrl = $page.url.host
const metamaskAppDeepLink = `https://metamask.app.link/dapp/${dappUrl}?metmaskAuth=true`;
window.open(metamaskAppDeepLink, "_self");
toggle_modal()
return
}
// [ℹ] restrict only to MetaMask (original)
if (!providerDetect('isMetaMask')[0]) {
dlog("🔴 Moralis Auth not found!")
Expand Down

0 comments on commit bffaf1f

Please sign in to comment.