Skip to content

Commit

Permalink
use sdk on mobile
Browse files Browse the repository at this point in the history
  • Loading branch information
lochie committed Jun 17, 2024
1 parent ea505fd commit 2b266ca
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { WalletProps, useWallets } from '../../../wallets/useWallets';
import {
detectBrowser,
isCoinbaseWalletConnector,
isMetaMaskConnector,
isWalletConnectConnector,
} from '../../../utils';
import { useLastConnector } from '../../../hooks/useLastConnector';
Expand Down Expand Up @@ -105,7 +106,9 @@ const ConnectorItem = ({
// Safari requires opening popup on user gesture, so we connect immediately here
const shouldConnectImmediately =
(detectBrowser() === 'safari' || detectBrowser() === 'ios') &&
isCoinbaseWalletConnector(wallet.connector.id);
// TODO: convert this to a flag in the configs
(isCoinbaseWalletConnector(wallet.connector.id) ||
isMetaMaskConnector(wallet.connector.id));

if (redirectToMoreWallets || shouldConnectImmediately) deeplink = undefined; // mobile redirects to more wallets page

Expand Down
12 changes: 9 additions & 3 deletions packages/connectkit/src/wallets/useWallets.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ import { Connector } from 'wagmi';
import { useConnectors } from '../hooks/useConnectors';
import { walletConfigs, WalletConfigProps } from './walletConfigs';
import { useContext } from '../components/ConnectKit';
import { isCoinbaseWalletConnector, isInjectedConnector } from '../utils';
import {
isCoinbaseWalletConnector,
isInjectedConnector,
isMetaMaskConnector,
} from '../utils';

export type WalletProps = {
id: string;
Expand Down Expand Up @@ -46,8 +50,10 @@ export const useWallets = (): WalletProps[] => {
connector,
iconShape: 'squircle',
isInstalled:
(connector.type === 'injected' && connector.id !== 'metaMask') ||
isCoinbaseWalletConnector(connector.id), // always run coinbase wallet SDK
connector.type === 'injected' ||
// TODO: convert this to a flag in the configs
isCoinbaseWalletConnector(connector.id) || // always run coinbase wallet SDK ||
isMetaMaskConnector(connector.id), // always run metamask SDK
};

if (walletId) {
Expand Down

0 comments on commit 2b266ca

Please sign in to comment.