scandit-capacitor-datacapture-core 6.10.0-beta.2 → 6.11.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.
Files changed (33) hide show
  1. package/ScanditCapacitorDatacaptureCore.podspec +1 -1
  2. package/android/build.gradle +13 -10
  3. package/android/src/main/java/com/scandit/capacitor/datacapture/core/ScanditCaptureCoreNative.kt +35 -33
  4. package/android/src/main/java/com/scandit/capacitor/datacapture/core/data/ResizeAndMoveInfo.kt +5 -5
  5. package/android/src/main/java/com/scandit/capacitor/datacapture/core/data/SerializableCallbackAction.kt +6 -6
  6. package/android/src/main/java/com/scandit/capacitor/datacapture/core/data/SerializablePoint.kt +1 -1
  7. package/android/src/main/java/com/scandit/capacitor/datacapture/core/data/SerializableViewState.kt +8 -8
  8. package/android/src/main/java/com/scandit/capacitor/datacapture/core/data/defaults/SerializableAimerViewfinderDefaults.kt +4 -4
  9. package/android/src/main/java/com/scandit/capacitor/datacapture/core/data/defaults/SerializableBrushDefaults.kt +8 -8
  10. package/android/src/main/java/com/scandit/capacitor/datacapture/core/data/defaults/SerializableCameraDefaults.kt +5 -5
  11. package/android/src/main/java/com/scandit/capacitor/datacapture/core/data/defaults/SerializableCameraSettingsDefault.kt +14 -14
  12. package/android/src/main/java/com/scandit/capacitor/datacapture/core/data/defaults/SerializableDataCaptureViewDefaults.kt +9 -9
  13. package/android/src/main/java/com/scandit/capacitor/datacapture/core/data/defaults/SerializableLaserlineViewfinderDefaults.kt +13 -13
  14. package/android/src/main/java/com/scandit/capacitor/datacapture/core/data/defaults/SerializableRectangularViewfinderDefaults.kt +19 -17
  15. package/android/src/main/java/com/scandit/capacitor/datacapture/core/errors/ActionError.kt +4 -4
  16. package/android/src/main/java/com/scandit/capacitor/datacapture/core/errors/ContextDeserializationError.kt +1 -1
  17. package/android/src/main/java/com/scandit/capacitor/datacapture/core/errors/JsonParseError.kt +1 -1
  18. package/android/src/main/java/com/scandit/capacitor/datacapture/core/errors/NoCameraAvailableError.kt +2 -2
  19. package/android/src/main/java/com/scandit/capacitor/datacapture/core/errors/NoViewToConvertPointError.kt +2 -2
  20. package/android/src/main/java/com/scandit/capacitor/datacapture/core/errors/NoViewToConvertQuadrilateralError.kt +2 -2
  21. package/android/src/main/java/com/scandit/capacitor/datacapture/core/handlers/DataCaptureViewHandler.kt +6 -7
  22. package/android/src/main/java/com/scandit/capacitor/datacapture/core/utils/Extensions.kt +6 -6
  23. package/dist/esm/ts/Capacitor/Defaults.d.ts +2 -0
  24. package/dist/esm/ts/Capacitor/Defaults.js +1 -0
  25. package/dist/esm/ts/Capacitor/Defaults.js.map +1 -1
  26. package/dist/esm/ts/DataCaptureVersion.js +1 -1
  27. package/dist/esm/ts/Viewfinder.d.ts +3 -0
  28. package/dist/esm/ts/Viewfinder.js +11 -0
  29. package/dist/esm/ts/Viewfinder.js.map +1 -1
  30. package/dist/plugin.js +13 -1
  31. package/dist/plugin.js.map +1 -1
  32. package/ios/Plugin/ScanditCaptureCoreDefaults.swift +2 -0
  33. package/package.json +2 -2
@@ -15,5 +15,5 @@ Pod::Spec.new do |s|
15
15
  s.dependency 'Capacitor'
16
16
  s.swift_version = '5.1'
17
17
 
18
- s.dependency 'ScanditCaptureCore', '= 6.10.0-beta.2'
18
+ s.dependency 'ScanditCaptureCore', '= 6.11.0-beta.2'
19
19
  end
@@ -1,15 +1,19 @@
1
1
  ext {
2
- androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.2.0'
2
+ androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.3.1'
3
+ androidxCoreVersion = project.hasProperty('androidxCoreVersion') ? rootProject.ext.androidxCoreVersion : '1.3.1'
3
4
  }
