Skip to content

Commit

Permalink
quick fix iOS build
Browse files Browse the repository at this point in the history
  • Loading branch information
Verbruik committed Aug 31, 2023
1 parent 1726c98 commit 7d63c72
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 6 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
.packages
build/

/example/pubspec.lock
/android/local.properties
/android/.gradle/
/android/gradlew
Expand Down
7 changes: 3 additions & 4 deletions ios/Classes/BarcodeScannerController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ class BarcodeScannerController: UIViewController, AVCaptureMetadataOutputObjects
AVMetadataObject.ObjectType.ean8,
AVMetadataObject.ObjectType.ean13,
AVMetadataObject.ObjectType.itf14,
AVMetadataObject.ObjectType.codabar,
AVMetadataObject.ObjectType.dataMatrix,
AVMetadataObject.ObjectType.qr,
AVMetadataObject.ObjectType.upce]
Expand Down Expand Up @@ -68,7 +67,7 @@ class BarcodeScannerController: UIViewController, AVCaptureMetadataOutputObjects
let deviceDiscoverySession = AVCaptureDevice.DiscoverySession(deviceTypes: [.builtInWideAngleCamera], mediaType: AVMediaType.video, position: .back)
// Get the back-facing camera for capturing videos
guard let captureDevice = deviceDiscoverySession.devices.first else {
barcodeStream?(FlutterError(code: "native_scanner_failed", message: "Failed to get the camera device", details: nil)
barcodeStream?(FlutterError(code: "native_scanner_failed", message: "Failed to get the camera device", details: nil))
return
}

Expand Down Expand Up @@ -113,7 +112,7 @@ class BarcodeScannerController: UIViewController, AVCaptureMetadataOutputObjects

// Check if the metadataObjects array is not nil and it contains at least one object.
if metadataObjects.count == 0 {
barcodeStream?(FlutterError(code: "native_scanner_failed", message: "metadataObjects array is nil or doesn't contains any object", details: nil)
barcodeStream?(FlutterError(code: "native_scanner_failed", message: "metadataObjects array is nil or doesn't contains any object", details: nil))
return
}

Expand All @@ -124,7 +123,7 @@ class BarcodeScannerController: UIViewController, AVCaptureMetadataOutputObjects
barcodeStream?(["barcode": metadataObj.stringValue!, "format": convertBarcodeType(type: metadataObj.type)])
}
} else {
barcodeStream?(FlutterError(code: "native_scanner_failed", message: "unsupported barcode type", details: "barcode type : \(metadataObj.type)")
barcodeStream?(FlutterError(code: "native_scanner_failed", message: "unsupported barcode type", details: "barcode type : \(metadataObj.type)"))
barcodeStream?(["barcode": "", "format": -1])
}
}
Expand Down
1 change: 0 additions & 1 deletion ios/Classes/Constants.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ struct BarcodeFormats {
static let EAN_8: Int = 3
static let EAN_13: Int = 4
static let ITF: Int = 5
static let CODABAR: Int = 6
static let DATAMATRIX: Int = 7
static let QR_CODE: Int = 8
static let UPC_E: Int = 10
Expand Down

0 comments on commit 7d63c72

Please sign in to comment.