scandit-capacitor-datacapture-barcode 8.4.0-beta.1 → 8.4.1
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.
|
@@ -17,5 +17,5 @@ Pod::Spec.new do |s|
|
|
|
17
17
|
|
|
18
18
|
s.dependency "Capacitor"
|
|
19
19
|
s.dependency "ScanditCapacitorDatacaptureCore", "= #{version}"
|
|
20
|
-
s.dependency "scandit-datacapture-frameworks-barcode", '= 8.4.
|
|
20
|
+
s.dependency "scandit-datacapture-frameworks-barcode", '= 8.4.1'
|
|
21
21
|
end
|
package/android/build.gradle
CHANGED
package/android/src/main/java/com/scandit/capacitor/datacapture/barcode/ScanditBarcodeNative.java
CHANGED
|
@@ -42,6 +42,7 @@ import com.scandit.datacapture.frameworks.core.FrameworkModule;
|
|
|
42
42
|
import com.scandit.datacapture.frameworks.core.errors.ParameterNullError;
|
|
43
43
|
import com.scandit.datacapture.frameworks.core.events.Emitter;
|
|
44
44
|
import com.scandit.datacapture.frameworks.core.locator.DefaultServiceLocator;
|
|
45
|
+
import com.scandit.datacapture.frameworks.core.result.NoopFrameworksResult;
|
|
45
46
|
import com.scandit.datacapture.frameworks.core.utils.DefaultFrameworksLog;
|
|
46
47
|
import com.scandit.datacapture.frameworks.core.utils.DefaultMainThread;
|
|
47
48
|
import com.scandit.datacapture.frameworks.core.utils.FrameworksLog;
|
|
@@ -472,7 +473,30 @@ public class ScanditBarcodeNative extends Plugin implements Emitter {
|
|
|
472
473
|
return;
|
|
473
474
|
}
|
|
474
475
|
|
|
475
|
-
|
|
476
|
+
// BarcodeAr manages its own camera (like SparkScan) and the JS sample fires
|
|
477
|
+
// camera.switchToDesiredState(On) immediately after connectToElement resolves,
|
|
478
|
+
// so the view must only be created (and the call only resolved) once the user
|
|
479
|
+
// has granted the camera permission — otherwise the camera-on call races the
|
|
480
|
+
// OS dialog and the user sees a black preview on first launch.
|
|
481
|
+
if (!checkCameraPermission()) {
|
|
482
|
+
requestPermissionForAlias("camera", call, "onBarcodeArCameraPermissionResult");
|
|
483
|
+
return;
|
|
484
|
+
}
|
|
485
|
+
attachBarcodeArView(call);
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
@SuppressWarnings("unused")
|
|
489
|
+
@PermissionCallback
|
|
490
|
+
private void onBarcodeArCameraPermissionResult(PluginCall call) {
|
|
491
|
+
if (!checkCameraPermission()) {
|
|
492
|
+
call.reject("Camera permissions not granted.");
|
|
493
|
+
return;
|
|
494
|
+
}
|
|
495
|
+
attachBarcodeArView(call);
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
private void attachBarcodeArView(PluginCall call) {
|
|
499
|
+
final String finalViewJson = call.getData().getString("viewJson");
|
|
476
500
|
mainThread.runOnMainThread(
|
|
477
501
|
() -> {
|
|
478
502
|
FrameLayout container = new FrameLayout(getBridge().getContext());
|
|
@@ -480,27 +504,21 @@ public class ScanditBarcodeNative extends Plugin implements Emitter {
|
|
|
480
504
|
container.setMinimumWidth(getBridge().getWebView().getWidth());
|
|
481
505
|
container.setBackgroundColor(Color.TRANSPARENT);
|
|
482
506
|
|
|
483
|
-
barcodeArModule.addViewToContainer(container, finalViewJson, new
|
|
484
|
-
|
|
485
|
-
// Assume the view was added successfully - the container should have children now
|
|
486
|
-
if (container.getChildCount() > 0) {
|
|
487
|
-
android.view.View nativeView = container.getChildAt(0);
|
|
488
|
-
Object tag = nativeView.getTag();
|
|
489
|
-
int viewId = (tag instanceof Integer) ? (Integer) tag : 0;
|
|
507
|
+
barcodeArModule.addViewToContainer(container, finalViewJson, new NoopFrameworksResult());
|
|
490
508
|
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
call.resolve();
|
|
494
|
-
} else {
|
|
509
|
+
if (container.getChildCount() == 0) {
|
|
495
510
|
call.reject("Unable to create the native BarcodeArModule");
|
|
511
|
+
return;
|
|
496
512
|
}
|
|
497
|
-
});
|
|
498
513
|
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
514
|
+
android.view.View nativeView = container.getChildAt(0);
|
|
515
|
+
Object tag = nativeView.getTag();
|
|
516
|
+
int viewId = (tag instanceof Integer) ? (Integer) tag : 0;
|
|
517
|
+
|
|
518
|
+
barcodeArViewHandler.addBarcodeArViewContainer(viewId, container, getBridge());
|
|
519
|
+
|
|
520
|
+
call.resolve();
|
|
521
|
+
});
|
|
504
522
|
}
|
|
505
523
|
|
|
506
524
|
@PluginMethod
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "scandit-capacitor-datacapture-barcode",
|
|
3
|
-
"version": "8.4.
|
|
3
|
+
"version": "8.4.1",
|
|
4
4
|
"description": "Scandit Data Capture SDK for Capacitor",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"private": false,
|
|
@@ -21,9 +21,9 @@
|
|
|
21
21
|
"watch": "tsc --watch"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"scandit-capacitor-datacapture-core": "8.4.
|
|
25
|
-
"scandit-datacapture-frameworks-barcode": "8.4.
|
|
26
|
-
"scandit-datacapture-frameworks-core": "8.4.
|
|
24
|
+
"scandit-capacitor-datacapture-core": "8.4.1",
|
|
25
|
+
"scandit-datacapture-frameworks-barcode": "8.4.1",
|
|
26
|
+
"scandit-datacapture-frameworks-core": "8.4.1"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@babel/plugin-proposal-class-properties": "^7.18.6",
|