4
5
 
5
6
  buildscript {
6
- ext.kotlin_version = '1.4.21'
7
+ ext {
8
+ sdk_version = "6.11.0-beta.2"
9
+ kotlin_version = '1.4.21'
10
+ }
7
11
  repositories {
8
12
  google()
9
13
  mavenCentral()
10
14
  }
11
15
  dependencies {
12
- classpath 'com.android.tools.build:gradle:3.6.1'
16
+ classpath 'com.android.tools.build:gradle:7.0.3'
13
17
  classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
14
18
  }
15
19
  }
@@ -18,10 +22,10 @@ apply plugin: 'com.android.library'
18
22
  apply plugin: 'kotlin-android'
19
23
 
20
24
  android {
21
- compileSdkVersion project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 29
25
+ compileSdk project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 29
22
26
  defaultConfig {
23
- minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 21
24
- targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 29
27
+ minSdk project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 21
28
+ targetSdk project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 29
25
29
  versionCode 1
26
30
  versionName "1.0"
27
31
  }
@@ -44,11 +48,10 @@ repositories {
44
48
  dependencies {
45
49
  implementation fileTree(dir: 'libs', include: ['*.jar'])
46
50
 
47
- api "com.scandit.datacapture:core:6.10.0-beta.2"
51
+ api "com.scandit.datacapture:core:$sdk_version"
48
52
 
49
53
  implementation project(':capacitor-android')
50
- implementation "androidx.core:core-ktx:1.6.0"
51
- implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
52
- implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
53
54
  implementation "com.squareup.okhttp3:okhttp:4.9.0"
55
+ implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
56
+ implementation "androidx.core:core-ktx:$androidxCoreVersion"
54
57
  }
@@ -63,10 +63,10 @@ import com.scandit.datacapture.core.ui.style.Brush
63
63
  import com.scandit.datacapture.core.ui.viewfinder.AimerViewfinder
64
64
  import com.scandit.datacapture.core.ui.viewfinder.LaserlineViewfinder
65
65
  import com.scandit.datacapture.core.ui.viewfinder.RectangularViewfinder
66
- import java.util.concurrent.atomic.AtomicBoolean
67
66
  import org.json.JSONArray
68
67
  import org.json.JSONException
69
68
  import org.json.JSONObject
69
+ import java.util.concurrent.atomic.AtomicBoolean
70
70
 
71
71
  @NativePlugin(
72
72
  requestCodes = [
@@ -76,7 +76,8 @@ import org.json.JSONObject
76
76
  Manifest.permission.CAMERA
77
77
  ]
78
78
  )
79
- class ScanditCaptureCoreNative : Plugin(),
79
+ class ScanditCaptureCoreNative :
80
+ Plugin(),
80
81
  CoreActions,
81
82
  DeserializersProvider,
82
83
  DataCaptureContextListener,
@@ -91,7 +92,9 @@ class ScanditCaptureCoreNative : Plugin(),
91
92
  private const val ACTION_VIEW_SIZE_CHANGED = "didChangeSizeOrientation"
92
93
 
93
94
  private val SCANDIT_PLUGINS = listOf(
94
- "ScanditBarcodeNative"
95
+ "ScanditBarcodeNative",
96
+ "ScanditParserNative",
97
+ "ScanditTextNative",
95
98
  )
96
99
  }
97
100
 
@@ -183,9 +186,12 @@ class ScanditCaptureCoreNative : Plugin(),
183
186
 
184
187
  private fun checkOrRequestCameraPermission() {
185
188
  if (checkCameraPermission().not()) {
186
- pluginRequestPermissions(arrayOf(
187
- Manifest.permission.CAMERA
188
- ), CODE_CAMERA_PERMISSIONS)
189
+ pluginRequestPermissions(
190
+ arrayOf(
191
+ Manifest.permission.CAMERA
192
+ ),
193
+ CODE_CAMERA_PERMISSIONS
194
+ )
189
195
  }
190
196
  }
191
197
 
@@ -230,9 +236,11 @@ class ScanditCaptureCoreNative : Plugin(),
230
236
  }
231
237
 
232
238
  if (json.contains("desiredState")) {
233
- switchToDesiredState(FrameSourceStateDeserializer.fromJson(
234
- json.requireByKeyAsString("desiredState")
235
- ))
239
+ switchToDesiredState(
240
+ FrameSourceStateDeserializer.fromJson(
241
+ json.requireByKeyAsString("desiredState")
242
+ )
243
+ )
236
244
  }
