mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-04-21 11:26:15 +02:00
fix(barcode-scanner): early return scanner if missing permissions (#3221)
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
---
|
||||
barcode-scanner: patch
|
||||
barcode-scanner-js: patch
|
||||
---
|
||||
|
||||
On iOS, fixed an application crash happening when the scanner was started when user denied permission before.
|
||||
@@ -261,6 +261,11 @@ class BarcodeScannerPlugin: Plugin, AVCaptureMetadataOutputObjectsDelegate {
|
||||
}
|
||||
|
||||
private func runScanner(_ invoke: Invoke, args: ScanOptions) {
|
||||
if getPermissionState() != "granted" {
|
||||
invoke.reject("Camera permission denied or not yet requested")
|
||||
return
|
||||
}
|
||||
|
||||
scanFormats = [AVMetadataObject.ObjectType]()
|
||||
|
||||
(args.formats ?? []).forEach { format in
|
||||
|
||||
Reference in New Issue
Block a user