Skip to content

Commit 96b689d

Browse files
authored
feat: re-enable web3modal on android devices (#424)
1 parent 743da54 commit 96b689d

1 file changed

Lines changed: 12 additions & 19 deletions

File tree

src/connections.js

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -15,31 +15,24 @@ const dappMetadata = {
1515
url: 'https://metamask.github.io/test-dapp/',
1616
};
1717

18-
// eslint-disable-next-line require-unicode-regexp
19-
const isAndroid = /Android/i.test(navigator.userAgent);
20-
2118
const sdk = new MetaMaskSDK({ dappMetadata });
2219

2320
export const initializeWeb3Modal = () => {
24-
if (!isAndroid) {
25-
try {
26-
// eslint-disable-next-line node/global-require
27-
const { createWeb3Modal, defaultConfig } = require('@web3modal/ethers5');
21+
try {
22+
// eslint-disable-next-line node/global-require
23+
const { createWeb3Modal, defaultConfig } = require('@web3modal/ethers5');
2824

29-
const web3Modal = createWeb3Modal({
30-
ethersConfig: defaultConfig({ metadata: dappMetadata }),
31-
projectId: 'e6360eaee594162688065f1c70c863b7',
32-
});
25+
const web3Modal = createWeb3Modal({
26+
ethersConfig: defaultConfig({ metadata: dappMetadata }),
27+
projectId: 'e6360eaee594162688065f1c70c863b7',
28+
});
3329

34-
console.log('Web3Modal initialized successfully');
35-
return web3Modal;
36-
} catch (error) {
37-
console.error('Error initializing Web3Modal', error);
38-
}
30+
console.log('Web3Modal initialized successfully');
31+
return web3Modal;
32+
} catch (error) {
33+
console.error('Error initializing Web3Modal', error);
34+
return null;
3935
}
40-
41-
console.log('Web3Modal is not initialized');
42-
return null;
4336
};
4437

4538
export const walletConnect = initializeWeb3Modal();

0 commit comments

Comments
 (0)