Skip to content

Commit

Permalink
Disable Bluetooth Ledger in Web extension
Browse files Browse the repository at this point in the history
  • Loading branch information
lubej committed Oct 3, 2023
1 parent c4aeaf9 commit db4c946
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
7 changes: 4 additions & 3 deletions src/app/pages/OpenWalletPage/Features/FromLedger/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ import { useNavigate } from 'react-router-dom'

type SelectOpenMethodProps = {
webExtensionLedgerAccess?: () => void
disableBluetoothLedger?: boolean
}

export function FromLedger({ webExtensionLedgerAccess }: SelectOpenMethodProps) {
export function FromLedger({ webExtensionLedgerAccess, disableBluetoothLedger }: SelectOpenMethodProps) {
const { t } = useTranslation()
const [supportsUsbLedger, setSupportsUsbLedger] = React.useState<boolean | undefined>(true)
const [supportsBleLedger, setSupportsBleLedger] = React.useState<boolean | undefined>(true)
Expand All @@ -21,14 +22,14 @@ export function FromLedger({ webExtensionLedgerAccess }: SelectOpenMethodProps)
useEffect(() => {
async function getLedgerSupport() {
const usbLedgerSupported = await canAccessNavigatorUsb()
const bleLedgerSupported = await canAccessBle()
const bleLedgerSupported = !disableBluetoothLedger && (await canAccessBle())

setSupportsUsbLedger(usbLedgerSupported)
setSupportsBleLedger(bleLedgerSupported)
}

getLedgerSupport()
}, [navigate])
}, [disableBluetoothLedger, navigate])

return (
<Box
Expand Down
4 changes: 1 addition & 3 deletions src/app/pages/OpenWalletPage/webextension.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,5 @@ export function OpenWalletPageWebExtension() {
}

export function FromLedgerWebExtension() {
const href = useHref('/open-wallet/connect-device')

return <FromLedger webExtensionLedgerAccess={() => openLedgerAccessPopup(href)} />
return <FromLedger webExtensionLedgerAccess={() => openLedgerAccessPopup(href)} disableBluetoothLedger />

Check failure on line 14 in src/app/pages/OpenWalletPage/webextension.tsx

View workflow job for this annotation

GitHub Actions / lint

Cannot find name 'href'.
}

0 comments on commit db4c946

Please sign in to comment.