scandit-capacitor-datacapture-barcode 8.3.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.
- package/ScanditCapacitorDatacaptureBarcode.podspec +1 -1
- package/android/build.gradle +2 -2
- package/android/src/main/java/com/scandit/capacitor/datacapture/barcode/ScanditBarcodeNative.java +36 -12
- package/dist/barcode.js +333 -35
- package/dist/barcode.js.map +1 -1
- package/dist/dts/definitions.d.ts +6 -0
- package/dist/dts/ts/SparkScanView.d.ts +3 -1
- package/dist/index.js +107 -115
- package/dist/index.js.map +1 -1
- package/package.json +5 -4
package/android/build.gradle
CHANGED
|
@@ -143,7 +143,7 @@ if (ext.has('repos')) {
|
|
|
143
143
|
}
|
|
144
144
|
|
|
145
145
|
dependencies {
|
|
146
|
-
def sdk_version = "8.
|
|
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'])
|
|
@@ -153,7 +153,7 @@ dependencies {
|
|
|
153
153
|
if (findProject(':scandit-datacapture-frameworks-barcode') != null) {
|
|
154
154
|
api project(":scandit-datacapture-frameworks-barcode")
|
|
155
155
|
} else {
|
|
156
|
-
api "com.scandit.datacapture.frameworks:barcode:${safeExtGet('
|
|
156
|
+
api "com.scandit.datacapture.frameworks:barcode:${safeExtGet('frameworks_sdk_version', sdk_version)}"
|
|
157
157
|
}
|
|
158
158
|
|
|
159
159
|
implementation "androidx.core:core-ktx:$androidxCoreVersion"
|
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,20 +504,20 @@ 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;
|
|
490
|
-
|
|
491
|
-
barcodeArViewHandler.addBarcodeArViewContainer(viewId, container, getBridge());
|
|
507
|
+
barcodeArModule.addViewToContainer(container, finalViewJson, new NoopFrameworksResult());
|
|
492
508
|
|
|
493
|
-
|
|
494
|
-
} else {
|
|
509
|
+
if (container.getChildCount() == 0) {
|
|
495
510
|
call.reject("Unable to create the native BarcodeArModule");
|
|
511
|
+
return;
|
|
496
512
|
}
|
|
513
|
+
|
|
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();
|
|
497
521
|
});
|
|
498
522
|
}
|
|
499
523
|
|