237
245
  }
238
246
  }
@@ -261,11 +269,14 @@ class ScanditCaptureCoreNative : Plugin(),
261
269
  override fun onSizeChanged(width: Int, height: Int, screenRotation: Int) {
262
270
  val ev = JSObject()
263
271
  ev.put("name", ACTION_VIEW_SIZE_CHANGED)
264
- ev.put("argument", JSONArray().apply {
265
- put(
266
- SerializableViewState(width, height, screenRotation).toJson()
267
- )
268
- })
272
+ ev.put(
273
+ "argument",
274
+ JSONArray().apply {
275
+ put(
276
+ SerializableViewState(width, height, screenRotation).toJson()
277
+ )
278
+ }
279
+ )
269
280
  }
270
281
  //endregion
271
282
 
@@ -287,10 +298,12 @@ class ScanditCaptureCoreNative : Plugin(),
287
298
  val cameraPosition = try {
288
299
  CameraPositionDeserializer.fromJson(positionJson)
289
300
  } catch (e: Exception) {
301
+ println(e)
290
302
  call.reject(
291
303
  CameraPositionDeserializationError("GetIsTorchAvailable")
292
304
  .serializeContent()
293
- .toString())
305
+ .toString()
306
+ )
294
307
  return
295
308
  }
296
309
 
@@ -298,7 +311,8 @@ class ScanditCaptureCoreNative : Plugin(),
298
311
  call.reject(
299
312
  NoCameraWithPositionError(cameraPosition.toString())
300
313
  .serializeContent()
301
- .toString())
314
+ .toString()
315
+ )
302
316
  return
303
317
  }
304
318
 
@@ -314,7 +328,7 @@ class ScanditCaptureCoreNative : Plugin(),
314
328
  override fun contextFromJSON(call: PluginCall) {
315
329
  try {
316
330
  val jsonString = call.data.getString("context")
317
- ?: return call.reject("Empty strings are not allowed.")
331
+ ?: return call.reject("Empty strings are not allowed.")
318
332
  val deserializationResult = deserializers.dataCaptureContextDeserializer
319
333
  .contextFromJson(jsonString)
320
334
  val view = deserializationResult.view
@@ -326,13 +340,10 @@ class ScanditCaptureCoreNative : Plugin(),
326
340
  captureComponentsHandler.attachDataCaptureComponents(dataCaptureComponents)
327
341
  call.resolve()
328
342
  } catch (e: JSONException) {
329
- e.printStackTrace()
330
343
  call.reject(JsonParseError(e.message).toString())
331
344
  } catch (e: RuntimeException) { // TODO SDC-1851 fine-catch deserializer exceptions
332
- e.printStackTrace()
333
345
  call.reject(JsonParseError(e.message).toString())
334
346
  } catch (e: Exception) {
335
- e.printStackTrace()
336
347
  call.reject(ContextDeserializationError(e.message).toString())
337
348
  }
338
349
  }
@@ -361,7 +372,7 @@ class ScanditCaptureCoreNative : Plugin(),
361
372
  call.resolve()
362
373
  } else {
363
374
  val jsonString = call.data.getString("context")
364
- ?: return call.reject("Empty strings are not allowed.")
375
+ ?: return call.reject("Empty strings are not allowed.")
365
376
  uiWorker.post {
366
377
  val deserializationResult =
367
378
  deserializers.dataCaptureContextDeserializer.updateContextFromJson(
@@ -382,13 +393,10 @@ class ScanditCaptureCoreNative : Plugin(),
382
393
  }
383
394
  }
384
395
  } catch (e: JSONException) {
385
- e.printStackTrace()
386
396
  call.reject(JsonParseError(e.message).toString())
387
397
  } catch (e: RuntimeException) { // TODO SDC-1851 fine-catch deserializer exceptions
388
- e.printStackTrace()
389
398
  call.reject(JsonParseError(e.message).toString())
390
399
  } catch (e: Exception) {
391
- e.printStackTrace()
392
400
  call.reject(ContextDeserializationError(e.message).toString())
393
401
  }
394
402
  }
