chore: Rename CodeScanner
to CodeScannerOptions
in native (#2010)
* chore: Rename `CodeScanner` to `CodeScannerOptions` on native * chore: Rename `CodeScanner` on iOS * fix: Unwrap `options` * Format
This commit is contained in:
@@ -150,6 +150,13 @@ class CameraConfiguration {
|
||||
struct Audio: Equatable {
|
||||
// no props for audio at the moment
|
||||
}
|
||||
|
||||
/**
|
||||
A CodeScanner Output configuration
|
||||
*/
|
||||
struct CodeScanner: Equatable {
|
||||
var options: CodeScannerOptions
|
||||
}
|
||||
}
|
||||
|
||||
extension CameraConfiguration.Video {
|
||||
|
@@ -126,14 +126,15 @@ extension CameraSession {
|
||||
let codeScannerOutput = AVCaptureMetadataOutput()
|
||||
|
||||
// 1. Configure
|
||||
try codeScanner.codeTypes.forEach { type in
|
||||
let options = codeScanner.options
|
||||
try codeScanner.options.codeTypes.forEach { type in
|
||||
if !codeScannerOutput.availableMetadataObjectTypes.contains(type) {
|
||||
throw CameraError.codeScanner(.codeTypeNotSupported(codeType: type.descriptor))
|
||||
}
|
||||
}
|
||||
codeScannerOutput.setMetadataObjectsDelegate(self, queue: CameraQueues.codeScannerQueue)
|
||||
codeScannerOutput.metadataObjectTypes = codeScanner.codeTypes
|
||||
if let rectOfInterest = codeScanner.regionOfInterest {
|
||||
codeScannerOutput.metadataObjectTypes = options.codeTypes
|
||||
if let rectOfInterest = options.regionOfInterest {
|
||||
codeScannerOutput.rectOfInterest = rectOfInterest
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user