scandit-capacitor-datacapture-barcode 7.5.1 → 7.6.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 +1 -1
- package/android/src/main/java/com/scandit/capacitor/datacapture/barcode/ScanditBarcodeNative.kt +103 -83
- package/dist/barcode.js +653 -264
- package/dist/barcode.js.map +1 -1
- package/dist/dts/definitions.d.ts +1 -1
- package/dist/dts/ts/BarcodeBatchAdvancedOverlay.d.ts +11 -2
- package/dist/dts/ts/BarcodeFindView.d.ts +11 -2
- package/dist/index.js +29 -9
- package/dist/index.js.map +1 -1
- package/ios/Plugin/ScanditBarcodeCapture.swift +72 -46
- package/package.json +4 -4
package/android/build.gradle
CHANGED
package/android/src/main/java/com/scandit/capacitor/datacapture/barcode/ScanditBarcodeNative.kt
CHANGED
|
@@ -75,7 +75,7 @@ class ScanditBarcodeNative :
|
|
|
75
75
|
|
|
76
76
|
private var corePlugin: PluginHandle? = null
|
|
77
77
|
private val barcodeModule = BarcodeModule()
|
|
78
|
-
private val barcodeCaptureModule = BarcodeCaptureModule(
|
|
78
|
+
private val barcodeCaptureModule = BarcodeCaptureModule.create(this)
|
|
79
79
|
private val barcodeBatchModule = BarcodeBatchModule.create(this)
|
|
80
80
|
private val barcodeSelectionModule = BarcodeSelectionModule(
|
|
81
81
|
FrameworksBarcodeSelectionListener(this),
|
|
@@ -214,24 +214,72 @@ class ScanditBarcodeNative :
|
|
|
214
214
|
call.resolve(defaults)
|
|
215
215
|
}
|
|
216
216
|
|
|
217
|
+
//region Barcode Capture Methods
|
|
218
|
+
|
|
217
219
|
@PluginMethod
|
|
218
220
|
fun registerBarcodeCaptureListenerForEvents(call: PluginCall) {
|
|
219
|
-
barcodeCaptureModule.addListener()
|
|
221
|
+
barcodeCaptureModule.addListener(getModeId(call))
|
|
220
222
|
call.resolve()
|
|
221
223
|
}
|
|
222
224
|
|
|
223
225
|
@PluginMethod
|
|
224
226
|
fun unregisterBarcodeCaptureListenerForEvents(call: PluginCall) {
|
|
225
|
-
barcodeCaptureModule.removeListener()
|
|
227
|
+
barcodeCaptureModule.removeListener(getModeId(call))
|
|
226
228
|
call.resolve()
|
|
227
229
|
}
|
|
228
230
|
|
|
229
231
|
@PluginMethod
|
|
230
232
|
fun setBarcodeCaptureModeEnabledState(call: PluginCall) {
|
|
231
|
-
barcodeCaptureModule.setModeEnabled(call.data.getBoolean("enabled"))
|
|
233
|
+
barcodeCaptureModule.setModeEnabled(getModeId(call), call.data.getBoolean("enabled"))
|
|
234
|
+
call.resolve()
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
@PluginMethod
|
|
238
|
+
fun finishBarcodeCaptureDidUpdateSession(call: PluginCall) {
|
|
239
|
+
barcodeCaptureModule.finishDidUpdateSession(getModeId(call), call.data.getBoolean("enabled"))
|
|
240
|
+
call.resolve()
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
@PluginMethod
|
|
244
|
+
fun finishBarcodeCaptureDidScan(call: PluginCall) {
|
|
245
|
+
barcodeCaptureModule.finishDidScan(getModeId(call), call.data.getBoolean("enabled"))
|
|
246
|
+
call.resolve()
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
@PluginMethod
|
|
250
|
+
fun resetBarcodeCaptureSession(call: PluginCall) {
|
|
251
|
+
barcodeCaptureModule.resetSession(call.data.getLong("frameSequenceId"))
|
|
232
252
|
call.resolve()
|
|
233
253
|
}
|
|
234
254
|
|
|
255
|
+
@PluginMethod
|
|
256
|
+
fun updateBarcodeCaptureOverlay(call: PluginCall) {
|
|
257
|
+
val overlayJson = call.data.getString("overlayJson")
|
|
258
|
+
?: return call.reject(WRONG_INPUT)
|
|
259
|
+
barcodeCaptureModule.updateOverlay(
|
|
260
|
+
getViewId(call),
|
|
261
|
+
overlayJson,
|
|
262
|
+
CapacitorResult(call)
|
|
263
|
+
)
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
@PluginMethod
|
|
267
|
+
fun updateBarcodeCaptureMode(call: PluginCall) {
|
|
268
|
+
val modeJson = call.data.getString("modeJson")
|
|
269
|
+
?: return call.reject(WRONG_INPUT)
|
|
270
|
+
barcodeCaptureModule.updateModeFromJson(modeJson, CapacitorResult(call))
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
@PluginMethod
|
|
274
|
+
fun applyBarcodeCaptureModeSettings(call: PluginCall) {
|
|
275
|
+
val modeId = getModeId(call)
|
|
276
|
+
val modeSettingsJson = call.data.getString("modeSettingsJson")
|
|
277
|
+
?: return call.reject(WRONG_INPUT)
|
|
278
|
+
barcodeCaptureModule.applyModeSettings(modeId, modeSettingsJson, CapacitorResult(call))
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
//endregion
|
|
282
|
+
|
|
235
283
|
@PluginMethod
|
|
236
284
|
fun registerBarcodeBatchListenerForEvents(call: PluginCall) {
|
|
237
285
|
barcodeBatchModule.addBarcodeBatchListener(getModeId(call))
|
|
@@ -247,7 +295,7 @@ class ScanditBarcodeNative :
|
|
|
247
295
|
@PluginMethod
|
|
248
296
|
fun finishBarcodeBatchDidUpdateSessionCallback(call: PluginCall) {
|
|
249
297
|
barcodeBatchModule.finishDidUpdateSession(
|
|
250
|
-
call
|
|
298
|
+
getModeId(call),
|
|
251
299
|
call.data.getBoolean("enabled")
|
|
252
300
|
)
|
|
253
301
|
call.resolve()
|
|
@@ -442,6 +490,12 @@ class ScanditBarcodeNative :
|
|
|
442
490
|
call.resolve()
|
|
443
491
|
}
|
|
444
492
|
|
|
493
|
+
@PluginMethod
|
|
494
|
+
fun resetBarcodeBatchSession(call: PluginCall) {
|
|
495
|
+
barcodeBatchModule.resetSession(null)
|
|
496
|
+
call.resolve()
|
|
497
|
+
}
|
|
498
|
+
|
|
445
499
|
@PluginMethod
|
|
446
500
|
fun setViewForTrackedBarcode(call: PluginCall) {
|
|
447
501
|
try {
|
|
@@ -544,18 +598,6 @@ class ScanditBarcodeNative :
|
|
|
544
598
|
)
|
|
545
599
|
}
|
|
546
600
|
|
|
547
|
-
@PluginMethod
|
|
548
|
-
fun resetBarcodeCaptureSession(call: PluginCall) {
|
|
549
|
-
barcodeCaptureModule.resetSession(null)
|
|
550
|
-
call.resolve()
|
|
551
|
-
}
|
|
552
|
-
|
|
553
|
-
@PluginMethod
|
|
554
|
-
fun resetBarcodeBatchSession(call: PluginCall) {
|
|
555
|
-
barcodeBatchModule.resetSession(null)
|
|
556
|
-
call.resolve()
|
|
557
|
-
}
|
|
558
|
-
|
|
559
601
|
@PluginMethod
|
|
560
602
|
fun resetBarcodeSelectionSession(call: PluginCall) {
|
|
561
603
|
barcodeSelectionModule.resetLatestSession(null)
|
|
@@ -603,50 +645,30 @@ class ScanditBarcodeNative :
|
|
|
603
645
|
call.reject(JsonParseError(error.message).toString())
|
|
604
646
|
}
|
|
605
647
|
|
|
606
|
-
@PluginMethod
|
|
607
|
-
fun finishBarcodeCaptureDidScan(call: PluginCall) {
|
|
608
|
-
barcodeCaptureModule.finishDidScan(call.data.getBoolean("enabled"))
|
|
609
|
-
call.resolve()
|
|
610
|
-
}
|
|
611
|
-
|
|
612
|
-
@PluginMethod
|
|
613
|
-
fun finishBarcodeCaptureDidUpdateSession(call: PluginCall) {
|
|
614
|
-
barcodeCaptureModule.finishDidUpdateSession(call.data.getBoolean("enabled"))
|
|
615
|
-
call.resolve()
|
|
616
|
-
}
|
|
617
|
-
|
|
618
|
-
@PluginMethod
|
|
619
|
-
fun setBarcodeSelectionModeEnabledState(call: PluginCall) {
|
|
620
|
-
barcodeSelectionModule.setModeEnabled(call.data.getBoolean("enabled"))
|
|
621
|
-
call.resolve()
|
|
622
|
-
}
|
|
623
|
-
|
|
624
648
|
//region BarcodeCount
|
|
625
649
|
|
|
626
|
-
//region Barcode Count Listener
|
|
627
|
-
@PluginMethod
|
|
628
|
-
fun finishBarcodeCountOnScan(call: PluginCall) {
|
|
629
|
-
barcodeCountModule.finishOnScan(getViewId(call), true)
|
|
630
|
-
call.resolve(null)
|
|
631
|
-
}
|
|
632
|
-
|
|
633
|
-
//endregion
|
|
634
|
-
|
|
635
650
|
@PluginMethod
|
|
636
651
|
fun createBarcodeCountView(call: PluginCall) {
|
|
637
|
-
val viewJson = call.data.getString("viewJson")
|
|
652
|
+
val viewJson = call.data.getString("viewJson")
|
|
653
|
+
if (viewJson == null) {
|
|
654
|
+
call.reject(WRONG_INPUT, "Missing or invalid viewJson")
|
|
655
|
+
return
|
|
656
|
+
}
|
|
657
|
+
|
|
638
658
|
val barcodeCountView = barcodeCountModule.getViewFromJson(viewJson)
|
|
639
659
|
if (barcodeCountView == null) {
|
|
640
660
|
call.reject("Unable to create the BarcodeCountView from the given json=$viewJson")
|
|
641
661
|
return
|
|
642
662
|
}
|
|
643
663
|
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
664
|
+
mainThread.runOnMainThread {
|
|
665
|
+
barcodeCountViewHandler.attachBarcodeCountView(
|
|
666
|
+
barcodeCountView,
|
|
667
|
+
bridge.activity
|
|
668
|
+
)
|
|
669
|
+
barcodeCountViewHandler.render()
|
|
670
|
+
call.resolve()
|
|
671
|
+
}
|
|
650
672
|
}
|
|
651
673
|
|
|
652
674
|
@PluginMethod
|
|
@@ -658,24 +680,40 @@ class ScanditBarcodeNative :
|
|
|
658
680
|
|
|
659
681
|
@PluginMethod
|
|
660
682
|
fun updateBarcodeCountView(call: PluginCall) {
|
|
661
|
-
val
|
|
662
|
-
if (
|
|
683
|
+
val currentView = barcodeCountViewHandler.currentBarcodeCountView
|
|
684
|
+
if (currentView == null) {
|
|
663
685
|
call.reject("The barcode count view has not been initialized yet.")
|
|
664
686
|
return
|
|
665
687
|
}
|
|
666
688
|
|
|
667
|
-
val viewJson = call.data.getString("viewJson")
|
|
689
|
+
val viewJson = call.data.getString("viewJson")
|
|
690
|
+
if (viewJson.isNullOrEmpty()) {
|
|
691
|
+
call.reject("viewJson is required", WRONG_INPUT)
|
|
692
|
+
return
|
|
693
|
+
}
|
|
694
|
+
|
|
668
695
|
barcodeCountModule.updateBarcodeCountView(getViewId(call), viewJson)
|
|
669
696
|
call.resolve()
|
|
670
697
|
}
|
|
671
698
|
|
|
672
699
|
@PluginMethod
|
|
673
700
|
fun updateBarcodeCountMode(call: PluginCall) {
|
|
674
|
-
val barcodeCountJson = call.data.getString("barcodeCountJson")
|
|
701
|
+
val barcodeCountJson = call.data.getString("barcodeCountJson")
|
|
702
|
+
if (barcodeCountJson == null) {
|
|
703
|
+
call.reject(WRONG_INPUT, "barcodeCountJson is required")
|
|
704
|
+
return
|
|
705
|
+
}
|
|
706
|
+
|
|
675
707
|
barcodeCountModule.updateBarcodeCount(getViewId(call), barcodeCountJson)
|
|
676
708
|
call.resolve()
|
|
677
709
|
}
|
|
678
710
|
|
|
711
|
+
@PluginMethod
|
|
712
|
+
fun finishBarcodeCountOnScan(call: PluginCall) {
|
|
713
|
+
barcodeCountModule.finishOnScan(getViewId(call), true)
|
|
714
|
+
call.resolve(null)
|
|
715
|
+
}
|
|
716
|
+
|
|
679
717
|
@PluginMethod
|
|
680
718
|
fun registerBarcodeCountListener(call: PluginCall) {
|
|
681
719
|
barcodeCountModule.addBarcodeCountListener(getViewId(call))
|
|
@@ -826,8 +864,6 @@ class ScanditBarcodeNative :
|
|
|
826
864
|
barcodeCountModule.updateFeedback(getViewId(call), feedbackJson, CapacitorResult(call))
|
|
827
865
|
}
|
|
828
866
|
|
|
829
|
-
//endregion
|
|
830
|
-
|
|
831
867
|
@PluginMethod
|
|
832
868
|
fun finishBarcodeCountBrushForRecognizedBarcode(call: PluginCall) {
|
|
833
869
|
val brushJson = call.data.optString("brushJson", "")
|
|
@@ -951,8 +987,10 @@ class ScanditBarcodeNative :
|
|
|
951
987
|
|
|
952
988
|
val container = barcodeFindViewHandler.prepareContainer(this.context)
|
|
953
989
|
|
|
954
|
-
|
|
955
|
-
|
|
990
|
+
container.post {
|
|
991
|
+
barcodeFindModule.addViewToContainer(container, viewJson, CapacitorResult(call))
|
|
992
|
+
barcodeFindViewHandler.addBarcodeFindViewContainer(getViewId(call), container, bridge.activity)
|
|
993
|
+
}
|
|
956
994
|
}
|
|
957
995
|
|
|
958
996
|
@PluginMethod
|
|
@@ -1102,11 +1140,14 @@ class ScanditBarcodeNative :
|
|
|
1102
1140
|
|
|
1103
1141
|
viewJson?.let {
|
|
1104
1142
|
val container = barcodePickViewHandler.prepareContainer(this.context)
|
|
1105
|
-
barcodePickModule.addViewToContainer(container, viewJson, CapacitorResult(call))
|
|
1106
1143
|
|
|
1107
|
-
|
|
1108
|
-
|
|
1144
|
+
container.post {
|
|
1145
|
+
barcodePickModule.addViewToContainer(container, viewJson, CapacitorResult(call))
|
|
1109
1146
|
|
|
1147
|
+
barcodePickViewHandler.addBarcodePickViewContainer(container, bridge.activity)
|
|
1148
|
+
barcodePickViewHandler.render()
|
|
1149
|
+
|
|
1150
|
+
}
|
|
1110
1151
|
call.resolve()
|
|
1111
1152
|
} ?: run {
|
|
1112
1153
|
call.reject("missing parameter for createPickView()")
|
|
@@ -1267,27 +1308,6 @@ class ScanditBarcodeNative :
|
|
|
1267
1308
|
|
|
1268
1309
|
//endregion
|
|
1269
1310
|
|
|
1270
|
-
@PluginMethod
|
|
1271
|
-
fun updateBarcodeCaptureOverlay(call: PluginCall) {
|
|
1272
|
-
val overlayJson = call.data.getString("overlayJson")
|
|
1273
|
-
?: return call.reject(WRONG_INPUT)
|
|
1274
|
-
barcodeCaptureModule.updateOverlay(overlayJson, CapacitorResult(call))
|
|
1275
|
-
}
|
|
1276
|
-
|
|
1277
|
-
@PluginMethod
|
|
1278
|
-
fun updateBarcodeCaptureMode(call: PluginCall) {
|
|
1279
|
-
val modeJson = call.data.getString("modeJson")
|
|
1280
|
-
?: return call.reject(WRONG_INPUT)
|
|
1281
|
-
barcodeCaptureModule.updateModeFromJson(modeJson, CapacitorResult(call))
|
|
1282
|
-
}
|
|
1283
|
-
|
|
1284
|
-
@PluginMethod
|
|
1285
|
-
fun applyBarcodeCaptureModeSettings(call: PluginCall) {
|
|
1286
|
-
val modeSettingsJson = call.data.getString("modeSettingsJson")
|
|
1287
|
-
?: return call.reject(WRONG_INPUT)
|
|
1288
|
-
barcodeCaptureModule.applyModeSettings(modeSettingsJson, CapacitorResult(call))
|
|
1289
|
-
}
|
|
1290
|
-
|
|
1291
1311
|
@PluginMethod
|
|
1292
1312
|
fun updateBarcodeSelectionBasicOverlay(call: PluginCall) {
|
|
1293
1313
|
val overlayJson = call.data.getString("overlayJson")
|