Showing
1 changed file
with
3 additions
and
3 deletions
| @@ -108,7 +108,7 @@ public class MobileScannerPlugin: NSObject, FlutterPlugin, FlutterStreamHandler, | @@ -108,7 +108,7 @@ public class MobileScannerPlugin: NSObject, FlutterPlugin, FlutterStreamHandler, | ||
| 108 | latestBuffer = imageBuffer | 108 | latestBuffer = imageBuffer |
| 109 | registry.textureFrameAvailable(textureId) | 109 | registry.textureFrameAvailable(textureId) |
| 110 | 110 | ||
| 111 | - let currentTime = Date.now.timeIntervalSince1970 | 111 | + let currentTime = Date().timeIntervalSince1970 |
| 112 | let eligibleForScan = currentTime > nextScanTime && imagesCurrentlyBeingProcessed == 0; | 112 | let eligibleForScan = currentTime > nextScanTime && imagesCurrentlyBeingProcessed == 0; |
| 113 | if ((detectionSpeed == DetectionSpeed.normal || detectionSpeed == DetectionSpeed.noDuplicates) && eligibleForScan || detectionSpeed == DetectionSpeed.unrestricted) { | 113 | if ((detectionSpeed == DetectionSpeed.normal || detectionSpeed == DetectionSpeed.noDuplicates) && eligibleForScan || detectionSpeed == DetectionSpeed.unrestricted) { |
| 114 | nextScanTime = currentTime + timeoutSeconds | 114 | nextScanTime = currentTime + timeoutSeconds |
| @@ -118,7 +118,7 @@ public class MobileScannerPlugin: NSObject, FlutterPlugin, FlutterStreamHandler, | @@ -118,7 +118,7 @@ public class MobileScannerPlugin: NSObject, FlutterPlugin, FlutterStreamHandler, | ||
| 118 | orientation: .right) | 118 | orientation: .right) |
| 119 | 119 | ||
| 120 | do { | 120 | do { |
| 121 | - try imageRequestHandler.perform([VNDetectBarcodesRequest { (request, error) in | 121 | + try imageRequestHandler.perform([VNDetectBarcodesRequest { [self] (request, error) in |
| 122 | imagesCurrentlyBeingProcessed -= 1 | 122 | imagesCurrentlyBeingProcessed -= 1 |
| 123 | if error == nil { | 123 | if error == nil { |
| 124 | if let results = request.results as? [VNBarcodeObservation] { | 124 | if let results = request.results as? [VNBarcodeObservation] { |
| @@ -226,7 +226,7 @@ public class MobileScannerPlugin: NSObject, FlutterPlugin, FlutterStreamHandler, | @@ -226,7 +226,7 @@ public class MobileScannerPlugin: NSObject, FlutterPlugin, FlutterStreamHandler, | ||
| 226 | let speed: Int = (call.arguments as! Dictionary<String, Any?>)["speed"] as? Int ?? 0 | 226 | let speed: Int = (call.arguments as! Dictionary<String, Any?>)["speed"] as? Int ?? 0 |
| 227 | let timeoutMs: Int = (call.arguments as! Dictionary<String, Any?>)["timeout"] as? Int ?? 0 | 227 | let timeoutMs: Int = (call.arguments as! Dictionary<String, Any?>)["timeout"] as? Int ?? 0 |
| 228 | 228 | ||
| 229 | - timeoutSeconds = timeoutMs * 1000.0 | 229 | + timeoutSeconds = Double(timeoutMs) * 1000.0 |
| 230 | detectionSpeed = DetectionSpeed(rawValue: speed)! | 230 | detectionSpeed = DetectionSpeed(rawValue: speed)! |
| 231 | 231 | ||
| 232 | // Set the camera to use | 232 | // Set the camera to use |
-
Please register or login to post a comment