From b32e8037ff50e2ff25f7432272c1f27e9e2338a0 Mon Sep 17 00:00:00 2001 From: Rui Mendes Date: Fri, 6 Feb 2026 15:05:27 +0000 Subject: [PATCH 1/6] fix(web): Fix promise when press close button --- example-app/android/capacitor.settings.gradle | 2 +- example-app/ios/App/Podfile | 6 ++--- example-app/ios/App/Podfile.lock | 22 +++++++++---------- plugin/src/web.ts | 18 +++++++++++++-- 4 files changed, 31 insertions(+), 17 deletions(-) diff --git a/example-app/android/capacitor.settings.gradle b/example-app/android/capacitor.settings.gradle index 42b22b1..0f3e049 100644 --- a/example-app/android/capacitor.settings.gradle +++ b/example-app/android/capacitor.settings.gradle @@ -1,6 +1,6 @@ // DO NOT EDIT THIS FILE! IT IS GENERATED EACH TIME "capacitor update" IS RUN include ':capacitor-android' -project(':capacitor-android').projectDir = new File('../../node_modules/.pnpm/@capacitor+android@8.0.0-beta.0_@capacitor+core@8.0.0-beta.0/node_modules/@capacitor/android/capacitor') +project(':capacitor-android').projectDir = new File('../../node_modules/.pnpm/@capacitor+android@8.0.2_@capacitor+core@8.0.2/node_modules/@capacitor/android/capacitor') include ':capacitor-barcode-scanner' project(':capacitor-barcode-scanner').projectDir = new File('../../plugin/android') diff --git a/example-app/ios/App/Podfile b/example-app/ios/App/Podfile index 17c981e..101a0fd 100644 --- a/example-app/ios/App/Podfile +++ b/example-app/ios/App/Podfile @@ -1,4 +1,4 @@ -require_relative '../../../node_modules/.pnpm/@capacitor+ios@8.0.0-beta.0_@capacitor+core@8.0.0-beta.0/node_modules/@capacitor/ios/scripts/pods_helpers' +require_relative '../../../node_modules/.pnpm/@capacitor+ios@8.0.2_@capacitor+core@8.0.2/node_modules/@capacitor/ios/scripts/pods_helpers' platform :ios, '15.0' use_frameworks! @@ -9,8 +9,8 @@ use_frameworks! install! 'cocoapods', :disable_input_output_paths => true def capacitor_pods - pod 'Capacitor', :path => '../../../node_modules/.pnpm/@capacitor+ios@8.0.0-beta.0_@capacitor+core@8.0.0-beta.0/node_modules/@capacitor/ios' - pod 'CapacitorCordova', :path => '../../../node_modules/.pnpm/@capacitor+ios@8.0.0-beta.0_@capacitor+core@8.0.0-beta.0/node_modules/@capacitor/ios' + pod 'Capacitor', :path => '../../../node_modules/.pnpm/@capacitor+ios@8.0.2_@capacitor+core@8.0.2/node_modules/@capacitor/ios' + pod 'CapacitorCordova', :path => '../../../node_modules/.pnpm/@capacitor+ios@8.0.2_@capacitor+core@8.0.2/node_modules/@capacitor/ios' pod 'CapacitorBarcodeScanner', :path => '../../../plugin' end diff --git a/example-app/ios/App/Podfile.lock b/example-app/ios/App/Podfile.lock index 07e5a56..1588181 100644 --- a/example-app/ios/App/Podfile.lock +++ b/example-app/ios/App/Podfile.lock @@ -1,16 +1,16 @@ PODS: - - Capacitor (8.0.0-beta.0): + - Capacitor (8.0.2): - CapacitorCordova - - CapacitorBarcodeScanner (2.2.0): + - CapacitorBarcodeScanner (3.0.1): - Capacitor - OSBarcodeLib (= 2.0.1) - - CapacitorCordova (8.0.0-beta.0) + - CapacitorCordova (8.0.2) - OSBarcodeLib (2.0.1) DEPENDENCIES: - - "Capacitor (from `../../../node_modules/.pnpm/@capacitor+ios@8.0.0-beta.0_@capacitor+core@8.0.0-beta.0/node_modules/@capacitor/ios`)" + - "Capacitor (from `../../../node_modules/.pnpm/@capacitor+ios@8.0.2_@capacitor+core@8.0.2/node_modules/@capacitor/ios`)" - CapacitorBarcodeScanner (from `../../../plugin`) - - "CapacitorCordova (from `../../../node_modules/.pnpm/@capacitor+ios@8.0.0-beta.0_@capacitor+core@8.0.0-beta.0/node_modules/@capacitor/ios`)" + - "CapacitorCordova (from `../../../node_modules/.pnpm/@capacitor+ios@8.0.2_@capacitor+core@8.0.2/node_modules/@capacitor/ios`)" SPEC REPOS: trunk: @@ -18,18 +18,18 @@ SPEC REPOS: EXTERNAL SOURCES: Capacitor: - :path: "../../../node_modules/.pnpm/@capacitor+ios@8.0.0-beta.0_@capacitor+core@8.0.0-beta.0/node_modules/@capacitor/ios" + :path: "../../../node_modules/.pnpm/@capacitor+ios@8.0.2_@capacitor+core@8.0.2/node_modules/@capacitor/ios" CapacitorBarcodeScanner: :path: "../../../plugin" CapacitorCordova: - :path: "../../../node_modules/.pnpm/@capacitor+ios@8.0.0-beta.0_@capacitor+core@8.0.0-beta.0/node_modules/@capacitor/ios" + :path: "../../../node_modules/.pnpm/@capacitor+ios@8.0.2_@capacitor+core@8.0.2/node_modules/@capacitor/ios" SPEC CHECKSUMS: - Capacitor: cdbe01d8f7b542b2750fb51e88051e764b3cbc4e - CapacitorBarcodeScanner: 8de3b13b681ff3b92e21b286e9847ee525f44796 - CapacitorCordova: 65a0b71358d76bdeb799f45cd0214d68fbe2fd56 + Capacitor: cfc1ce4a70dbc19fdc4e66e17808937088029752 + CapacitorBarcodeScanner: 8d8fe382504efb79df763fb81b8acb0996f90e32 + CapacitorCordova: 921bdb690ebe82421b24fce45552fd3dea2ae43a OSBarcodeLib: 57987d2eb1f916f701f4554e20e349b3cb83f023 -PODFILE CHECKSUM: 4866a8bb908c1d799268ad9313d2a1aaab6530e6 +PODFILE CHECKSUM: d994f7d6c451be5ff31fe0d46f1283a24db43080 COCOAPODS: 1.16.2 diff --git a/plugin/src/web.ts b/plugin/src/web.ts index e23456b..d5da856 100644 --- a/plugin/src/web.ts +++ b/plugin/src/web.ts @@ -66,6 +66,8 @@ export class CapacitorBarcodeScannerWeb const caposbarcodescannercontainerdialoginnerclose = document.createElement("span"); + caposbarcodescannercontainerdialoginnerclose.id = + "cap-os-barcode-scanner-close-button"; caposbarcodescannercontainerdialoginnerclose.className = "close-button"; caposbarcodescannercontainerdialoginnerclose.innerHTML = "×"; caposbarcodescannercontainerdialoginner.appendChild( @@ -96,8 +98,6 @@ export class CapacitorBarcodeScannerWeb caposbarcodescannercontainerdialog, ); - caposbarcodescannercontainerdialoginnerclose.onclick = - this.stopAndHideScanner; } /** @@ -134,6 +134,20 @@ export class CapacitorBarcodeScannerWeb scannerFPS: options.web?.scannerFPS ? options.web.scannerFPS : 50, }; + let alreadyCancelled = false; + const closeButton = document.getElementById( + "cap-os-barcode-scanner-close-button", + ); + if (closeButton) { + closeButton.onclick = async () => { + + if (alreadyCancelled) return; + alreadyCancelled = true; + await this.stopAndHideScanner(); + reject(new Error("Couldn’t scan because the process was cancelled.")); + }; + } + // Set up and start the scanner const scannerElement = document.getElementById( "cap-os-barcode-scanner-container-scanner", From 42498e4db9c3a585d47e83c729a05dac62f5119c Mon Sep 17 00:00:00 2001 From: Rui Mendes Date: Fri, 6 Feb 2026 15:07:02 +0000 Subject: [PATCH 2/6] remove empty space --- plugin/src/web.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/plugin/src/web.ts b/plugin/src/web.ts index d5da856..b8e1c6b 100644 --- a/plugin/src/web.ts +++ b/plugin/src/web.ts @@ -140,7 +140,6 @@ export class CapacitorBarcodeScannerWeb ); if (closeButton) { closeButton.onclick = async () => { - if (alreadyCancelled) return; alreadyCancelled = true; await this.stopAndHideScanner(); From df0fe758f2e0da40d23519bec11a43b435bd0a5b Mon Sep 17 00:00:00 2001 From: Rui Mendes Date: Fri, 6 Feb 2026 15:36:52 +0000 Subject: [PATCH 3/6] lint web.ts --- plugin/src/web.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/plugin/src/web.ts b/plugin/src/web.ts index b8e1c6b..edfa2d6 100644 --- a/plugin/src/web.ts +++ b/plugin/src/web.ts @@ -97,7 +97,6 @@ export class CapacitorBarcodeScannerWeb caposbarcodescannercontainer.appendChild( caposbarcodescannercontainerdialog, ); - } /** From 76ca9fafdc1f6f3e4d116c3ee5b5f4de62e9921c Mon Sep 17 00:00:00 2001 From: Rui Mendes Date: Fri, 6 Feb 2026 16:11:46 +0000 Subject: [PATCH 4/6] revert changes on example app --- example-app/android/capacitor.settings.gradle | 3 +-- example-app/ios/App/Podfile | 6 ++--- example-app/ios/App/Podfile.lock | 24 +++++++++---------- 3 files changed, 16 insertions(+), 17 deletions(-) diff --git a/example-app/android/capacitor.settings.gradle b/example-app/android/capacitor.settings.gradle index 0f3e049..ea57cd8 100644 --- a/example-app/android/capacitor.settings.gradle +++ b/example-app/android/capacitor.settings.gradle @@ -1,6 +1,5 @@ // DO NOT EDIT THIS FILE! IT IS GENERATED EACH TIME "capacitor update" IS RUN include ':capacitor-android' -project(':capacitor-android').projectDir = new File('../../node_modules/.pnpm/@capacitor+android@8.0.2_@capacitor+core@8.0.2/node_modules/@capacitor/android/capacitor') - +project(':capacitor-android').projectDir = new File('../../node_modules/.pnpm/@capacitor+android@8.0.0-beta.0_@capacitor+core@8.0.0-beta.0/node_modules/@capacitor/android/capacitor') include ':capacitor-barcode-scanner' project(':capacitor-barcode-scanner').projectDir = new File('../../plugin/android') diff --git a/example-app/ios/App/Podfile b/example-app/ios/App/Podfile index 101a0fd..17c981e 100644 --- a/example-app/ios/App/Podfile +++ b/example-app/ios/App/Podfile @@ -1,4 +1,4 @@ -require_relative '../../../node_modules/.pnpm/@capacitor+ios@8.0.2_@capacitor+core@8.0.2/node_modules/@capacitor/ios/scripts/pods_helpers' +require_relative '../../../node_modules/.pnpm/@capacitor+ios@8.0.0-beta.0_@capacitor+core@8.0.0-beta.0/node_modules/@capacitor/ios/scripts/pods_helpers' platform :ios, '15.0' use_frameworks! @@ -9,8 +9,8 @@ use_frameworks! install! 'cocoapods', :disable_input_output_paths => true def capacitor_pods - pod 'Capacitor', :path => '../../../node_modules/.pnpm/@capacitor+ios@8.0.2_@capacitor+core@8.0.2/node_modules/@capacitor/ios' - pod 'CapacitorCordova', :path => '../../../node_modules/.pnpm/@capacitor+ios@8.0.2_@capacitor+core@8.0.2/node_modules/@capacitor/ios' + pod 'Capacitor', :path => '../../../node_modules/.pnpm/@capacitor+ios@8.0.0-beta.0_@capacitor+core@8.0.0-beta.0/node_modules/@capacitor/ios' + pod 'CapacitorCordova', :path => '../../../node_modules/.pnpm/@capacitor+ios@8.0.0-beta.0_@capacitor+core@8.0.0-beta.0/node_modules/@capacitor/ios' pod 'CapacitorBarcodeScanner', :path => '../../../plugin' end diff --git a/example-app/ios/App/Podfile.lock b/example-app/ios/App/Podfile.lock index 1588181..d8d6685 100644 --- a/example-app/ios/App/Podfile.lock +++ b/example-app/ios/App/Podfile.lock @@ -1,16 +1,16 @@ PODS: - - Capacitor (8.0.2): + - Capacitor (8.0.0-beta.0): - CapacitorCordova - - CapacitorBarcodeScanner (3.0.1): + - CapacitorBarcodeScanner (2.2.0): - Capacitor - OSBarcodeLib (= 2.0.1) - - CapacitorCordova (8.0.2) + - CapacitorCordova (8.0.0-beta.0) - OSBarcodeLib (2.0.1) DEPENDENCIES: - - "Capacitor (from `../../../node_modules/.pnpm/@capacitor+ios@8.0.2_@capacitor+core@8.0.2/node_modules/@capacitor/ios`)" + - "Capacitor (from `../../../node_modules/.pnpm/@capacitor+ios@8.0.0-beta.0_@capacitor+core@8.0.0-beta.0/node_modules/@capacitor/ios`)" - CapacitorBarcodeScanner (from `../../../plugin`) - - "CapacitorCordova (from `../../../node_modules/.pnpm/@capacitor+ios@8.0.2_@capacitor+core@8.0.2/node_modules/@capacitor/ios`)" + - "CapacitorCordova (from `../../../node_modules/.pnpm/@capacitor+ios@8.0.0-beta.0_@capacitor+core@8.0.0-beta.0/node_modules/@capacitor/ios`)" SPEC REPOS: trunk: @@ -18,18 +18,18 @@ SPEC REPOS: EXTERNAL SOURCES: Capacitor: - :path: "../../../node_modules/.pnpm/@capacitor+ios@8.0.2_@capacitor+core@8.0.2/node_modules/@capacitor/ios" + :path: "../../../node_modules/.pnpm/@capacitor+ios@8.0.0-beta.0_@capacitor+core@8.0.0-beta.0/node_modules/@capacitor/ios" CapacitorBarcodeScanner: :path: "../../../plugin" CapacitorCordova: - :path: "../../../node_modules/.pnpm/@capacitor+ios@8.0.2_@capacitor+core@8.0.2/node_modules/@capacitor/ios" + :path: "../../../node_modules/.pnpm/@capacitor+ios@8.0.0-beta.0_@capacitor+core@8.0.0-beta.0/node_modules/@capacitor/ios" SPEC CHECKSUMS: - Capacitor: cfc1ce4a70dbc19fdc4e66e17808937088029752 - CapacitorBarcodeScanner: 8d8fe382504efb79df763fb81b8acb0996f90e32 - CapacitorCordova: 921bdb690ebe82421b24fce45552fd3dea2ae43a + Capacitor: cdbe01d8f7b542b2750fb51e88051e764b3cbc4e + CapacitorBarcodeScanner: 8de3b13b681ff3b92e21b286e9847ee525f44796 + CapacitorCordova: 65a0b71358d76bdeb799f45cd0214d68fbe2fd56 OSBarcodeLib: 57987d2eb1f916f701f4554e20e349b3cb83f023 -PODFILE CHECKSUM: d994f7d6c451be5ff31fe0d46f1283a24db43080 +PODFILE CHECKSUM: 4866a8bb908c1d799268ad9313d2a1aaab6530e6 -COCOAPODS: 1.16.2 +COCOAPODS: 1.16.2 \ No newline at end of file From ae2cb442c3db3c5c6fa183245fa206664528b5c8 Mon Sep 17 00:00:00 2001 From: Rui Mendes Date: Fri, 6 Feb 2026 16:14:56 +0000 Subject: [PATCH 5/6] remove empty space --- example-app/android/capacitor.settings.gradle | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/example-app/android/capacitor.settings.gradle b/example-app/android/capacitor.settings.gradle index ea57cd8..fad59f4 100644 --- a/example-app/android/capacitor.settings.gradle +++ b/example-app/android/capacitor.settings.gradle @@ -1,5 +1,6 @@ // DO NOT EDIT THIS FILE! IT IS GENERATED EACH TIME "capacitor update" IS RUN include ':capacitor-android' project(':capacitor-android').projectDir = new File('../../node_modules/.pnpm/@capacitor+android@8.0.0-beta.0_@capacitor+core@8.0.0-beta.0/node_modules/@capacitor/android/capacitor') + include ':capacitor-barcode-scanner' -project(':capacitor-barcode-scanner').projectDir = new File('../../plugin/android') +project(':capacitor-barcode-scanner').projectDir = new File('../../plugin/android') \ No newline at end of file From 79c64a2b4f71144b20220e91127fd876c37c45a8 Mon Sep 17 00:00:00 2001 From: Rui Mendes Date: Fri, 6 Feb 2026 16:17:07 +0000 Subject: [PATCH 6/6] added extra line --- example-app/android/capacitor.settings.gradle | 2 +- example-app/ios/App/Podfile.lock | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/example-app/android/capacitor.settings.gradle b/example-app/android/capacitor.settings.gradle index fad59f4..42b22b1 100644 --- a/example-app/android/capacitor.settings.gradle +++ b/example-app/android/capacitor.settings.gradle @@ -3,4 +3,4 @@ include ':capacitor-android' project(':capacitor-android').projectDir = new File('../../node_modules/.pnpm/@capacitor+android@8.0.0-beta.0_@capacitor+core@8.0.0-beta.0/node_modules/@capacitor/android/capacitor') include ':capacitor-barcode-scanner' -project(':capacitor-barcode-scanner').projectDir = new File('../../plugin/android') \ No newline at end of file +project(':capacitor-barcode-scanner').projectDir = new File('../../plugin/android') diff --git a/example-app/ios/App/Podfile.lock b/example-app/ios/App/Podfile.lock index d8d6685..07e5a56 100644 --- a/example-app/ios/App/Podfile.lock +++ b/example-app/ios/App/Podfile.lock @@ -32,4 +32,4 @@ SPEC CHECKSUMS: PODFILE CHECKSUM: 4866a8bb908c1d799268ad9313d2a1aaab6530e6 -COCOAPODS: 1.16.2 \ No newline at end of file +COCOAPODS: 1.16.2