From 3fa8e430a4d5637becd3b66521a937e0594f7a29 Mon Sep 17 00:00:00 2001 From: Marcos Rodriguez Velez Date: Mon, 30 Sep 2024 21:59:40 -0400 Subject: [PATCH] FIX: use scanqrhelper --- screen/lnd/lndCreateInvoice.js | 14 +++----------- screen/send/isItMyAddress.js | 13 ++----------- screen/send/psbtWithHardwareWallet.js | 13 ++----------- 3 files changed, 7 insertions(+), 33 deletions(-) diff --git a/screen/lnd/lndCreateInvoice.js b/screen/lnd/lndCreateInvoice.js index 9212776eb..8468f95bd 100644 --- a/screen/lnd/lndCreateInvoice.js +++ b/screen/lnd/lndCreateInvoice.js @@ -25,7 +25,7 @@ import AmountInput from '../../components/AmountInput'; import Button from '../../components/Button'; import { useTheme } from '../../components/themes'; import { presentWalletExportReminder } from '../../helpers/presentWalletExportReminder'; -import { requestCameraAuthorization } from '../../helpers/scan-qr'; +import { scanQrHelper } from '../../helpers/scan-qr'; import loc, { formatBalance, formatBalancePlain, formatBalanceWithoutSuffix } from '../../loc'; import { BitcoinUnit, Chain } from '../../models/bitcoinUnits'; import * as NavigationService from '../../NavigationService'; @@ -325,16 +325,8 @@ const LNDCreateInvoice = () => { }; const navigateToScanQRCode = () => { - requestCameraAuthorization().then(() => { - NavigationService.navigate('ScanQRCodeRoot', { - screen: 'ScanQRCode', - params: { - onBarScanned: processLnurl, - launchedBy: name, - }, - }); - Keyboard.dismiss(); - }); + scanQrHelper(name, true, processLnurl); + Keyboard.dismiss(); }; const renderScanClickable = () => { diff --git a/screen/send/isItMyAddress.js b/screen/send/isItMyAddress.js index 0568da994..a43966149 100644 --- a/screen/send/isItMyAddress.js +++ b/screen/send/isItMyAddress.js @@ -5,7 +5,7 @@ import { BlueButtonLink, BlueCard, BlueSpacing10, BlueSpacing20, BlueText } from import Button from '../../components/Button'; import SafeArea from '../../components/SafeArea'; import { useTheme } from '../../components/themes'; -import { requestCameraAuthorization } from '../../helpers/scan-qr'; +import { scanQrHelper } from '../../helpers/scan-qr'; import loc from '../../loc'; import { useStorage } from '../../hooks/context/useStorage'; import { useExtendedNavigation } from '../../hooks/useExtendedNavigation'; @@ -57,16 +57,7 @@ const IsItMyAddress = () => { }; const importScan = () => { - requestCameraAuthorization().then(() => { - navigate('ScanQRCodeRoot', { - screen: 'ScanQRCode', - params: { - launchedBy: name, - onBarScanned, - showFileImportButton: true, - }, - }); - }); + scanQrHelper(name, true, onBarScanned); }; const clearAddressInput = () => { diff --git a/screen/send/psbtWithHardwareWallet.js b/screen/send/psbtWithHardwareWallet.js index b49a52c61..0636a9b1d 100644 --- a/screen/send/psbtWithHardwareWallet.js +++ b/screen/send/psbtWithHardwareWallet.js @@ -15,7 +15,7 @@ import { DynamicQRCode } from '../../components/DynamicQRCode'; import SaveFileButton from '../../components/SaveFileButton'; import { SecondButton } from '../../components/SecondButton'; import { useTheme } from '../../components/themes'; -import { requestCameraAuthorization } from '../../helpers/scan-qr'; +import { scanQrHelper } from '../../helpers/scan-qr'; import { useBiometrics, unlockWithBiometrics } from '../../hooks/useBiometrics'; import loc from '../../loc'; import { useStorage } from '../../hooks/context/useStorage'; @@ -215,16 +215,7 @@ const PsbtWithHardwareWallet = () => { }; const openScanner = () => { - requestCameraAuthorization().then(() => { - navigation.navigate('ScanQRCodeRoot', { - screen: 'ScanQRCode', - params: { - launchedBy: route.name, - showFileImportButton: false, - onBarScanned, - }, - }); - }); + scanQrHelper(route.name, false, onBarScanned); }; if (txHex) return _renderBroadcastHex();