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 6b840c3 commit 2897c0c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 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
2 changes: 1 addition & 1 deletion src/app/pages/OpenWalletPage/webextension.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,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 />
}
1 change: 0 additions & 1 deletion src/app/state/importaccounts/saga.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,6 @@ function* enumerateAccountsFromLedger(action: PayloadAction<LedgerWalletType>) {
}
yield* setStep(ImportAccountsStep.LoadingBalances)
} catch (e: any) {
console.error(e)
let payload: ErrorPayload
if (e instanceof WalletError) {
payload = { code: e.type, message: e.message }
Expand Down

0 comments on commit 2897c0c

Please sign in to comment.