Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
39944bf
chore: update dependencies
OS-pedrogustavobilro Sep 1, 2025
b75217e
chore(ci): Use macos-14 instead of 13
OS-pedrogustavobilro Sep 1, 2025
4d990bc
chore(ci): Add verify and example app build
OS-pedrogustavobilro Sep 1, 2025
3449fd2
feat: Use hint and return barcode format
OS-pedrogustavobilro Sep 1, 2025
46326d5
docs: Update changelog from previous release
OS-pedrogustavobilro Sep 2, 2025
4450322
chore: Update example app to allow to configure options
OS-pedrogustavobilro Sep 2, 2025
76b8499
feat(web): Return format in scan result
OS-pedrogustavobilro Sep 2, 2025
88a8170
fix(web): provide hint to html5qrcode library
OS-pedrogustavobilro Sep 2, 2025
e987a19
chore: Merge branch 'main' into feat/RMET-4433/hint-and-format
OS-pedrogustavobilro Sep 2, 2025
72fa47a
chore: fix lint issues.
OS-pedrogustavobilro Sep 2, 2025
e6265ee
chore: Use stricter Typescript version
OS-pedrogustavobilro Sep 2, 2025
2d88657
chore: remove duplicate file
OS-pedrogustavobilro Sep 2, 2025
875742a
chore: remove @retroactive
OS-pedrogustavobilro Sep 2, 2025
086b8ee
chore(ci): remove unnecessary steps from example app
OS-pedrogustavobilro Sep 2, 2025
c04acb4
chore(ci): replace ionic cli call
OS-pedrogustavobilro Sep 2, 2025
3a2cfe7
docs: Update Readme with information regarding hint
OS-pedrogustavobilro Sep 3, 2025
100eaca
docs: fix info for iOS hints
OS-pedrogustavobilro Sep 3, 2025
a3fa026
docs: mention Maxicode in readme
OS-pedrogustavobilro Sep 3, 2025
f0b7d11
chore: Update barcode native lib
OS-pedrogustavobilro Sep 4, 2025
9621a58
docs(ios): Fix mention of Apple Vision UPC-A ambiguity
OS-pedrogustavobilro Sep 5, 2025
b1842c5
Apply suggestions from code review
OS-pedrogustavobilro Sep 8, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 37 additions & 1 deletion .github/workflows/basic-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,40 @@ jobs:

build-packages:
needs: 'setup'
uses: ./.github/workflows/reusable_build-packages.yml
uses: ./.github/workflows/reusable_build-packages.yml

verify-plugin:
needs: ['setup', 'lint-test', 'build-packages']
runs-on: 'macos-14'
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- name: 'Setup Tools'
uses: ./.github/actions/setup-tools
- name: 'Verify iOS + Android + Web'
working-directory: ./plugin
run: npm run verify

build-example-app:
needs: ['verify-plugin']
runs-on: 'macos-14'
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- name: 'Setup Tools'
uses: ./.github/actions/setup-tools
- name: 'Build plugin'
working-directory: ./plugin
run: npm run build
- name: 'Build Web example app'
working-directory: ./example-app
run: npm run build
- name: 'Sync example app native platforms'
working-directory: ./example-app
run: npx cap sync
- name: 'Build Android example app'
working-directory: ./example-app/android
run: ./gradlew clean assembleDebug
- name: 'Build iOS example app'
working-directory: ./example-app/ios/App
run: xcodebuild clean build -workspace App.xcworkspace -scheme App CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO
2 changes: 1 addition & 1 deletion .github/workflows/reusable_lint-packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:

jobs:
lint:
runs-on: 'macos-13'
runs-on: 'macos-14'
timeout-minutes: 30
steps:
- uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/reusable_setup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
setup:
strategy:
matrix:
os: ['ubuntu-22.04', 'macos-13']
os: ['ubuntu-22.04', 'macos-14']
runs-on: ${{ matrix.os }}
timeout-minutes: 30
steps:
Expand Down
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline

