diff --git a/src/components/QrScan.tsx b/src/components/QrScan.tsx
index 1cb202cd..fd20ddaf 100644
--- a/src/components/QrScan.tsx
+++ b/src/components/QrScan.tsx
@@ -12,7 +12,7 @@ const QrScan = () => {
let qrScanner: QrScanner;
const { swapType, setInvoice, setOnchainAddress } = useCreateContext();
- const { t, camera, setCamera } = useGlobalContext();
+ const { t, camera, notify, setCamera } = useGlobalContext();
const [scanning, setScanning] = createSignal(false);
@@ -26,7 +26,6 @@ const QrScan = () => {
});
const startScan = () => {
- setScanning(true);
if (qrScanner === undefined) {
qrScanner = new QrScanner(
qrRef,
@@ -48,11 +47,21 @@ const QrScan = () => {
},
);
}
- qrScanner.start().then();
+ qrScanner
+ .start()
+ .then(() => {
+ log.debug("qr scanner started");
+ setScanning(true);
+ })
+ .catch((err) => {
+ log.error("error starting qr scanner: ", err);
+ notify("error", t("error_starting_qr_scanner"));
+ });
};
const stopScan = () => {
if (scanning()) {
+ log.debug("stopping qr scanner");
qrScanner.destroy();
setScanning(false);
qrScanner = undefined;
@@ -71,14 +80,14 @@ const QrScan = () => {
{t("scan_qr_code")}
-