Showing
1 changed file
with
2 additions
and
6 deletions
| @@ -24,7 +24,6 @@ public class SwiftMobileScannerPlugin: NSObject, FlutterPlugin { | @@ -24,7 +24,6 @@ public class SwiftMobileScannerPlugin: NSObject, FlutterPlugin { | ||
| 24 | let barcodeheight = barcode.cornerPoints![3].cgPointValue.y - barcodeminY | 24 | let barcodeheight = barcode.cornerPoints![3].cgPointValue.y - barcodeminY |
| 25 | let barcodeBox = CGRect(x: barcodeminX, y: barcodeminY, width: barcodewidth, height: barcodeheight) | 25 | let barcodeBox = CGRect(x: barcodeminX, y: barcodeminY, width: barcodewidth, height: barcodeheight) |
| 26 | 26 | ||
| 27 | - | ||
| 28 | let minX = scanwindow[0] * imageSize.width | 27 | let minX = scanwindow[0] * imageSize.width |
| 29 | let minY = scanwindow[1] * imageSize.height | 28 | let minY = scanwindow[1] * imageSize.height |
| 30 | 29 | ||
| @@ -66,10 +65,9 @@ public class SwiftMobileScannerPlugin: NSObject, FlutterPlugin { | @@ -66,10 +65,9 @@ public class SwiftMobileScannerPlugin: NSObject, FlutterPlugin { | ||
| 66 | } | 65 | } |
| 67 | 66 | ||
| 68 | public static func register(with registrar: FlutterPluginRegistrar) { | 67 | public static func register(with registrar: FlutterPluginRegistrar) { |
| 68 | + let channel = FlutterMethodChannel(name: "dev.steenbakker.mobile_scanner/scanner/method", binaryMessenger: registrar.messenger()) | ||
| 69 | let instance = SwiftMobileScannerPlugin(barcodeHandler: BarcodeHandler(registrar: registrar), registry: registrar.textures()) | 69 | let instance = SwiftMobileScannerPlugin(barcodeHandler: BarcodeHandler(registrar: registrar), registry: registrar.textures()) |
| 70 | - let methodChannel = FlutterMethodChannel(name: | ||
| 71 | - "dev.steenbakker.mobile_scanner/scanner/method", binaryMessenger: registrar.messenger()) | ||
| 72 | - registrar.addMethodCallDelegate(instance, channel: methodChannel) | 70 | + registrar.addMethodCallDelegate(instance, channel: channel) |
| 73 | } | 71 | } |
| 74 | 72 | ||
| 75 | public func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) { | 73 | public func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) { |
| @@ -118,7 +116,6 @@ public class SwiftMobileScannerPlugin: NSObject, FlutterPlugin { | @@ -118,7 +116,6 @@ public class SwiftMobileScannerPlugin: NSObject, FlutterPlugin { | ||
| 118 | barcodeOptions = BarcodeScannerOptions(formats: barcodeFormats) | 116 | barcodeOptions = BarcodeScannerOptions(formats: barcodeFormats) |
| 119 | } | 117 | } |
| 120 | 118 | ||
| 121 | - | ||
| 122 | let position = facing == 0 ? AVCaptureDevice.Position.front : .back | 119 | let position = facing == 0 ? AVCaptureDevice.Position.front : .back |
| 123 | let detectionSpeed: DetectionSpeed = DetectionSpeed(rawValue: speed)! | 120 | let detectionSpeed: DetectionSpeed = DetectionSpeed(rawValue: speed)! |
| 124 | 121 | ||
| @@ -216,7 +213,6 @@ public class SwiftMobileScannerPlugin: NSObject, FlutterPlugin { | @@ -216,7 +213,6 @@ public class SwiftMobileScannerPlugin: NSObject, FlutterPlugin { | ||
| 216 | result(nil) | 213 | result(nil) |
| 217 | } | 214 | } |
| 218 | 215 | ||
| 219 | - | ||
| 220 | /// Toggles the torch | 216 | /// Toggles the torch |
| 221 | func updateScanWindow(_ call: FlutterMethodCall, _ result: @escaping FlutterResult) { | 217 | func updateScanWindow(_ call: FlutterMethodCall, _ result: @escaping FlutterResult) { |
| 222 | let scanWindowData: Array? = (call.arguments as? [String: Any])?["rect"] as? [CGFloat] | 218 | let scanWindowData: Array? = (call.arguments as? [String: Any])?["rect"] as? [CGFloat] |
-
Please register or login to post a comment