scandit-capacitor-datacapture-barcode 7.0.2 → 7.1.0-beta.2

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", '= 7.0.2'
20
+ s.dependency "scandit-datacapture-frameworks-barcode", '= 7.1.0-beta.2'
21
21
  end
@@ -11,7 +11,7 @@ def safeExtGet(prop, fallback) {
11
11
  buildscript {
12
12
  ext {
13
13
  kotlin_version = "1.8.20"
14
- agp_version = "8.1.0"
14
+ agp_version = "8.5.1"
15
15
  }
16
16
  repositories {
17
17
  google()
@@ -56,7 +56,7 @@ repositories {
56
56
  }
57
57
 
58
58
  dependencies {
59
- def sdk_version = "7.0.2"
59
+ def sdk_version = "7.1.0-beta.2"
60
60
 
61
61
  implementation fileTree(dir: 'libs', include: ['*.jar'])
62
62
  implementation fileTree(dir: 'library', include: ['*.aar'])
@@ -540,11 +540,9 @@ class ScanditBarcodeNative :
540
540
 
541
541
  @PluginMethod
542
542
  fun getCountForBarcodeInBarcodeSelectionSession(call: PluginCall) {
543
- val count: Int = barcodeSelectionModule.getBarcodeCount(
544
- call.data.getString("selectionIdentifier").orEmpty()
545
- )
546
- CapacitorResult(call).success(
547
- mapOf("data" to count)
543
+ barcodeSelectionModule.submitBarcodeCountForIdentifier(
544
+ call.data.getString("selectionIdentifier").orEmpty(),
545
+ CapacitorResult(call)
548
546
  )
549
547
  }
550
548
 
@@ -653,6 +651,13 @@ class ScanditBarcodeNative :
653
651
  call.resolve()
654
652
  }
655
653
 
654
+ @PluginMethod
655
+ fun removeView(call: PluginCall) {
656
+ barcodeCountModule.viewDisposed()
657
+ barcodeCountViewHandler.disposeCurrentView()
658
+ call.resolve()
659
+ }
660
+
656
661
  @PluginMethod
657
662
  fun updateView(call: PluginCall) {
658
663
  val view = barcodeCountViewHandler.barcodeCountView
@@ -776,8 +781,7 @@ class ScanditBarcodeNative :
776
781
 
777
782
  @PluginMethod
778
783
  fun getSpatialMap(call: PluginCall) {
779
- val map = barcodeCountModule.getSpatialMap()
780
- call.resolve(JSObject().putSafe("data", map?.toJson()))
784
+ barcodeCountModule.submitSpatialMap(CapacitorResult(call))
781
785
  }
782
786
 
783
787
  @PluginMethod
@@ -786,8 +790,11 @@ class ScanditBarcodeNative :
786
790
  ?: return call.reject("No expectedNumberOfRows was provided for the function.")
787
791
  val expectedNumberOfColumns = call.data.getInteger("expectedNumberOfColumns")
788
792
  ?: return call.reject("No expectedNumberOfColumns was provided for the function.")
789
- val map = barcodeCountModule.getSpatialMap(expectedNumberOfRows, expectedNumberOfColumns)
790
- call.resolve(JSObject().putSafe("data", map?.toJson()))
793
+ barcodeCountModule.submitSpatialMap(
794
+ expectedNumberOfRows,
795
+ expectedNumberOfColumns,
796
+ CapacitorResult(call)
797
+ )
791
798
  }
792
799
 
793
800
  @PluginMethod
@@ -811,8 +818,8 @@ class ScanditBarcodeNative :
811
818
  @PluginMethod
812
819
  fun finishBarcodeCountViewListenerBrushForRecognizedBarcode(call: PluginCall) {
813
820
  val brushJson = call.data.optString("brush", "")
814
- val brush = if (brushJson.isBlank()) null else BrushDeserializer.fromJson(brushJson)
815
- val trackedBarcodeId = call.data.getInt("trackedBarcodeID")
821
+ val brush = if (brushJson.isNullOrBlank()) null else BrushDeserializer.fromJson(brushJson)
822
+ val trackedBarcodeId = call.data.getInt("trackedBarcodeId")
816
823
  barcodeCountModule.finishBrushForRecognizedBarcodeEvent(brush, trackedBarcodeId)
817
824
  call.resolve()
818
825
  }
@@ -820,21 +827,38 @@ class ScanditBarcodeNative :
820
827
  @PluginMethod
821
828
  fun finishBarcodeCountViewListenerBrushForRecognizedBarcodeNotInList(call: PluginCall) {
822
829
  val brushJson = call.data.optString("brush", "")
823
- val brush = if (brushJson.isBlank()) null else BrushDeserializer.fromJson(brushJson)
824
- val trackedBarcodeId = call.data.getInt("trackedBarcodeID")
830
+ val brush = if (brushJson.isNullOrBlank()) null else BrushDeserializer.fromJson(brushJson)
831
+ val trackedBarcodeId = call.data.getInt("trackedBarcodeId")
825
832
  barcodeCountModule.finishBrushForRecognizedBarcodeNotInListEvent(brush, trackedBarcodeId)
826
833
  call.resolve()
827
834
  }
828
835
 
829
836
  @PluginMethod
830
- fun finishBarcodeCountViewListenerOnBrushForUnrecognizedBarcode(call: PluginCall) {
837
+ fun finishBarcodeCountViewListenerOnBrushForAcceptedBarcode(call: PluginCall) {
831
838
  val brushJson = call.data.optString("brush", "")
832
- val brush = if (brushJson.isBlank()) null else BrushDeserializer.fromJson(brushJson)
833
- val trackedBarcodeId = call.data.getInt("trackedBarcodeID")
834
- barcodeCountModule.finishBrushForUnrecognizedBarcodeEvent(brush, trackedBarcodeId)
839
+ val brush = if (brushJson.isNullOrBlank()) null else BrushDeserializer.fromJson(brushJson)
840
+ val trackedBarcodeId = call.data.getInt("trackedBarcodeId")
841
+ barcodeCountModule.finishBrushForAcceptedBarcodeEvent(brush, trackedBarcodeId)
835
842
  call.resolve()
836
843
  }
837
844
 
845
+ @PluginMethod
846
+ fun finishBarcodeCountViewListenerOnBrushForRejectedBarcode(call: PluginCall) {
847
+ val brushJson = call.data.optString("brush", "")
848
+ val brush = if (brushJson.isNullOrBlank()) null else BrushDeserializer.fromJson(brushJson)
849
+ val trackedBarcodeId = call.data.getInt("trackedBarcodeId")
850
+ barcodeCountModule.finishBrushForRejectedBarcodeEvent(brush, trackedBarcodeId)
851
+ call.resolve()
852
+ }
853
+
854
+ @PluginMethod
855
+ fun barcodeCountViewEnableHardwareTrigger(call: PluginCall) {
856
+ barcodeCountModule.enableHardwareTrigger(
857
+ call.data.getInteger("hardwareTriggerKeyCode"),
858
+ CapacitorResult(call)
859
+ )
860
+ }
861
+
838
862
  //endregion
839
863
 
840
864
  private fun getBitmapFromBase64EncodedViewData(baseEncodedViewData: String?): Bitmap? {
@@ -852,8 +876,11 @@ class ScanditBarcodeNative :
852
876
  }
853
877
 
854
878
  override fun emit(eventName: String, payload: MutableMap<String, Any?>) {
855
- payload["name"] = eventName
856
- notifyListeners(eventName, JSObject.fromJSONObject(JSONObject(payload)))
879
+ val capacitorPayload = JSObject()
880
+ capacitorPayload.put("name", eventName)
881
+ capacitorPayload.put("data", JSONObject(payload).toString())
882
+
883
+ notifyListeners(eventName, capacitorPayload)
857
884
  }
858
885
 
859
886
  override fun hasListenersForEvent(eventName: String): Boolean = this.hasListeners(eventName)
@@ -1055,6 +1082,13 @@ class ScanditBarcodeNative :
1055
1082
  }
1056
1083
  }
1057
1084
 
1085
+ @PluginMethod
1086
+ fun removePickView(call: PluginCall) {
1087
+ barcodePickModule.viewDisposed()
1088
+ barcodePickViewHandler.disposeCurrentView()
1089
+ call.resolve()
1090
+ }
1091
+
1058
1092
  @PluginMethod
1059
1093
  fun updatePickView(call: PluginCall) {
1060
1094
  val viewJson = call.data.toString()
@@ -67,7 +67,7 @@ internal class BarcodeCountViewHandler (
67
67
  disposeCurrentWebView()
68
68
  }
69
69
 
70
- private fun disposeCurrentView() {
70
+ fun disposeCurrentView() {
71
71
  val view = barcodeCountView ?: return
72
72
  removeBarcodeCountView(view)
73
73
  }
@@ -69,7 +69,7 @@ class BarcodePickViewHandler (
69
69
  disposeCurrentWebView()
70
70
  }
71
71
 
72
- private fun disposeCurrentView() {
72
+ fun disposeCurrentView() {
73
73
  val view = barcodePickViewContainer ?: return
74
74
  removeBarcodePickViewContainer(view)
75
75
  }
@@ -136,4 +136,4 @@ class BarcodePickViewHandler (
136
136
  barcodePickViewContainer.requestLayout()
137
137
  }
138
138
  }
139
- }
139
+ }