Navaron Bracke

clean up some redundant statements in ios/MobileScanner.swift

@@ -127,7 +127,6 @@ public class MobileScanner: NSObject, AVCaptureVideoDataOutputSampleBufferDelega @@ -127,7 +127,6 @@ public class MobileScanner: NSObject, AVCaptureVideoDataOutputSampleBufferDelega
127 /// Gets called when a new image is added to the buffer 127 /// Gets called when a new image is added to the buffer
128 public func captureOutput(_ output: AVCaptureOutput, didOutput sampleBuffer: CMSampleBuffer, from connection: AVCaptureConnection) { 128 public func captureOutput(_ output: AVCaptureOutput, didOutput sampleBuffer: CMSampleBuffer, from connection: AVCaptureConnection) {
129 guard let imageBuffer = CMSampleBufferGetImageBuffer(sampleBuffer) else { 129 guard let imageBuffer = CMSampleBufferGetImageBuffer(sampleBuffer) else {
130 - print("Failed to get image buffer from sample buffer.")  
131 return 130 return
132 } 131 }
133 latestBuffer = imageBuffer 132 latestBuffer = imageBuffer
@@ -160,7 +159,9 @@ public class MobileScanner: NSObject, AVCaptureVideoDataOutputSampleBufferDelega @@ -160,7 +159,9 @@ public class MobileScanner: NSObject, AVCaptureVideoDataOutputSampleBufferDelega
160 159
161 if (error == nil && barcodesString != nil && newScannedBarcodes != nil && barcodesString!.elementsEqual(newScannedBarcodes!)) { 160 if (error == nil && barcodesString != nil && newScannedBarcodes != nil && barcodesString!.elementsEqual(newScannedBarcodes!)) {
162 return 161 return
163 - } else if (newScannedBarcodes?.isEmpty == false) { 162 + }
  163 +
  164 + if (newScannedBarcodes?.isEmpty == false) {
164 barcodesString = newScannedBarcodes 165 barcodesString = newScannedBarcodes
165 } 166 }
166 } 167 }
@@ -446,17 +447,6 @@ public class MobileScanner: NSObject, AVCaptureVideoDataOutputSampleBufferDelega @@ -446,17 +447,6 @@ public class MobileScanner: NSObject, AVCaptureVideoDataOutputSampleBufferDelega
446 447
447 var barcodesString: Array<String?>? 448 var barcodesString: Array<String?>?
448 449
449 - // /// Convert image buffer to jpeg  
450 - // private func ciImageToJpeg(ciImage: CIImage) -> Data {  
451 - //  
452 - // // let ciImage = CIImage(cvPixelBuffer: latestBuffer)  
453 - // let context:CIContext = CIContext.init(options: nil)  
454 - // let cgImage:CGImage = context.createCGImage(ciImage, from: ciImage.extent)!  
455 - // let uiImage:UIImage = UIImage(cgImage: cgImage, scale: 1, orientation: UIImage.Orientation.up)  
456 - //  
457 - // return uiImage.jpegData(compressionQuality: 0.8)!  
458 - // }  
459 -  
460 /// Rotates images accordingly 450 /// Rotates images accordingly
461 func imageOrientation( 451 func imageOrientation(
462 deviceOrientation: UIDeviceOrientation, 452 deviceOrientation: UIDeviceOrientation,