Skip to content

Commit

Permalink
fix macos build error
Browse files Browse the repository at this point in the history
  • Loading branch information
svenopdehipt committed Aug 6, 2023
1 parent 4a35134 commit 2b5a874
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions macos/Classes/MobileScannerPlugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public class MobileScannerPlugin: NSObject, FlutterPlugin, FlutterStreamHandler,
latestBuffer = imageBuffer
registry.textureFrameAvailable(textureId)

let currentTime = Date.now.timeIntervalSince1970
let currentTime = Date().timeIntervalSince1970
let eligibleForScan = currentTime > nextScanTime && imagesCurrentlyBeingProcessed == 0;
if ((detectionSpeed == DetectionSpeed.normal || detectionSpeed == DetectionSpeed.noDuplicates) && eligibleForScan || detectionSpeed == DetectionSpeed.unrestricted) {
nextScanTime = currentTime + timeoutSeconds
Expand All @@ -118,7 +118,7 @@ public class MobileScannerPlugin: NSObject, FlutterPlugin, FlutterStreamHandler,
orientation: .right)

do {
try imageRequestHandler.perform([VNDetectBarcodesRequest { (request, error) in
try imageRequestHandler.perform([VNDetectBarcodesRequest { [self] (request, error) in
imagesCurrentlyBeingProcessed -= 1
if error == nil {
if let results = request.results as? [VNBarcodeObservation] {
Expand Down Expand Up @@ -225,8 +225,8 @@ public class MobileScannerPlugin: NSObject, FlutterPlugin, FlutterStreamHandler,
let facing: Int = argReader.int(key: "facing") ?? 1
let speed: Int = (call.arguments as! Dictionary<String, Any?>)["speed"] as? Int ?? 0
let timeoutMs: Int = (call.arguments as! Dictionary<String, Any?>)["timeout"] as? Int ?? 0
timeoutSeconds = timeoutMs * 1000.0

timeoutSeconds = Double(timeoutMs) * 1000.0
detectionSpeed = DetectionSpeed(rawValue: speed)!

// Set the camera to use
Expand Down

0 comments on commit 2b5a874

Please sign in to comment.