Skip to content

Commit

Permalink
Stop captureSession when data is returned from capture delegate (prev…
Browse files Browse the repository at this point in the history
…ent multiple calls to delegate)

Added another error case
Update version
  • Loading branch information
zaltzy committed Sep 10, 2019
1 parent 4f3f32f commit 289f30d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion BarcodeScanner.podspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Pod::Spec.new do |s|
s.name = "BarcodeScanner"
s.summary = "Simple and beautiful barcode scanner."
s.version = "5.0.2"
s.version = "5.0.3"
s.homepage = "https://github.com/hyperoslo/BarcodeScanner"
s.license = 'MIT'
s.author = { "Hyper Interaktiv AS" => "[email protected]" }
Expand Down
8 changes: 6 additions & 2 deletions Sources/Controllers/BarcodeScannerViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -250,12 +250,16 @@ extension BarcodeScannerViewController: CameraViewControllerDelegate {
didOutput metadataObjects: [AVMetadataObject]) {
guard !locked && isVisible else { return }
guard !metadataObjects.isEmpty else { return }

controller.stopCapturing()

guard
let metadataObj = metadataObjects[0] as? AVMetadataMachineReadableCodeObject,
var code = metadataObj.stringValue,
metadata.contains(metadataObj.type)
else { return }
else {
errorDelegate?.scanner(self, didReceiveError: AVError.unknown as! Error)
return
}

var rawType = metadataObj.type.rawValue

Expand Down

0 comments on commit 289f30d

Please sign in to comment.