scandit-capacitor-datacapture-barcode 7.2.0 → 7.3.0-beta.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", '= 7.2.0'
20
+ s.dependency "scandit-datacapture-frameworks-barcode", '= 7.3.0-beta.1'
21
21
  end
@@ -89,7 +89,7 @@ repositories {
89
89
  }
90
90
 
91
91
  dependencies {
92
- def sdk_version = "7.2.0"
92
+ def sdk_version = "7.3.0-beta.1"
93
93
 
94
94
  implementation fileTree(dir: 'libs', include: ['*.jar'])
95
95
  implementation fileTree(dir: 'library', include: ['*.aar'])
@@ -9,7 +9,6 @@ import android.Manifest
9
9
  import android.graphics.Bitmap
10
10
  import android.graphics.BitmapFactory
11
11
  import android.util.Base64
12
- import android.view.View
13
12
  import android.view.ViewGroup
14
13
  import android.view.ViewGroup.LayoutParams.WRAP_CONTENT
15
14
  import com.getcapacitor.JSObject
@@ -57,9 +56,6 @@ import com.scandit.datacapture.frameworks.barcode.selection.listeners.Frameworks
57
56
  import com.scandit.datacapture.frameworks.barcode.selection.listeners.FrameworksBarcodeSelectionListener
58
57
  import com.scandit.datacapture.frameworks.barcode.selection.listeners.FrameworksBarcodeSelectionTrackedBrushProvider
59
58
  import com.scandit.datacapture.frameworks.barcode.spark.SparkScanModule
60
- import com.scandit.datacapture.frameworks.barcode.spark.delegates.FrameworksSparkScanFeedbackDelegate
61
- import com.scandit.datacapture.frameworks.barcode.spark.listeners.FrameworksSparkScanListener
62
- import com.scandit.datacapture.frameworks.barcode.spark.listeners.FrameworksSparkScanViewUiListener
63
59
  import com.scandit.datacapture.frameworks.core.events.Emitter
64
60
  import com.scandit.datacapture.frameworks.core.utils.DefaultFrameworksLog
65
61
  import com.scandit.datacapture.frameworks.core.utils.DefaultMainThread
@@ -116,11 +112,7 @@ class ScanditBarcodeNative :
116
112
  private val barcodePickModule = BarcodePickModule(
117
113
  this
118
114
  )
119
- private val sparkScanModule = SparkScanModule(
120
- FrameworksSparkScanListener(this),
121
- FrameworksSparkScanViewUiListener(this),
122
- FrameworksSparkScanFeedbackDelegate(this)
123
- )
115
+ private val sparkScanModule = SparkScanModule.create(this)
124
116
 
125
117
  private val barcodeGeneratorModule = BarcodeGeneratorModule()
126
118
 
@@ -735,7 +727,9 @@ class ScanditBarcodeNative :
735
727
 
736
728
  @PluginMethod
737
729
  fun setBarcodeCountCaptureList(call: PluginCall) {
738
- if (!call.data.has("TargetBarcodes") || call.data.getJSONArray("TargetBarcodes").length() == 0) {
730
+ if (!call.data.has("TargetBarcodes") || call.data.getJSONArray("TargetBarcodes")
731
+ .length() == 0
732
+ ) {
739
733
  call.reject("No data provided")
740
734
  return
741
735
  }
@@ -889,6 +883,10 @@ class ScanditBarcodeNative :
889
883
 
890
884
  override fun hasListenersForEvent(eventName: String): Boolean = this.hasListeners(eventName)
891
885
 
886
+ override fun hasViewSpecificListenersForEvent(viewId: Int, eventName: String): Boolean {
887
+ return this.hasListenersForEvent(eventName)
888
+ }
889
+
892
890
  private fun isFinishBarcodeSelectionDidUpdateSession(data: JSONObject): Boolean {
893
891
  return checkFinishCallbackIdFieldForValue(
894
892
  data, BarcodeCaptureActionFactory.ACTION_SELECTION_SESSION_UPDATED
@@ -1042,7 +1040,10 @@ class ScanditBarcodeNative :
1042
1040
  @PluginMethod
1043
1041
  fun submitBarcodeFindTransformerResult(call: PluginCall) {
1044
1042
  val transformedBarcode = call.data.getString("transformedBarcode", null)
1045
- barcodeFindModule.submitBarcodeFindTransformerResult(transformedBarcode, CapacitorResult(call))
1043
+ barcodeFindModule.submitBarcodeFindTransformerResult(
1044
+ transformedBarcode,
1045
+ CapacitorResult(call)
1046
+ )
1046
1047
  }
1047
1048
 
1048
1049
  @PluginMethod
@@ -1278,23 +1279,24 @@ class ScanditBarcodeNative :
1278
1279
  )
1279
1280
  }
1280
1281
 
1281
- sparkScanModule.sparkScanView?.bringToFront()
1282
1282
  checkOrRequestCameraPermissions(call)
1283
1283
  }
1284
1284
 
1285
1285
  @PluginMethod
1286
1286
  fun disposeSparkScanView(call: PluginCall) {
1287
1287
  mainThread.runOnMainThread {
1288
- sparkScanModule.disposeView()
1288
+ sparkScanModule.disposeView(getViewId(call))
1289
1289
  }
1290
1290
  call.resolve()
1291
1291
  }
1292
1292
 
1293
1293
  @PluginMethod
1294
1294
  fun updateSparkScanView(call: PluginCall) {
1295
- val viewJson = call.data.toString()
1295
+ val viewJson = call.data.getString("viewJson").orEmpty()
1296
1296
  sparkScanModule.updateView(
1297
- viewJson, CapacitorResult(call)
1297
+ getViewId(call),
1298
+ viewJson,
1299
+ CapacitorResult(call)
1298
1300
  )
1299
1301
  }
1300
1302
 
@@ -1302,65 +1304,70 @@ class ScanditBarcodeNative :
1302
1304
  fun updateSparkScanMode(call: PluginCall) {
1303
1305
  val modeJson = call.data.getString("sparkScanJson").orEmpty()
1304
1306
  sparkScanModule.updateMode(
1305
- modeJson, CapacitorResult(call)
1307
+ getViewId(call),
1308
+ modeJson,
1309
+ CapacitorResult(call)
1306
1310
  )
1307
1311
  }
1308
1312
 
1309
1313
  @PluginMethod
1310
1314
  fun showSparkScanView(call: PluginCall) {
1311
1315
  mainThread.runOnMainThread {
1312
- sparkScanModule.sparkScanView?.visibility = View.VISIBLE
1316
+ sparkScanModule.showView(getViewId(call), CapacitorResult(call))
1313
1317
  }
1314
- call.resolve()
1315
1318
  }
1316
1319
 
1317
1320
  @PluginMethod
1318
1321
  fun hideSparkScanView(call: PluginCall) {
1319
1322
  mainThread.runOnMainThread {
1320
- sparkScanModule.sparkScanView?.visibility = View.GONE
1323
+ sparkScanModule.hideView(getViewId(call), CapacitorResult(call))
1321
1324
  }
1322
- call.resolve()
1323
1325
  }
1324
1326
 
1325
1327
  @PluginMethod
1326
1328
  fun registerSparkScanListenerForEvents(call: PluginCall) {
1327
- sparkScanModule.addSparkScanListener()
1329
+ sparkScanModule.addSparkScanListener(getViewId(call))
1328
1330
  call.resolve()
1329
1331
  }
1330
1332
 
1331
1333
  @PluginMethod
1332
1334
  fun unregisterSparkScanListenerForEvents(call: PluginCall) {
1333
- sparkScanModule.removeSparkScanListener()
1335
+ sparkScanModule.removeSparkScanListener(getViewId(call))
1334
1336
  call.resolve()
1335
1337
  }
1336
1338
 
1337
1339
  @PluginMethod
1338
1340
  fun setSparkScanModeEnabledState(call: PluginCall) {
1339
- sparkScanModule.setModeEnabled(call.data.getBoolean("enabled"))
1341
+ val enabled = call.data.getBoolean("isEnabled")
1342
+ sparkScanModule.setModeEnabled(getViewId(call), enabled)
1340
1343
  call.resolve()
1341
1344
  }
1342
1345
 
1343
1346
  @PluginMethod
1344
- fun finishSparkScanDidUpdateSessionCallback(call: PluginCall) {
1345
- sparkScanModule.finishDidUpdateSessionCallback(call.data.getBoolean("enabled"))
1347
+ fun finishSparkScanDidUpdateSession(call: PluginCall) {
1348
+ val enabled = call.data.getBoolean("isEnabled")
1349
+ sparkScanModule.finishDidUpdateSessionCallback(
1350
+ getViewId(call),
1351
+ enabled
1352
+ )
1346
1353
  call.resolve()
1347
1354
  }
1348
1355
 
1349
1356
  @PluginMethod
1350
- fun finishSparkScanDidScanCallback(call: PluginCall) {
1351
- sparkScanModule.finishDidScanCallback(call.data.getBoolean("enabled"))
1357
+ fun finishSparkScanDidScan(call: PluginCall) {
1358
+ sparkScanModule.finishDidScanCallback(getViewId(call), call.data.getBoolean("isEnabled"))
1352
1359
  call.resolve()
1353
1360
  }
1354
1361
 
1355
1362
  @PluginMethod
1356
1363
  fun registerSparkScanViewListenerEvents(call: PluginCall) {
1357
- sparkScanModule.addSparkScanViewUiListener()
1364
+ sparkScanModule.addSparkScanViewUiListener(getViewId(call))
1358
1365
  call.resolve()
1359
1366
  }
1360
1367
 
1361
1368
  @PluginMethod
1362
1369
  fun unregisterSparkScanViewListenerEvents(call: PluginCall) {
1363
- sparkScanModule.removeSparkScanViewUiListener()
1370
+ sparkScanModule.removeSparkScanViewUiListener(getViewId(call))
1364
1371
  call.resolve()
1365
1372
  }
1366
1373
 
@@ -1372,13 +1379,12 @@ class ScanditBarcodeNative :
1372
1379
 
1373
1380
  @PluginMethod
1374
1381
  fun startSparkScanViewScanning(call: PluginCall) {
1375
- sparkScanModule.startScanning(CapacitorResult(call))
1382
+ sparkScanModule.startScanning(getViewId(call), CapacitorResult(call))
1376
1383
  }
1377
1384
 
1378
1385
  @PluginMethod
1379
1386
  fun pauseSparkScanViewScanning(call: PluginCall) {
1380
- sparkScanModule.pauseScanning()
1381
- call.resolve()
1387
+ sparkScanModule.pauseScanning(getViewId(call), CapacitorResult(call))
1382
1388
  }
1383
1389
 
1384
1390
  @PluginMethod
@@ -1388,33 +1394,39 @@ class ScanditBarcodeNative :
1388
1394
  }
1389
1395
 
1390
1396
  @PluginMethod
1391
- fun addSparkScanFeedbackDelegate(call: PluginCall) {
1392
- sparkScanModule.addFeedbackDelegate(CapacitorResult(call))
1397
+ fun registerSparkScanFeedbackDelegateForEvents(call: PluginCall) {
1398
+ sparkScanModule.addFeedbackDelegate(getViewId(call), CapacitorResult(call))
1393
1399
  }
1394
1400
 
1395
1401
  @PluginMethod
1396
- fun removeSparkScanFeedbackDelegate(call: PluginCall) {
1397
- sparkScanModule.removeFeedbackDelegate(CapacitorResult(call))
1402
+ fun unregisterSparkScanFeedbackDelegateForEvents(call: PluginCall) {
1403
+ sparkScanModule.removeFeedbackDelegate(getViewId(call), CapacitorResult(call))
1398
1404
  }
1399
1405
 
1400
1406
  @PluginMethod
1401
1407
  fun submitSparkScanFeedbackForBarcode(call: PluginCall) {
1402
1408
  sparkScanModule.submitFeedbackForBarcode(
1409
+ getViewId(call),
1403
1410
  call.data.getString("feedbackJson", null),
1404
1411
  CapacitorResult(call)
1405
1412
  )
1406
1413
  }
1407
1414
 
1408
1415
  @PluginMethod
1409
- fun showToast(call: PluginCall) {
1416
+ fun showSparkScanViewToast(call: PluginCall) {
1410
1417
  val text = call.data.getString("text")
1411
1418
  ?: return call.reject(WRONG_INPUT)
1412
1419
  sparkScanModule.showToast(
1420
+ getViewId(call),
1413
1421
  text,
1414
1422
  CapacitorResult(call)
1415
1423
  )
1416
1424
  }
1417
1425
 
1426
+ private fun getViewId(call: PluginCall): Int {
1427
+ return call.data.getInt("viewId")
1428
+ }
1429
+
1418
1430
  @PluginMethod
1419
1431
  fun createBarcodeGenerator(call: PluginCall) {
1420
1432
  val barcodeGeneratorJson = call.data.getString("barcodeGeneratorJson")