Showing
2 changed files
with
3 additions
and
13 deletions
| @@ -258,9 +258,7 @@ public class MobileScannerPlugin: NSObject, FlutterPlugin { | @@ -258,9 +258,7 @@ public class MobileScannerPlugin: NSObject, FlutterPlugin { | ||
| 258 | let uiImage = UIImage(contentsOfFile: (call.arguments as! Dictionary<String, Any?>)["filePath"] as? String ?? "") | 258 | let uiImage = UIImage(contentsOfFile: (call.arguments as! Dictionary<String, Any?>)["filePath"] as? String ?? "") |
| 259 | 259 | ||
| 260 | if (uiImage == nil) { | 260 | if (uiImage == nil) { |
| 261 | - result(FlutterError(code: "MobileScanner", | ||
| 262 | - message: "No image found in analyzeImage!", | ||
| 263 | - details: nil)) | 261 | + result(nil) |
| 264 | return | 262 | return |
| 265 | } | 263 | } |
| 266 | 264 |
| @@ -273,7 +273,6 @@ public class MobileScannerPlugin: NSObject, FlutterPlugin, FlutterStreamHandler, | @@ -273,7 +273,6 @@ public class MobileScannerPlugin: NSObject, FlutterPlugin, FlutterStreamHandler, | ||
| 273 | 273 | ||
| 274 | let argReader = MapArgumentReader(call.arguments as? [String: Any]) | 274 | let argReader = MapArgumentReader(call.arguments as? [String: Any]) |
| 275 | 275 | ||
| 276 | - // let ratio: Int = argReader.int(key: "ratio") | ||
| 277 | let torch:Bool = argReader.bool(key: "torch") ?? false | 276 | let torch:Bool = argReader.bool(key: "torch") ?? false |
| 278 | let facing:Int = argReader.int(key: "facing") ?? 1 | 277 | let facing:Int = argReader.int(key: "facing") ?? 1 |
| 279 | let speed:Int = argReader.int(key: "speed") ?? 0 | 278 | let speed:Int = argReader.int(key: "speed") ?? 0 |
| @@ -327,7 +326,6 @@ public class MobileScannerPlugin: NSObject, FlutterPlugin, FlutterStreamHandler, | @@ -327,7 +326,6 @@ public class MobileScannerPlugin: NSObject, FlutterPlugin, FlutterStreamHandler, | ||
| 327 | videoOutput.setSampleBufferDelegate(self, queue: DispatchQueue.main) | 326 | videoOutput.setSampleBufferDelegate(self, queue: DispatchQueue.main) |
| 328 | captureSession!.addOutput(videoOutput) | 327 | captureSession!.addOutput(videoOutput) |
| 329 | for connection in videoOutput.connections { | 328 | for connection in videoOutput.connections { |
| 330 | - // connection.videoOrientation = .portrait | ||
| 331 | if position == .front && connection.isVideoMirroringSupported { | 329 | if position == .front && connection.isVideoMirroringSupported { |
| 332 | connection.isVideoMirrored = true | 330 | connection.isVideoMirrored = true |
| 333 | } | 331 | } |
| @@ -459,20 +457,14 @@ public class MobileScannerPlugin: NSObject, FlutterPlugin, FlutterStreamHandler, | @@ -459,20 +457,14 @@ public class MobileScannerPlugin: NSObject, FlutterPlugin, FlutterStreamHandler, | ||
| 459 | let symbologies:[VNBarcodeSymbology] = argReader.toSymbology() | 457 | let symbologies:[VNBarcodeSymbology] = argReader.toSymbology() |
| 460 | 458 | ||
| 461 | guard let filePath: String = argReader.string(key: "filePath") else { | 459 | guard let filePath: String = argReader.string(key: "filePath") else { |
| 462 | - // TODO: fix error code | ||
| 463 | - result(FlutterError(code: "MobileScanner", | ||
| 464 | - message: "No image found in analyzeImage!", | ||
| 465 | - details: nil)) | 460 | + result(nil) |
| 466 | return | 461 | return |
| 467 | } | 462 | } |
| 468 | 463 | ||
| 469 | let fileUrl = URL(fileURLWithPath: filePath) | 464 | let fileUrl = URL(fileURLWithPath: filePath) |
| 470 | 465 | ||
| 471 | guard let ciImage = CIImage(contentsOf: fileUrl) else { | 466 | guard let ciImage = CIImage(contentsOf: fileUrl) else { |
| 472 | - // TODO: fix error code | ||
| 473 | - result(FlutterError(code: "MobileScanner", | ||
| 474 | - message: "No image found in analyzeImage!", | ||
| 475 | - details: nil)) | 467 | + result(nil) |
| 476 | return | 468 | return |
| 477 | } | 469 | } |
| 478 | 470 |
-
Please register or login to post a comment