capacitor-camera-module 0.0.31 → 0.0.33
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.
|
@@ -63,11 +63,13 @@ import androidx.camera.core.ImageAnalysis;
|
|
|
63
63
|
import android.content.Context;
|
|
64
64
|
|
|
65
65
|
import com.google.mlkit.vision.common.InputImage;
|
|
66
|
-
import com.google.mlkit.vision.barcode.Barcode;
|
|
66
|
+
import com.google.mlkit.vision.barcode.common.Barcode;
|
|
67
67
|
import com.google.mlkit.vision.barcode.BarcodeScanner;
|
|
68
68
|
import com.google.mlkit.vision.barcode.BarcodeScanning;
|
|
69
69
|
|
|
70
70
|
|
|
71
|
+
|
|
72
|
+
|
|
71
73
|
@CapacitorPlugin(
|
|
72
74
|
name = "CameraModule",
|
|
73
75
|
permissions = {
|
|
@@ -651,6 +653,16 @@ public class CameraModulePlugin extends Plugin {
|
|
|
651
653
|
@PluginMethod
|
|
652
654
|
public void startBarcodeScan(PluginCall call) {
|
|
653
655
|
|
|
656
|
+
if (previewView == null) {
|
|
657
|
+
call.reject("Preview not started");
|
|
658
|
+
return;
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
if (getPermissionState("camera") != PermissionState.GRANTED) {
|
|
662
|
+
call.reject("Camera permission not granted");
|
|
663
|
+
return;
|
|
664
|
+
}
|
|
665
|
+
|
|
654
666
|
if (cameraProvider == null) {
|
|
655
667
|
call.reject("Camera not initialized");
|
|
656
668
|
return;
|
|
@@ -673,7 +685,7 @@ public class CameraModulePlugin extends Plugin {
|
|
|
673
685
|
|
|
674
686
|
imageAnalysis.setAnalyzer(
|
|
675
687
|
ContextCompat.getMainExecutor(getContext()),
|
|
676
|
-
|
|
688
|
+
this::processBarcode
|
|
677
689
|
);
|
|
678
690
|
|
|
679
691
|
cameraProvider.unbindAll();
|