Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 3 additions & 0 deletions example-app/src/pages/Home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ const Home: React.FC = () => {
scanText: scanText,
cameraDirection: cameraDirection,
scanOrientation: scanOrientation,
cancelButtonAccessibilityLabel: "Cancel scanning",
torchButtonOnAccessibilityLabel: "Turn off flashlight",
torchButtonOffAccessibilityLabel: "Turn on flashlight",
android: {
scanningLibrary: androidScanningLibrary
}
Expand Down
2 changes: 1 addition & 1 deletion plugin/CapacitorBarcodeScanner.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ Pod::Spec.new do |s|
s.source_files = 'ios/Sources/**/*.{swift,h,m,c,cc,mm,cpp}'
s.ios.deployment_target = '15.0'
s.dependency 'Capacitor'
s.dependency 'OSBarcodeLib', '2.0.1'
s.dependency 'OSBarcodeLib', '2.2.0'
s.swift_version = '5.1'
end
2 changes: 1 addition & 1 deletion plugin/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ let package = Package(
],
dependencies: [
.package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", from: "8.0.0"),
.package(url: "https://github.com/OutSystems/OSBarcodeLib-iOS.git", from: "2.1.1")
.package(url: "https://github.com/OutSystems/OSBarcodeLib-iOS.git", from: "2.2.0")
],
targets: [
.target(
Expand Down
2 changes: 1 addition & 1 deletion plugin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ to represent the hint for the type of barcode to be scanned.

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>{ hint: <a href="#capacitorbarcodescannertypehint">CapacitorBarcodeScannerTypeHint</a>; scanInstructions?: string; scanButton?: boolean; scanText?: string; cameraDirection?: <a href="#capacitorbarcodescannercameradirection">CapacitorBarcodeScannerCameraDirection</a>; scanOrientation?: <a href="#capacitorbarcodescannerscanorientation">CapacitorBarcodeScannerScanOrientation</a>; /** * Accessibility label (alternative text) read by screen readers for the cancel button. * When omitted, the native library's default is used. Has no effect on web. */ cancelButtonAccessibilityLabel?: string; /** * Accessibility label (alternative text) read by screen readers for the torch button when the torch is on. * When omitted, the native library's default is used. Has no effect on web. */ torchButtonOnAccessibilityLabel?: string; /** * Accessibility label (alternative text) read by screen readers for the torch button when the torch is off. * When omitted, the native library's default is used. Has no effect on web. */ torchButtonOffAccessibilityLabel?: string; android?: { scanningLibrary?: <a href="#capacitorbarcodescannerandroidscanninglibrary">CapacitorBarcodeScannerAndroidScanningLibrary</a>; }; web?: { showCameraSelection?: boolean; scannerFPS?: number; }; }</code>


### Enums
Expand Down
2 changes: 1 addition & 1 deletion plugin/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ repositories {
}

dependencies {
implementation "io.ionic.libs:ionbarcode-android:2.0.2@aar"
implementation "io.ionic.libs:ionbarcode-android:2.1.0@aar"
implementation project(':capacitor-android')
implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
implementation 'androidx.activity:activity-ktx:1.11.0'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ class CapacitorBarcodeScannerPlugin : Plugin() {
val cameraDirection = call.getInt("cameraDirection")
val scanOrientation = call.getInt("scanOrientation")
val androidScanningLibrary = call.getObject("android")?.getString("scanningLibrary")
val cancelButtonAccessibilityLabel = call.getString("cancelButtonAccessibilityLabel")
val torchButtonOnAccessibilityLabel = call.getString("torchButtonOnAccessibilityLabel")
val torchButtonOffAccessibilityLabel = call.getString("torchButtonOffAccessibilityLabel")

val parameters = OSBARCScanParameters(
scanInstructions = scanInstructions,
Expand All @@ -47,7 +50,10 @@ class CapacitorBarcodeScannerPlugin : Plugin() {
scanButton = scanButton,
scanText = scanText,
hint = hint,
androidScanningLibrary = androidScanningLibrary
androidScanningLibrary = androidScanningLibrary,
cancelButtonAccessibilityLabel = cancelButtonAccessibilityLabel,
torchButtonOnAccessibilityLabel = torchButtonOnAccessibilityLabel,
torchButtonOffAccessibilityLabel = torchButtonOffAccessibilityLabel
)

val scanIntent = Intent(activity, OSBARCScannerActivity::class.java)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ extension OSBARCScanParameters: Decodable {
case cameraDirection
case scanOrientation
case hint
case cancelButtonAccessibilityLabel
case torchButtonOnAccessibilityLabel
case torchButtonOffAccessibilityLabel
}

public init(from decoder: Decoder) throws {
Expand All @@ -32,12 +35,19 @@ extension OSBARCScanParameters: Decodable {
let hintInt = try container.decode(Int.self, forKey: .hint)
let hint = OSBARCScannerHint(rawValue: hintInt)

let cancelButtonAccessibilityLabel = try container.decodeIfPresent(String.self, forKey: .cancelButtonAccessibilityLabel)
let torchButtonOnAccessibilityLabel = try container.decodeIfPresent(String.self, forKey: .torchButtonOnAccessibilityLabel)
let torchButtonOffAccessibilityLabel = try container.decodeIfPresent(String.self, forKey: .torchButtonOffAccessibilityLabel)

self.init(
scanInstructions: scanInstructions,
scanButtonText: scanButtonText,
cameraDirection: cameraDirection,
scanOrientation: scanOrientation,
hint: hint
hint: hint,
cancelButtonAccessibilityLabel: cancelButtonAccessibilityLabel,
torchButtonOnAccessibilityLabel: torchButtonOnAccessibilityLabel,
torchButtonOffAccessibilityLabel: torchButtonOffAccessibilityLabel
)
}
}
15 changes: 15 additions & 0 deletions plugin/src/definitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,21 @@ export type CapacitorBarcodeScannerOptions = {
scanText?: string;
cameraDirection?: CapacitorBarcodeScannerCameraDirection;
scanOrientation?: CapacitorBarcodeScannerScanOrientation;
/**
* Accessibility label (alternative text) read by screen readers for the cancel button.
* When omitted, the native library's default is used. Has no effect on web.
*/
cancelButtonAccessibilityLabel?: string;
/**
* Accessibility label (alternative text) read by screen readers for the torch button when the torch is on.
* When omitted, the native library's default is used. Has no effect on web.
*/
torchButtonOnAccessibilityLabel?: string;
/**
* Accessibility label (alternative text) read by screen readers for the torch button when the torch is off.
* When omitted, the native library's default is used. Has no effect on web.
*/
torchButtonOffAccessibilityLabel?: string;
android?: {
scanningLibrary?: CapacitorBarcodeScannerAndroidScanningLibrary;
};
Expand Down
Loading