@@ -400,12 +408,11 @@ class ScanditCaptureCoreNative : Plugin(),
400
408
  override fun setViewPositionAndSize(call: PluginCall) {
401
409
  try {
402
410
  val positionJson = call.data.getString("position")
403
- ?: return call.reject("Empty strings are not allowed.")
411
+ ?: return call.reject("Empty strings are not allowed.")
404
412
  val info = JSONObject(positionJson)
405
413
  captureViewHandler.setResizeAndMoveInfo(ResizeAndMoveInfo(info))
406
414
  call.resolve()
407
415
  } catch (e: JSONException) {
408
- e.printStackTrace()
409
416
  call.reject(JsonParseError(e.message).toString())
410
417
  }
411
418
  }
@@ -429,7 +436,7 @@ class ScanditCaptureCoreNative : Plugin(),
429
436
  call.reject(NoViewToConvertPointError().serializeContent().toString())
430
437
  } else {
431
438
  val pointJson = call.data.getString("point")
432
- ?: return call.reject("Empty strings are not allowed.")
439
+ ?: return call.reject("Empty strings are not allowed.")
433
440
  val point = SerializablePoint(
434
441
  JSONObject(pointJson)
435
442
  ).toScanditPoint()
@@ -439,7 +446,6 @@ class ScanditCaptureCoreNative : Plugin(),
439
446
  call.resolve(JSObject(mappedPoint.toJson()))
440
447
  }
441
448
  } catch (e: Exception) { // TODO SDC-1851 fine-catch deserializer exceptions
442
- e.printStackTrace()
443
449
  call.reject(JsonParseError(e.message).toString())
444
450
  }
445
451
  }
@@ -451,7 +457,7 @@ class ScanditCaptureCoreNative : Plugin(),
451
457
  call.reject(NoViewToConvertQuadrilateralError().serializeContent().toString())
452
458
  } else {
453
459
  val pointJson = call.data.getString("point")
454
- ?: return call.reject("Empty strings are not allowed.")
460
+ ?: return call.reject("Empty strings are not allowed.")
455
461
  val quadrilateral = QuadrilateralDeserializer.fromJson(pointJson)
456
462
  val mappedQuadrilateral = captureViewHandler.dataCaptureView!!
457
463
  .mapFrameQuadrilateralToView(quadrilateral)
@@ -459,7 +465,6 @@ class ScanditCaptureCoreNative : Plugin(),
459
465
  call.resolve(JSObject(mappedQuadrilateral.toJson()))
460
466
  }
461
467
  } catch (e: Exception) { // TODO SDC-1851 fine-catch deserializer exceptions
462
- e.printStackTrace()
463
468
  call.reject(JsonParseError(e.message).toString())
464
469
  }
465
470
  }
@@ -478,10 +483,8 @@ class ScanditCaptureCoreNative : Plugin(),
478
483
 
479
484
  call.resolve()
480
485
  } catch (e: JSONException) {
481
- e.printStackTrace()
482
486
  call.reject(JsonParseError(e.message).toString())
483
487
  } catch (e: RuntimeException) { // TODO [SDC-1851] - fine-catch deserializer exceptions
484
- e.printStackTrace()
485
488
  call.reject(JsonParseError(e.message).toString())
486
489
  }
487
490
  }
@@ -535,7 +538,6 @@ class ScanditCaptureCoreNative : Plugin(),
535
538
  )
536
539
  call.resolve(JSObject.fromJSONObject(defaults.toJson()))
537
540
  } catch (e: JSONException) {
538
- e.printStackTrace()
539
541
  call.reject(JsonParseError(e.message).toString())
540
542
  }
541
543
  }
