scandit-capacitor-datacapture-barcode 8.4.0-beta.1 → 8.4.0

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.0-beta.1'
20
+ s.dependency "scandit-datacapture-frameworks-barcode", '= 8.4.0'
21
21
  end
@@ -143,7 +143,7 @@ if (ext.has('repos')) {
143
143
  }
144
144
 
145
145
  dependencies {
146
- def sdk_version = "8.4.0-beta.1"
146
+ def sdk_version = "8.4.0"
147
147
 
148
148
  implementation fileTree(dir: 'libs', include: ['*.jar'])
149
149
  implementation fileTree(dir: 'library', include: ['*.aar'])
@@ -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
- final String finalViewJson = viewJson;
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 CapacitorResult(call));
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
- barcodeArViewHandler.addBarcodeArViewContainer(viewId, container, getBridge());
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
- // BarcodeAr manages its own camera (like SparkScan), so it bypasses the
500
- // DataCaptureContext switchCameraToDesiredState path that normally triggers the
501
- // permission dialog. Without this call the camera permission is never requested
502
- // and BarcodeAr shows a black screen on first launch.
503
- checkOrRequestCameraPermissions(call);
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.0-beta.1",
3
+ "version": "8.4.0",
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.0-beta.1",
25
- "scandit-datacapture-frameworks-barcode": "8.4.0-beta.1",
26
- "scandit-datacapture-frameworks-core": "8.4.0-beta.1"
24
+ "scandit-capacitor-datacapture-core": "8.4.0",
25
+ "scandit-datacapture-frameworks-barcode": "8.4.0",
26
+ "scandit-datacapture-frameworks-core": "8.4.0"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@babel/plugin-proposal-class-properties": "^7.18.6",