diff --git a/README.md b/README.md index 5cffee9..62b8375 100644 --- a/README.md +++ b/README.md @@ -90,7 +90,7 @@ to represent the hint for the type of barcode to be scanned. Defines the options for configuring a barcode scan. -{ hint: CapacitorBarcodeScannerTypeHint; scanInstructions?: string; scanButton?: boolean; scanText?: string; cameraDirection?: CapacitorBarcodeScannerCameraDirection; scanOrientation?: CapacitorBarcodeScannerScanOrientation; android?: { scanningLibrary?: CapacitorBarcodeScannerAndroidScanningLibrary; }; web?: { showCameraSelection?: boolean; scannerFPS?: number; }; } +{ hint: CapacitorBarcodeScannerTypeHint; scanInstructions?: string; scanButton?: boolean; scanText?: string; cameraDirection?: CapacitorBarcodeScannerCameraDirection; scanOrientation?: CapacitorBarcodeScannerScanOrientation; /** * Accessibility label (alternative text) read by screen readers for the cancel button. * When omitted, no accessibility label is set. 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, no accessibility label is set. 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, no accessibility label is set. Has no effect on web. */ torchButtonOffAccessibilityLabel?: string; android?: { scanningLibrary?: CapacitorBarcodeScannerAndroidScanningLibrary; }; web?: { showCameraSelection?: boolean; scannerFPS?: number; }; } ### Enums diff --git a/example-app-spm/ios/App/App.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/example-app-spm/ios/App/App.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 264e02e..a9c03f1 100644 --- a/example-app-spm/ios/App/App.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/example-app-spm/ios/App/App.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -6,8 +6,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/ionic-team/capacitor-swift-pm.git", "state" : { - "revision" : "3e7ccfb8ab4d321ffcbd4e490234758e139f8a09", - "version" : "8.0.1" + "revision" : "13a39179b3df796f3bb2e70c47ccdd92593f34d2", + "version" : "8.0.2" } }, { @@ -15,8 +15,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/OutSystems/OSBarcodeLib-iOS.git", "state" : { - "revision" : "1ae7a716331be720f9f1075ef033276014c341ec", - "version" : "2.1.1" + "revision" : "392ab180af4f546001dc628a86bb6de4a5b9a2a0", + "version" : "2.2.0" } } ], diff --git a/example-app-spm/ios/App/CapApp-SPM/Package.resolved b/example-app-spm/ios/App/CapApp-SPM/Package.resolved index db91eef..6203ae7 100644 --- a/example-app-spm/ios/App/CapApp-SPM/Package.resolved +++ b/example-app-spm/ios/App/CapApp-SPM/Package.resolved @@ -5,8 +5,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/ionic-team/capacitor-swift-pm.git", "state" : { - "branch" : "main", - "revision" : "eb9a900023fe46671fc3d6f6761cbecc910345f7" + "revision" : "13a39179b3df796f3bb2e70c47ccdd92593f34d2", + "version" : "8.0.2" } }, { @@ -14,8 +14,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/OutSystems/OSBarcodeLib-iOS.git", "state" : { - "revision" : "fa51b49cf43ee227b02b371db83c8cb2e2cf8b55", - "version" : "2.1.0" + "revision" : "392ab180af4f546001dc628a86bb6de4a5b9a2a0", + "version" : "2.2.0" } } ], diff --git a/example-app-spm/ios/App/CapApp-SPM/Package.swift b/example-app-spm/ios/App/CapApp-SPM/Package.swift index 9acf8ce..0c5ea86 100644 --- a/example-app-spm/ios/App/CapApp-SPM/Package.swift +++ b/example-app-spm/ios/App/CapApp-SPM/Package.swift @@ -11,7 +11,7 @@ let package = Package( targets: ["CapApp-SPM"]) ], dependencies: [ - .package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", exact: "8.0.1"), + .package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", exact: "8.0.2"), .package(name: "CapacitorBarcodeScanner", path: "../../../../plugin") ], targets: [ diff --git a/example-app-spm/src/pages/Home.tsx b/example-app-spm/src/pages/Home.tsx index e2d3404..8b852f5 100644 --- a/example-app-spm/src/pages/Home.tsx +++ b/example-app-spm/src/pages/Home.tsx @@ -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 } diff --git a/example-app/ios/App/Podfile.lock b/example-app/ios/App/Podfile.lock index 0a1b4da..0621e52 100644 --- a/example-app/ios/App/Podfile.lock +++ b/example-app/ios/App/Podfile.lock @@ -3,9 +3,9 @@ PODS: - CapacitorCordova - CapacitorBarcodeScanner (3.0.2): - Capacitor - - OSBarcodeLib (= 2.0.1) + - OSBarcodeLib (= 2.2.0) - CapacitorCordova (8.0.2) - - OSBarcodeLib (2.0.1) + - OSBarcodeLib (2.2.0) DEPENDENCIES: - "Capacitor (from `../../../node_modules/.pnpm/@capacitor+ios@8.0.2_@capacitor+core@8.0.2/node_modules/@capacitor/ios`)" @@ -26,9 +26,9 @@ EXTERNAL SOURCES: SPEC CHECKSUMS: Capacitor: 2b79172ad27f3be2d103cce88b8eb9803fdcc744 - CapacitorBarcodeScanner: 421aa419ac63eeb18c7cb94ce280fa22d34e8b0b + CapacitorBarcodeScanner: 69c79a644283b98183cd603f1cfd8d5e9e4664e5 CapacitorCordova: 921bdb690ebe82421b24fce45552fd3dea2ae43a - OSBarcodeLib: 57987d2eb1f916f701f4554e20e349b3cb83f023 + OSBarcodeLib: aa520d51576362d0dfea290b82653e31df1a6fc4 PODFILE CHECKSUM: d994f7d6c451be5ff31fe0d46f1283a24db43080 diff --git a/example-app/src/pages/Home.tsx b/example-app/src/pages/Home.tsx index e2d3404..8b852f5 100644 --- a/example-app/src/pages/Home.tsx +++ b/example-app/src/pages/Home.tsx @@ -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 } diff --git a/plugin/CapacitorBarcodeScanner.podspec b/plugin/CapacitorBarcodeScanner.podspec index 9a43812..99840ca 100644 --- a/plugin/CapacitorBarcodeScanner.podspec +++ b/plugin/CapacitorBarcodeScanner.podspec @@ -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 diff --git a/plugin/Package.swift b/plugin/Package.swift index ece7156..c4e0516 100644 --- a/plugin/Package.swift +++ b/plugin/Package.swift @@ -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( diff --git a/plugin/README.md b/plugin/README.md index 5cffee9..62b8375 100644 --- a/plugin/README.md +++ b/plugin/README.md @@ -90,7 +90,7 @@ to represent the hint for the type of barcode to be scanned. Defines the options for configuring a barcode scan. -{ hint: CapacitorBarcodeScannerTypeHint; scanInstructions?: string; scanButton?: boolean; scanText?: string; cameraDirection?: CapacitorBarcodeScannerCameraDirection; scanOrientation?: CapacitorBarcodeScannerScanOrientation; android?: { scanningLibrary?: CapacitorBarcodeScannerAndroidScanningLibrary; }; web?: { showCameraSelection?: boolean; scannerFPS?: number; }; } +{ hint: CapacitorBarcodeScannerTypeHint; scanInstructions?: string; scanButton?: boolean; scanText?: string; cameraDirection?: CapacitorBarcodeScannerCameraDirection; scanOrientation?: CapacitorBarcodeScannerScanOrientation; /** * Accessibility label (alternative text) read by screen readers for the cancel button. * When omitted, no accessibility label is set. 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, no accessibility label is set. 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, no accessibility label is set. Has no effect on web. */ torchButtonOffAccessibilityLabel?: string; android?: { scanningLibrary?: CapacitorBarcodeScannerAndroidScanningLibrary; }; web?: { showCameraSelection?: boolean; scannerFPS?: number; }; } ### Enums diff --git a/plugin/android/build.gradle b/plugin/android/build.gradle index 7b28fd0..035ea67 100644 --- a/plugin/android/build.gradle +++ b/plugin/android/build.gradle @@ -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' diff --git a/plugin/android/src/main/java/com/capacitorjs/barcodescanner/OSBarcodePlugin.kt b/plugin/android/src/main/java/com/capacitorjs/barcodescanner/OSBarcodePlugin.kt index 5fc343c..7edf5e8 100644 --- a/plugin/android/src/main/java/com/capacitorjs/barcodescanner/OSBarcodePlugin.kt +++ b/plugin/android/src/main/java/com/capacitorjs/barcodescanner/OSBarcodePlugin.kt @@ -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, @@ -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) diff --git a/plugin/ios/Sources/CapacitorBarcodeScannerPlugin/OSBARCScanParameters+Decodable.swift b/plugin/ios/Sources/CapacitorBarcodeScannerPlugin/OSBARCScanParameters+Decodable.swift index ddbe916..3773f49 100644 --- a/plugin/ios/Sources/CapacitorBarcodeScannerPlugin/OSBARCScanParameters+Decodable.swift +++ b/plugin/ios/Sources/CapacitorBarcodeScannerPlugin/OSBARCScanParameters+Decodable.swift @@ -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 { @@ -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 ) } } diff --git a/plugin/src/definitions.ts b/plugin/src/definitions.ts index 91382ac..84a75ac 100644 --- a/plugin/src/definitions.ts +++ b/plugin/src/definitions.ts @@ -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, no accessibility label is set. 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, no accessibility label is set. 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, no accessibility label is set. Has no effect on web. + */ + torchButtonOffAccessibilityLabel?: string; android?: { scanningLibrary?: CapacitorBarcodeScannerAndroidScanningLibrary; };