@@ -17,11 +17,11 @@ data class ResizeAndMoveInfo(
17
17
  ) {
18
18
 
19
19
  constructor(json: JSONObject) : this(
20
- top = json.getInt(KEY_TOP),
21
- left = json.getInt(KEY_LEFT),
22
- width = json.getInt(KEY_WIDTH),
23
- height = json.getInt(KEY_HEIGHT),
24
- shouldBeUnderWebView = json.getBoolean(KEY_ELEVATION)
20
+ top = json.getInt(KEY_TOP),
21
+ left = json.getInt(KEY_LEFT),
22
+ width = json.getInt(KEY_WIDTH),
23
+ height = json.getInt(KEY_HEIGHT),
24
+ shouldBeUnderWebView = json.getBoolean(KEY_ELEVATION)
25
25
  )
26
26
 
27
27
  companion object {
@@ -16,12 +16,12 @@ class SerializableCallbackAction(
16
16
  ) : SerializableData {
17
17
 
18
18
  override fun toJson(): JSONObject = JSONObject(
19
- mapOf(
20
- FIELD_NAME to callbackName,
21
- FIELD_ARGUMENT to argument,
22
- FIELD_FINISH_CALLBACK_ID to finishCallbackId,
23
- FIELD_SHOULD_NOTIFY_WHEN_FINISHED to shouldNotifyWhenFinished
24
- )
19
+ mapOf(
20
+ FIELD_NAME to callbackName,
21
+ FIELD_ARGUMENT to argument,
22
+ FIELD_FINISH_CALLBACK_ID to finishCallbackId,
23
+ FIELD_SHOULD_NOTIFY_WHEN_FINISHED to shouldNotifyWhenFinished
24
+ )
25
25
  )
26
26
 
27
27
  companion object {
@@ -7,9 +7,9 @@
7
7
  package com.scandit.capacitor.datacapture.core.data
8
8
 
9
9
  import com.scandit.datacapture.core.common.geometry.Point
10
- import kotlin.jvm.Throws
11
10
  import org.json.JSONException
12
11
  import org.json.JSONObject
12
+ import kotlin.jvm.Throws
13
13
 
14
14
  data class SerializablePoint(private val x: Double, private val y: Double) {
15
15
 
@@ -19,15 +19,15 @@ class SerializableViewState(
19
19
  private val orientation = ScreenOrientation.fromOrientationInt(screenOrientation.toAngle())
20
20
 
21
21
  fun toJson(): JSONObject = JSONObject(
22
- mapOf(
23
- FIELD_ORIENTATION to orientation.camelCaseName,
24
- FIELD_SIZE to JSONObject(
25
- mapOf(
26
- FIELD_SIZE_WIDTH to width,
27
- FIELD_SIZE_HEIGHT to height
28
- )
29
- )
22
+ mapOf(
23
+ FIELD_ORIENTATION to orientation.camelCaseName,
24
+ FIELD_SIZE to JSONObject(
25
+ mapOf(
26
+ FIELD_SIZE_WIDTH to width,
27
+ FIELD_SIZE_HEIGHT to height
28
+ )
30
29
  )
30
+ )
31
31
  )
32
32
 
33
33
  enum class ScreenOrientation {
@@ -17,10 +17,10 @@ data class SerializableAimerViewfinderDefaults(
17
17
  ) : SerializableData {
18
18
 
19
19
  override fun toJson(): JSONObject = JSONObject(
20
- mapOf(
21
- FIELD_FRAME_COLOR to frameColor,
22
- FIELD_DOT_COLOR to dotColor
23
- )
20
+ mapOf(
21
+ FIELD_FRAME_COLOR to frameColor,
22
+ FIELD_DOT_COLOR to dotColor
23
+ )
24
24
  )
25
25
 
26
26
  companion object {
@@ -20,17 +20,17 @@ data class SerializableBrushDefaults(
20
20
  ) : SerializableData {
21
21
 
22
22
  constructor(brush: Brush?) : this(
23
- fillColor = brush?.fillColor?.hexString,
24
- strokeColor = brush?.strokeColor?.hexString,
25
- strokeWidth = brush?.strokeWidth
23
+ fillColor = brush?.fillColor?.hexString,
24
+ strokeColor = brush?.strokeColor?.hexString,
25
+ strokeWidth = brush?.strokeWidth
26
26
  )
27
27
 
28
28
  override fun toJson(): JSONObject = JSONObject(
29
- mapOf(
30
- FIELD_FILL_COLOR to fillColor,
31
- FIELD_STROKE_COLOR to strokeColor,
32
- FIELD_STROKE_WIDTH to strokeWidth
33
- )
29
+ mapOf(
30
+ FIELD_FILL_COLOR to fillColor,
31
+ FIELD_STROKE_COLOR to strokeColor,
32
+ FIELD_STROKE_WIDTH to strokeWidth
33
+ )
34
34
  )
35
35
 
36
36
  fun toJSONObject(): JSONObject {
@@ -19,11 +19,11 @@ data class SerializableCameraDefaults(
19
19
  ) : SerializableData {
20
20
 
21
21
  override fun toJson(): JSONObject = JSONObject(
22
- mapOf(
23
- FIELD_CAMERA_SETTINGS_DEFAULTS to cameraSettingsDefault.toJson(),
24
- FIELD_DEFAULT_POSITION to defaultPosition,
25
- FIELD_AVAILABLE_POSITIONS to availablePositions
26
- )
22
+ mapOf(
23
+ FIELD_CAMERA_SETTINGS_DEFAULTS to cameraSettingsDefault.toJson(),
24
+ FIELD_DEFAULT_POSITION to defaultPosition,
25
+ FIELD_AVAILABLE_POSITIONS to availablePositions
26
+ )
27
27
  )
28
28
 
29
29
  companion object {
@@ -21,23 +21,23 @@ data class SerializableCameraSettingsDefault(
21
21
  ) : SerializableData {
22
22
 
23
23
  constructor(settings: CameraSettings) : this(
24
- prefResolution = settings.preferredResolution.toJson(),
25
- zoomFactor = settings.zoomFactor,
26
- focusRange = "full",
27
- zoomGestureZoomFactor = settings.zoomGestureZoomFactor,
28
- focusGestureStrategy = settings.focusGestureStrategy.toJson(),
29
- shouldPreferSmoothAutoFocus = settings.shouldPreferSmoothAutoFocus
24
+ prefResolution = settings.preferredResolution.toJson(),
25
+ zoomFactor = settings.zoomFactor,
26
+ focusRange = "full",
27
+ zoomGestureZoomFactor = settings.zoomGestureZoomFactor,
28
+ focusGestureStrategy = settings.focusGestureStrategy.toJson(),
29
+ shouldPreferSmoothAutoFocus = settings.shouldPreferSmoothAutoFocus
30
30
  )
31
31
 
32
32
  override fun toJson(): JSONObject = JSONObject(
33
- mapOf(
34
- FIELD_PREFERRED_RESOLUTION to prefResolution,
35
- FIELD_ZOOM_FACTOR to zoomFactor,
36
- FIELD_FOCUS_RANGE to focusRange,
37
- FIELD_ZOOM_GESTURE_ZOOM_FACTOR to zoomGestureZoomFactor,
38
- FIELD_FOCUS_GESTURE_STRATEGY to focusGestureStrategy,
39
- FIELD_FOCUS_SHOULD_PREFER_SMOOTH_AUTOFOCUS to shouldPreferSmoothAutoFocus
40
- )
33
+ mapOf(
34
+ FIELD_PREFERRED_RESOLUTION to prefResolution,
35
+ FIELD_ZOOM_FACTOR to zoomFactor,
36
+ FIELD_FOCUS_RANGE to focusRange,
37
+ FIELD_ZOOM_GESTURE_ZOOM_FACTOR to zoomGestureZoomFactor,
38
+ FIELD_FOCUS_GESTURE_STRATEGY to focusGestureStrategy,
39
+ FIELD_FOCUS_SHOULD_PREFER_SMOOTH_AUTOFOCUS to shouldPreferSmoothAutoFocus
40
+ )
41
41
  )
42
42
 
43
43
  companion object {
@@ -22,15 +22,15 @@ data class SerializableDataCaptureViewDefaults(
22
22
  ) : SerializableData {
23
23
 
24
24
  override fun toJson(): JSONObject = JSONObject(
25
- mapOf(
26
- FIELD_MARGINS to scanAreaMargins,
27
- FIELD_POI to pointOfInterest,
28
- FIELD_LOGO_ANCHOR to logoAnchor,
29
- FIELD_LOGO_OFFSET to logoOffset,
30
- FIELD_FOCUS_GESTURE to focusGesture,
31
- FIELD_ZOOM_GESTURE to zoomGesture,
32
- FIELD_LOGO_STYLE to logoStyle
33
- )
25
+ mapOf(
26
+ FIELD_MARGINS to scanAreaMargins,
27
+ FIELD_POI to pointOfInterest,
28
+ FIELD_LOGO_ANCHOR to logoAnchor,
29
+ FIELD_LOGO_OFFSET to logoOffset,
30
+ FIELD_FOCUS_GESTURE to focusGesture,
31
+ FIELD_ZOOM_GESTURE to zoomGesture,
32
+ FIELD_LOGO_STYLE to logoStyle
33
+ )
34
34
  )
35
35
 
36
36
  companion object {
@@ -21,16 +21,16 @@ class SerializableLaserlineViewfinderDefaults(
21
21
  ) : SerializableData {
22
22
 
23
23
  override fun toJson(): JSONObject = JSONObject(
24
- mapOf(
25
- FIELD_VIEW_FINDER_DEFAULT_STYLE to viewFinder.style.toJson(),
26
- FIELD_VIEW_FINDER_STYLES to mapOf(
27
- LaserlineViewfinderStyle.ANIMATED.toJson() to
28
- createViewfinderDefaults(LaserlineViewfinderStyle.ANIMATED),
29
- LaserlineViewfinderStyle.LEGACY.toJson() to
30
- createViewfinderDefaults(LaserlineViewfinderStyle.LEGACY)
31
- )
32
-
24
+ mapOf(
25
+ FIELD_VIEW_FINDER_DEFAULT_STYLE to viewFinder.style.toJson(),
26
+ FIELD_VIEW_FINDER_STYLES to mapOf(
27
+ LaserlineViewfinderStyle.ANIMATED.toJson() to
28
+ createViewfinderDefaults(LaserlineViewfinderStyle.ANIMATED),
29
+ LaserlineViewfinderStyle.LEGACY.toJson() to
30
+ createViewfinderDefaults(LaserlineViewfinderStyle.LEGACY)
33
31
  )
32
+
33
+ )
34
34
  )
35
35
 
36
36
  private fun createViewfinderDefaults(
@@ -38,10 +38,10 @@ class SerializableLaserlineViewfinderDefaults(
38
38
  ): Map<String, Any?> {
39
39
  return with(LaserlineViewfinder(style)) {
40
40
  mapOf(
41
- FIELD_WIDTH to width.toJson(),
42
- FIELD_ENABLED_COLOR to enabledColor.hexString,
43
- FIELD_DISABLED_COLOR to disabledColor.hexString,
44
- FIELD_VIEW_FINDER_STYLE to style.toJson()
41
+ FIELD_WIDTH to width.toJson(),
42
+ FIELD_ENABLED_COLOR to enabledColor.hexString,
43
+ FIELD_DISABLED_COLOR to disabledColor.hexString,
44
+ FIELD_VIEW_FINDER_STYLE to style.toJson()
45
45
  )
46
46
  }
47
47
  }
@@ -20,18 +20,18 @@ class SerializableRectangularViewfinderDefaults(
20
20
  ) : SerializableData {
21
21
 
22
22
  override fun toJson(): JSONObject = JSONObject(
23
- mapOf(
24
- FIELD_VIEW_FINDER_DEFAULT_STYLE to viewFinder.style.toJson(),
25
- FIELD_VIEW_FINDER_STYLES to mapOf(
26
- RectangularViewfinderStyle.LEGACY.toJson() to
27
- createViewfinderDefaults(RectangularViewfinderStyle.LEGACY),
28
- RectangularViewfinderStyle.ROUNDED.toJson() to
29
- createViewfinderDefaults(RectangularViewfinderStyle.ROUNDED),
30
- RectangularViewfinderStyle.SQUARE.toJson() to
31
- createViewfinderDefaults(RectangularViewfinderStyle.SQUARE)
32
- )
33
-
23
+ mapOf(
24
+ FIELD_VIEW_FINDER_DEFAULT_STYLE to viewFinder.style.toJson(),
25
+ FIELD_VIEW_FINDER_STYLES to mapOf(
26
+ RectangularViewfinderStyle.LEGACY.toJson() to
27
+ createViewfinderDefaults(RectangularViewfinderStyle.LEGACY),
28
+ RectangularViewfinderStyle.ROUNDED.toJson() to
29
+ createViewfinderDefaults(RectangularViewfinderStyle.ROUNDED),
30
+ RectangularViewfinderStyle.SQUARE.toJson() to
31
+ createViewfinderDefaults(RectangularViewfinderStyle.SQUARE)
34
32
  )
33
+
34
+ )
35
35
  )
36
36
 
37
37
  private fun createViewfinderDefaults(
@@ -39,12 +39,13 @@ class SerializableRectangularViewfinderDefaults(
39
39
  ): Map<String, Any?> {
40
40
  return with(RectangularViewfinder(style)) {
41
41
  mapOf(
42
- FIELD_VIEW_FINDER_SIZE to sizeWithUnitAndAspect.toJson(),
43
- FIELD_VIEW_FINDER_COLOR to color.hexString,
44
- FIELD_VIEW_FINDER_STYLE to style.toJson(),
45
- FIELD_VIEW_FINDER_LINE_STYLE to lineStyle.toJson(),
46
- FIELD_VIEW_FINDER_DIMMING to dimming,
47
- FIELD_VIEW_FINDER_ANIMATION to animation?.toJson()
42
+ FIELD_VIEW_FINDER_SIZE to sizeWithUnitAndAspect.toJson(),
43
+ FIELD_VIEW_FINDER_COLOR to color.hexString,
44
+ FIELD_VIEW_FINDER_STYLE to style.toJson(),
45
+ FIELD_VIEW_FINDER_LINE_STYLE to lineStyle.toJson(),
46
+ FIELD_VIEW_FINDER_DIMMING to dimming,
47
+ FIELD_VIEW_FINDER_DISABLED_DIMMING to disabledDimming,
48
+ FIELD_VIEW_FINDER_ANIMATION to animation?.toJson()
48
49
  )
49
50
  }
50
51
  }
@@ -57,6 +58,7 @@ class SerializableRectangularViewfinderDefaults(
57
58
  private const val FIELD_VIEW_FINDER_STYLE = "style"
58
59
  private const val FIELD_VIEW_FINDER_LINE_STYLE = "lineStyle"
59
60
  private const val FIELD_VIEW_FINDER_DIMMING = "dimming"
61
+ private const val FIELD_VIEW_FINDER_DISABLED_DIMMING = "disabledDimming"
60
62
  private const val FIELD_VIEW_FINDER_ANIMATION = "animation"
61
63
  }
62
64
  }
@@ -19,9 +19,9 @@ abstract class ActionError(
19
19
  }
20
20
 
21
21
  fun serializeContent(): JSONObject = JSONObject(
22
- mapOf(
23
- KEY_CODE to errorCode,
24
- KEY_MESSAGE to errorMessage
25
- )
22
+ mapOf(
23
+ KEY_CODE to errorCode,
24
+ KEY_MESSAGE to errorMessage
25
+ )
26
26
  )
27
27
  }
@@ -7,7 +7,7 @@
7
7
  package com.scandit.capacitor.datacapture.core.errors
8
8
 
9
9
  class ContextDeserializationError(error: String?) : ActionError(
10
- ERROR_CODE, "Could not deserialize context: ${error ?: "No additional info"}"
10
+ ERROR_CODE, "Could not deserialize context: ${error ?: "No additional info"}"
11
11
  ) {
12
12
  companion object {
13
13
  private const val ERROR_CODE = 10011
@@ -7,7 +7,7 @@
7
7
  package com.scandit.capacitor.datacapture.core.errors
8
8
 
9
9
  class JsonParseError(error: String?) : ActionError(
10
- ERROR_CODE, "Invalid or no JSON passed for command: ${error ?: "No additional info"}"
10
+ ERROR_CODE, "Invalid or no JSON passed for command: ${error ?: "No additional info"}"
11
11
  ) {
12
12
  companion object {
13
13
  private const val ERROR_CODE = 10001
@@ -7,8 +7,8 @@
7
7
  package com.scandit.capacitor.datacapture.core.errors
8
8
 
9
9
  class NoCameraAvailableError : ActionError(
10
- ERROR_CODE,
11
- "No camera available or not yet initialized"
10
+ ERROR_CODE,
11
+ "No camera available or not yet initialized"
12
12
  ) {
13
13
  companion object {
14
14
  private const val ERROR_CODE = 10042
@@ -7,8 +7,8 @@
7
7
  package com.scandit.capacitor.datacapture.core.errors
8
8
 
9
9
  class NoViewToConvertPointError : ActionError(
10
- ERROR_CODE,
11
- "There is no view shown, so the point cannot be converted into its coordinate space"
10
+ ERROR_CODE,
11
+ "There is no view shown, so the point cannot be converted into its coordinate space"
12
12
  ) {
13
13
  companion object {
14
14
  private const val ERROR_CODE = 10031
@@ -7,8 +7,8 @@
7
7
  package com.scandit.capacitor.datacapture.core.errors
8
8
 
9
9
  class NoViewToConvertQuadrilateralError : ActionError(
10
- ERROR_CODE,
11
- "There is no view shown, so the quadrilateral cannot be converted into its coordinate space"
10
+ ERROR_CODE,
11
+ "There is no view shown, so the quadrilateral cannot be converted into its coordinate space"
12
12
  ) {
13
13
  companion object {
14
14
  private const val ERROR_CODE = 10032