@momo-kits/camerakit 0.158.1-sp.2 → 0.159.1-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -84,13 +84,11 @@ public class CameraView: UIView {
|
|
|
84
84
|
private func setupCamera() {
|
|
85
85
|
if hasPropBeenSetup && hasPermissionBeenGranted && !hasCameraBeenSetup {
|
|
86
86
|
hasCameraBeenSetup = true
|
|
87
|
-
// Always pass supportedBarcodeType when scanBarcode is enabled.
|
|
88
|
-
// onReadCode may arrive in a later prop batch (common when package is consumed externally),
|
|
89
|
-
// and the barcode callback in isBarcodeScannerEnabled resolves onReadCode at detection time.
|
|
90
87
|
#if targetEnvironment(macCatalyst)
|
|
91
|
-
|
|
88
|
+
// Force front camera on Mac Catalyst during initial setup
|
|
89
|
+
camera.setup(cameraType: .front, supportedBarcodeType: scanBarcode && onReadCode != nil ? supportedBarcodeType : [])
|
|
92
90
|
#else
|
|
93
|
-
camera.setup(cameraType: cameraType, supportedBarcodeType: scanBarcode ? supportedBarcodeType : [])
|
|
91
|
+
camera.setup(cameraType: cameraType, supportedBarcodeType: scanBarcode && onReadCode != nil ? supportedBarcodeType : [])
|
|
94
92
|
#endif
|
|
95
93
|
}
|
|
96
94
|
}
|
|
@@ -518,10 +518,7 @@ class RealCamera: NSObject, CameraProtocol, AVCaptureMetadataOutputObjectsDelega
|
|
|
518
518
|
onBarcodeRead: ((_ barcode: String,_ codeFormat:CodeFormat) -> Void)?) {
|
|
519
519
|
sessionQueue.async {
|
|
520
520
|
self.onBarcodeRead = onBarcodeRead
|
|
521
|
-
|
|
522
|
-
// Skip if session hasn't been set up yet — setup() will configure barcode types
|
|
523
|
-
guard self.setupResult == .success else { return }
|
|
524
|
-
|
|
521
|
+
|
|
525
522
|
let availableTypes = self.metadataOutput.availableMetadataObjectTypes
|
|
526
523
|
let newTypes: [AVMetadataObject.ObjectType]
|
|
527
524
|
if isEnabled && onBarcodeRead != nil {
|
|
@@ -590,16 +587,7 @@ class RealCamera: NSObject, CameraProtocol, AVCaptureMetadataOutputObjectsDelega
|
|
|
590
587
|
self.videoDataOutput.videoSettings = [
|
|
591
588
|
kCVPixelBufferPixelFormatTypeKey as String: kCVPixelFormatType_420YpCbCr8BiPlanarFullRange
|
|
592
589
|
]
|
|
593
|
-
|
|
594
|
-
// Add videoDataOutput to session if not already added (handles late prop arrival)
|
|
595
|
-
if self.setupResult == .success && !self.session.outputs.contains(self.videoDataOutput) {
|
|
596
|
-
self.session.beginConfiguration()
|
|
597
|
-
if self.session.canAddOutput(self.videoDataOutput) {
|
|
598
|
-
self.session.addOutput(self.videoDataOutput)
|
|
599
|
-
}
|
|
600
|
-
self.session.commitConfiguration()
|
|
601
|
-
}
|
|
602
|
-
|
|
590
|
+
|
|
603
591
|
} else {
|
|
604
592
|
self.textRequest = nil
|
|
605
593
|
}
|