## [2.0.4](https://github.com/ionic-team/capacitor-barcode-scanner/compare/v2.0.3...v2.0.4) (2025-08-20)

**Note:** Version bump only for package root
### Performance improvements

* (android) Reduce memory consumption for ML Kit ([#82](https://github.com/ionic-team/capacitor-barcode-scanner/pull/82))



Expand Down
20 changes: 12 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,14 @@ ext {
}
```

Note: Android with `ZXING` scanning library supports all formats, while `MLKIT` supports all except `MAXICODE`, `RSS_14`, `RSS_EXPANDED` and `UPC_EAN_EXTENSION` - using one of these in `hint` will default to scanning any format.

#### iOS

The barcode scanner uses the camera on the device. Ensure you configure the Privacy - Camera Usage Description in your Info.plist file so that your application can access the device's camera.

Note: iOS supports all formats except `MAXICODE` and `UPC_EAN_EXTENSION` - using them in `hint` will default to scanning any format. Also, Apple Vision does not distinguish between `UPC_A` and `EAN_13`, so specifying one of these in `hint` will allow to scan both.

---

## API
Expand Down Expand Up @@ -63,14 +67,7 @@ scanBarcode(options: CapacitorBarcodeScannerOptions) => Promise<CapacitorBarcode

Defines the structure of the result returned from a barcode scan.

<code>{ ScanResult: string }</code>


#### CapacitorBarcodeScannerOptions

Defines the options for configuring a barcode scan.

<code>{ hint: <a href="#capacitorbarcodescannertypehint">CapacitorBarcodeScannerTypeHint</a>; scanInstructions?: string; scanButton?: boolean; scanText?: string; cameraDirection?: <a href="#capacitorbarcodescannercameradirection">CapacitorBarcodeScannerCameraDirection</a>; scanOrientation?: <a href="#capacitorbarcodescannerscanorientation">CapacitorBarcodeScannerScanOrientation</a>; android?: { scanningLibrary?: <a href="#capacitorbarcodescannerandroidscanninglibrary">CapacitorBarcodeScannerAndroidScanningLibrary</a>; }; web?: { showCameraSelection?: boolean; scannerFPS?: number; }; }</code>
<code>{ ScanResult: string; format: <a href="#capacitorbarcodescannertypehint">CapacitorBarcodeScannerTypeHint</a>; }</code>


#### CapacitorBarcodeScannerTypeHint
Expand All @@ -83,6 +80,13 @@ to represent the hint for the type of barcode to be scanned.
<code><a href="#html5qrcodesupportedformats">Html5QrcodeSupportedFormats</a> | <a href="#capacitorbarcodescannertypehintalloption">CapacitorBarcodeScannerTypeHintALLOption</a></code>


#### CapacitorBarcodeScannerOptions

Defines the options for configuring a barcode scan.

<code>{ hint: <a href="#capacitorbarcodescannertypehint">CapacitorBarcodeScannerTypeHint</a>; scanInstructions?: string; scanButton?: boolean; scanText?: string; cameraDirection?: <a href="#capacitorbarcodescannercameradirection">CapacitorBarcodeScannerCameraDirection</a>; scanOrientation?: <a href="#capacitorbarcodescannerscanorientation">CapacitorBarcodeScannerScanOrientation</a>; android?: { scanningLibrary?: <a href="#capacitorbarcodescannerandroidscanninglibrary">CapacitorBarcodeScannerAndroidScanningLibrary</a>; }; web?: { showCameraSelection?: boolean; scannerFPS?: number; }; }</code>


### Enums


Expand Down
4 changes: 3 additions & 1 deletion example-app/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline

## [2.0.4](https://github.com/ionic-team/capacitor-barcode-scanner/compare/v2.0.3...v2.0.4) (2025-08-20)

**Note:** Version bump only for package example-app
### Performance improvements

* (android) Reduce memory consumption for ML Kit ([#82](https://github.com/ionic-team/capacitor-barcode-scanner/pull/82))



Expand Down
4 changes: 0 additions & 4 deletions example-app/android/app/capacitor.build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,7 @@ android {

apply from: "../capacitor-cordova-android-plugins/cordova.variables.gradle"
dependencies {
implementation project(':capacitor-app')
implementation project(':capacitor-barcode-scanner')
implementation project(':capacitor-haptics')
implementation project(':capacitor-keyboard')
implementation project(':capacitor-status-bar')

}

Expand Down
14 changes: 1 addition & 13 deletions example-app/android/capacitor.settings.gradle
Original file line number Diff line number Diff line change
@@ -1,18 +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/@[email protected]_@[email protected]/node_modules/@capacitor/android/capacitor')

include ':capacitor-app'
project(':capacitor-app').projectDir = new File('../../node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@capacitor/app/android')
project(':capacitor-android').projectDir = new File('../../node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@capacitor/android/capacitor')

include ':capacitor-barcode-scanner'
project(':capacitor-barcode-scanner').projectDir = new File('../../plugin/android')

include ':capacitor-haptics'
project(':capacitor-haptics').projectDir = new File('../../node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@capacitor/haptics/android')

include ':capacitor-keyboard'
project(':capacitor-keyboard').projectDir = new File('../../node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@capacitor/keyboard/android')

include ':capacitor-status-bar'
project(':capacitor-status-bar').projectDir = new File('../../node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@capacitor/status-bar/android')
10 changes: 3 additions & 7 deletions example-app/ios/App/Podfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require_relative '../../../node_modules/.pnpm/@capacitor+ios@7.0.0-rc.0_@capacitor+core@7.0.0-rc.0/node_modules/@capacitor/ios/scripts/pods_helpers'
require_relative '../../../node_modules/.pnpm/@capacitor+ios@7.4.3_@capacitor+core@7.4.3/node_modules/@capacitor/ios/scripts/pods_helpers'

platform :ios, '14.0'
use_frameworks!
Expand All @@ -9,13 +9,9 @@ use_frameworks!
install! 'cocoapods', :disable_input_output_paths => true

def capacitor_pods
pod 'Capacitor', :path => '../../../node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@capacitor/ios'
pod 'CapacitorCordova', :path => '../../../node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@capacitor/ios'
pod 'CapacitorApp', :path => '../../../node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@capacitor/app'
pod 'Capacitor', :path => '../../../node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@capacitor/ios'
pod 'CapacitorCordova', :path => '../../../node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@capacitor/ios'
pod 'CapacitorBarcodeScanner', :path => '../../../plugin'
pod 'CapacitorHaptics', :path => '../../../node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@capacitor/haptics'
pod 'CapacitorKeyboard', :path => '../../../node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@capacitor/keyboard'
pod 'CapacitorStatusBar', :path => '../../../node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@capacitor/status-bar'
end

target 'App' do
Expand Down
52 changes: 14 additions & 38 deletions example-app/ios/App/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,59 +1,35 @@
PODS:
- Capacitor (7.0.0-rc.0):
- Capacitor (7.4.3):
- CapacitorCordova
- CapacitorApp (7.0.0-rc.0):
- CapacitorBarcodeScanner (2.0.4):
- Capacitor
- CapacitorBarcodeScanner (2.0.1):
- Capacitor
- OSBarcodeLib (~> 1.1.3)
- CapacitorCordova (7.0.0-rc.0)
- CapacitorHaptics (7.0.0-rc.0):
- Capacitor
- CapacitorKeyboard (7.0.0-rc.0):
- Capacitor
- CapacitorStatusBar (7.0.0-rc.0):
- Capacitor
- OSBarcodeLib (1.1.3)
- OSBarcodeLib (= 2.0.1)
- CapacitorCordova (7.4.3)
- OSBarcodeLib (2.0.1)

DEPENDENCIES:
- "Capacitor (from `../../../node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@capacitor/ios`)"
- "CapacitorApp (from `../../../node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@capacitor/app`)"
- "Capacitor (from `../../../node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@capacitor/ios`)"
- CapacitorBarcodeScanner (from `../../../plugin`)
- "CapacitorCordova (from `../../../node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@capacitor/ios`)"
- "CapacitorHaptics (from `../../../node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@capacitor/haptics`)"
- "CapacitorKeyboard (from `../../../node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@capacitor/keyboard`)"
- "CapacitorStatusBar (from `../../../node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@capacitor/status-bar`)"
- "CapacitorCordova (from `../../../node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@capacitor/ios`)"

SPEC REPOS:
trunk:
- OSBarcodeLib

EXTERNAL SOURCES:
Capacitor:
:path: "../../../node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@capacitor/ios"
CapacitorApp:
:path: "../../../node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@capacitor/app"
:path: "../../../node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@capacitor/ios"
CapacitorBarcodeScanner:
:path: "../../../plugin"
CapacitorCordova:
:path: "../../../node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@capacitor/ios"
CapacitorHaptics:
:path: "../../../node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@capacitor/haptics"
CapacitorKeyboard:
:path: "../../../node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@capacitor/keyboard"
CapacitorStatusBar:
:path: "../../../node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@capacitor/status-bar"
:path: "../../../node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@capacitor/ios"

SPEC CHECKSUMS:
Capacitor: e79eb426d47f13ee0e2fdaff9ef0e9990db34a48
CapacitorApp: a50750608d62c0ff1fe7f33d38365dd915bb0f31
CapacitorBarcodeScanner: 67bdccc07abc05c3993e83da0196fedef7f5d508
CapacitorCordova: 8f4f6826f0b40f7b506eb13b832039b7140a88b4
CapacitorHaptics: 51c7ca77b24d5448bd716db4f6d5b47302ab9566
CapacitorKeyboard: 342c56b26934429f58ec25fdbe9d4b6553969f8d
CapacitorStatusBar: 89f0dc71f6544cef1dd250dfdb347a25547532b4
OSBarcodeLib: f2e981270a64faf476cb790864262b29ab8cd68a
Capacitor: b4741ca7affb32c1b70debd03df92cbf522d8a80
CapacitorBarcodeScanner: b8a3d4ed0a0d2ed2cd78a16b76737cacbf8da207
CapacitorCordova: 435121e81a2df4d0034f0fb11fcefab5104cfdb5
OSBarcodeLib: 57987d2eb1f916f701f4554e20e349b3cb83f023

PODFILE CHECKSUM: 7bd915a9b237ee006f510f6135ab6eb2a3e55593
PODFILE CHECKSUM: fdf735c62a9097dffa919e728a30c55c44e3a7f6

COCOAPODS: 1.16.2
16 changes: 6 additions & 10 deletions example-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,12 @@
"lint": "eslint"
},
"dependencies": {
"@capacitor/android": "next",
"@capacitor/app": "next",
"@capacitor/android": "^7.0.0",
"@capacitor/barcode-scanner": "workspace:*",
"@capacitor/core": "next",
"@capacitor/haptics": "next",
"@capacitor/ios": "next",
"@capacitor/keyboard": "next",
"@capacitor/status-bar": "next",
"@ionic/react": "^7.0.0",
"@ionic/react-router": "^7.0.0",
"@capacitor/core": "^7.0.0",
"@capacitor/ios": "^7.0.0",
"@ionic/react": "^8.7.0",
"@ionic/react-router": "^8.7.0",
"@types/react-router": "^5.1.20",
"@types/react-router-dom": "^5.3.3",
"ionicons": "^7.0.0",
Expand All @@ -31,7 +27,7 @@
"react-router-dom": "^5.3.4"
},
"devDependencies": {
"@capacitor/cli": "next",
"@capacitor/cli": "^7.0.0",
"@testing-library/dom": ">=7.21.4",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^14.0.0",
Expand Down
5 changes: 5 additions & 0 deletions example-app/src/pages/Home.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.scanner-textarea {
max-height: 200px; /* can grow up to 200px */
overflow-y: auto; /* scroll if content exceeds max */
white-space: pre-wrap;
}
Loading