Commit 07101787 authored by Vignesh Mohankumar's avatar Vignesh Mohankumar Committed by GitHub

feat: don't allow disconnect/change on injected mobile wallets (#4015)

* feat: don't allow disconnect/change on injected mobile wallets

* new variable
parent 5535c83d
......@@ -7,6 +7,7 @@ import { ExternalLink as LinkIcon } from 'react-feather'
import { useAppDispatch } from 'state/hooks'
import { updateSelectedWallet } from 'state/user/reducer'
import styled, { ThemeContext } from 'styled-components/macro'
import { isMobile } from 'utils/userAgent'
import { ReactComponent as Close } from '../../assets/images/x.svg'
import { coinbaseWallet, injected } from '../../connectors'
......@@ -230,6 +231,10 @@ export default function AccountDetails({
const theme = useContext(ThemeContext)
const dispatch = useAppDispatch()
const isMetaMask = !!window.ethereum?.isMetaMask
const isCoinbaseWallet = !!window.ethereum?.isCoinbaseWallet
const isInjectedMobileBrowser = (isMetaMask || isCoinbaseWallet) && isMobile
function formatConnectorName() {
const { ethereum } = window
const isMetaMask = !!(ethereum && ethereum.isMetaMask)
......@@ -265,6 +270,8 @@ export default function AccountDetails({
<AccountGroupingRow>
{formatConnectorName()}
<div>
{!isInjectedMobileBrowser && (
<>
<WalletAction
style={{ fontSize: '.825rem', fontWeight: 400, marginRight: '8px' }}
onClick={() => {
......@@ -295,6 +302,8 @@ export default function AccountDetails({
>
<Trans>Change</Trans>
</WalletAction>
</>
)}
</div>
</AccountGroupingRow>
<AccountGroupingRow data-testid="web3-account-identifier-row">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment