From 7abf4909b00ac452883ea4f446706981af0a0b45 Mon Sep 17 00:00:00 2001 From: lubej <9722540+lubej@users.noreply.github.com> Date: Tue, 3 Oct 2023 16:45:13 +0200 Subject: [PATCH] Disable Bluetooth Ledger in Web extension --- .../OpenWalletPage/Features/FromLedger/index.tsx | 12 ++++++++---- src/app/pages/OpenWalletPage/webextension.tsx | 2 +- src/app/state/importaccounts/saga.ts | 1 - 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/app/pages/OpenWalletPage/Features/FromLedger/index.tsx b/src/app/pages/OpenWalletPage/Features/FromLedger/index.tsx index f2e3680e9b..fc191b5782 100644 --- a/src/app/pages/OpenWalletPage/Features/FromLedger/index.tsx +++ b/src/app/pages/OpenWalletPage/Features/FromLedger/index.tsx @@ -9,21 +9,25 @@ import { useTranslation } from 'react-i18next' 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(true) const [supportsBleLedger, setSupportsBleLedger] = React.useState(true) useEffect(() => { async function getLedgerSupport() { - setSupportsUsbLedger(await canAccessNavigatorUsb()) - setSupportsBleLedger(await canAccessBle()) + const usbLedgerSupported = await canAccessNavigatorUsb() + const bleLedgerSupported = !disableBluetoothLedger && (await canAccessBle()) + + setSupportsUsbLedger(usbLedgerSupported) + setSupportsBleLedger(bleLedgerSupported) } getLedgerSupport() - }, []) + }, [disableBluetoothLedger]) return ( openLedgerAccessPopup(href)} /> + return openLedgerAccessPopup(href)} disableBluetoothLedger /> } diff --git a/src/app/state/importaccounts/saga.ts b/src/app/state/importaccounts/saga.ts index d8c54d04f5..3967256831 100644 --- a/src/app/state/importaccounts/saga.ts +++ b/src/app/state/importaccounts/saga.ts @@ -206,7 +206,6 @@ function* enumerateAccountsFromLedger(action: PayloadAction) { } yield* setStep(ImportAccountsStep.LoadingBalances) } catch (e: any) { - console.error(e) let payload: ErrorPayload if (e instanceof WalletError) { payload = { code: e.type, message: e.message }