scandit-react-native-datacapture-core 6.25.0-beta.1 → 6.25.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.
@@ -64,7 +64,7 @@ android {
64
64
  }
65
65
 
66
66
  dependencies {
67
- def sdk_version = "6.25.0-beta.1"
67
+ def sdk_version = "6.25.0"
68
68
 
69
69
  println("Version of the native sdk used in this build: ${safeExtGet('global_sdk_version', sdk_version)}")
70
70
  if (findProject(':scandit-datacapture-frameworks-core') != null) {
@@ -11,11 +11,15 @@ import com.facebook.react.bridge.ReactApplicationContext
11
11
  import com.facebook.react.bridge.ReactContextBaseJavaModule
12
12
  import com.facebook.react.bridge.ReactMethod
13
13
  import com.scandit.datacapture.core.capture.DataCaptureVersion
14
+ import com.scandit.datacapture.core.ui.DataCaptureView
14
15
  import com.scandit.datacapture.frameworks.core.CoreModule
16
+ import com.scandit.datacapture.frameworks.core.deserialization.DefaultDeserializationLifecycleObserver
17
+ import com.scandit.datacapture.frameworks.core.deserialization.DeserializationLifecycleObserver
15
18
  import com.scandit.datacapture.frameworks.core.utils.DefaultLastFrameData
16
19
  import com.scandit.datacapture.frameworks.core.utils.DefaultMainThread
17
20
  import com.scandit.datacapture.frameworks.core.utils.LastFrameData
18
21
  import com.scandit.datacapture.frameworks.core.utils.MainThread
22
+ import com.scandit.datacapture.reactnative.core.ui.DataCaptureViewManager
19
23
  import com.scandit.datacapture.reactnative.core.utils.Error
20
24
  import com.scandit.datacapture.reactnative.core.utils.ReactNativeResult
21
25
  import com.scandit.datacapture.reactnative.core.utils.reject
@@ -23,9 +27,10 @@ import com.scandit.datacapture.reactnative.core.utils.reject
23
27
  class ScanditDataCaptureCoreModule(
24
28
  reactContext: ReactApplicationContext,
25
29
  private val coreModule: CoreModule,
30
+ private val dataCaptureViewManager: DataCaptureViewManager,
26
31
  private val mainThread: MainThread = DefaultMainThread.getInstance(),
27
32
  private val lastFrameData: LastFrameData = DefaultLastFrameData.getInstance()
28
- ) : ReactContextBaseJavaModule(reactContext) {
33
+ ) : ReactContextBaseJavaModule(reactContext), DeserializationLifecycleObserver.Observer {
29
34
 
30
35
  companion object {
31
36
  private const val VERSION_KEY = "Version"
@@ -34,11 +39,17 @@ class ScanditDataCaptureCoreModule(
34
39
  private val ERROR_NULL_FRAME = Error(5, "Frame is null, it might've been reused already.")
35
40
  }
36
41
 
42
+ private val deserializationLifecycleObserver: DeserializationLifecycleObserver =
43
+ DefaultDeserializationLifecycleObserver.getInstance()
44
+
37
45
  init {
38
46
  coreModule.onCreate(reactContext)
47
+ deserializationLifecycleObserver.attach(this)
39
48
  }
49
+
40
50
  override fun invalidate() {
41
51
  coreModule.onDestroy()
52
+ deserializationLifecycleObserver.detach(this)
42
53
  super.invalidate()
43
54
  }
44
55
 
@@ -49,6 +60,10 @@ class ScanditDataCaptureCoreModule(
49
60
  DEFAULTS_KEY to coreModule.getDefaults()
50
61
  )
51
62
 
63
+ override fun onDataCaptureViewDeserialized(dataCaptureView: DataCaptureView?) {
64
+ dataCaptureViewManager.onDataCaptureViewDeserialized(dataCaptureView)
65
+ }
66
+
52
67
  @ReactMethod
53
68
  fun registerListenerForEvents() {
54
69
  coreModule.registerDataCaptureContextListener()
@@ -21,11 +21,23 @@ class ScanditDataCaptureCorePackage : ReactPackage {
21
21
  override fun createNativeModules(
22
22
  reactContext: ReactApplicationContext
23
23
  ): MutableList<NativeModule> =
24
- mutableListOf(ScanditDataCaptureCoreModule(reactContext, getCoreModule(reactContext)))
24
+ mutableListOf(
25
+ ScanditDataCaptureCoreModule(
26
+ reactContext,
27
+ getCoreModule(
28
+ reactContext
29
+ ),
30
+ dataCaptureViewManager
31
+ )
32
+ )
33
+
34
+ private val dataCaptureViewManager: DataCaptureViewManager by lazy {
35
+ DataCaptureViewManager()
36
+ }
25
37
 
26
38
  override fun createViewManagers(
27
39
  reactContext: ReactApplicationContext
28
- ): MutableList<ViewManager<*, *>> = mutableListOf(DataCaptureViewManager())
40
+ ): MutableList<ViewManager<*, *>> = mutableListOf(dataCaptureViewManager)
29
41
 
30
42
  private fun getCoreModule(reactContext: ReactApplicationContext): CoreModule {
31
43
  val eventEmitter: Emitter = ReactNativeEventEmitter(reactContext)
@@ -11,23 +11,13 @@ import android.view.ViewGroup.LayoutParams.MATCH_PARENT
11
11
  import android.widget.FrameLayout
12
12
  import com.facebook.react.uimanager.ThemedReactContext
13
13
  import com.scandit.datacapture.core.ui.DataCaptureView
14
- import com.scandit.datacapture.frameworks.core.deserialization.DefaultDeserializationLifecycleObserver
15
- import com.scandit.datacapture.frameworks.core.deserialization.DeserializationLifecycleObserver
16
14
  import com.scandit.datacapture.frameworks.core.utils.DefaultMainThread
17
15
  import com.scandit.datacapture.frameworks.core.utils.MainThread
18
16
  import java.lang.ref.WeakReference
19
17
 
20
18
  class DataCaptureViewManager(
21
19
  private val mainThread: MainThread = DefaultMainThread.getInstance()
22
- ) : ScanditViewGroupManager<FrameLayout>(),
23
- DeserializationLifecycleObserver.Observer {
24
-
25
- private val deserializationLifecycleObserver: DeserializationLifecycleObserver =
26
- DefaultDeserializationLifecycleObserver.getInstance()
27
-
28
- init {
29
- deserializationLifecycleObserver.attach(this)
30
- }
20
+ ) : ScanditViewGroupManager<FrameLayout>() {
31
21
 
32
22
  override fun getName(): String = "RNTDataCaptureView"
33
23
 
@@ -54,7 +44,7 @@ class DataCaptureViewManager(
54
44
  }
55
45
  }
56
46
 
57
- override fun onDataCaptureViewDeserialized(dataCaptureView: DataCaptureView?) {
47
+ fun onDataCaptureViewDeserialized(dataCaptureView: DataCaptureView?) {
58
48
  if (dataCaptureView == null) return
59
49
 
60
50
  currentContainer?.let {
@@ -25,6 +25,11 @@ abstract class ScanditViewGroupManager<T> : ViewGroupManager<T>() where T : View
25
25
 
26
26
  abstract fun createNewInstance(reactContext: ThemedReactContext): T
27
27
 
28
+ override fun invalidate() {
29
+ super.invalidate()
30
+ containers.clear()
31
+ }
32
+
28
33
  override fun createViewInstance(reactContext: ThemedReactContext): T {
29
34
  val container = createNewInstance(reactContext).also {
30
35
  containers.add(it)
package/dist/core.js CHANGED
@@ -375,7 +375,7 @@ FactoryMaker.instances = new Map();
375
375
 
376
376
  function createEventEmitter() {
377
377
  const ee = new EventEmitter();
378
- FactoryMaker.bindInstance('EventEmitter', ee);
378
+ FactoryMaker.bindInstanceIfNotExists('EventEmitter', ee);
379
379
  }
380
380
 
381
381
  class BaseController {
@@ -1998,25 +1998,25 @@ __decorate([
1998
1998
  ignoreFromSerialization
1999
1999
  ], BaseDataCaptureView.prototype, "coreDefaults", null);
2000
2000
  __decorate([
2001
- ignoreFromSerialization
2001
+ nameForSerialization('scanAreaMargins')
2002
2002
  ], BaseDataCaptureView.prototype, "_scanAreaMargins", void 0);
2003
2003
  __decorate([
2004
- ignoreFromSerialization
2004
+ nameForSerialization('pointOfInterest')
2005
2005
  ], BaseDataCaptureView.prototype, "_pointOfInterest", void 0);
2006
2006
  __decorate([
2007
- ignoreFromSerialization
2007
+ nameForSerialization('logoAnchor')
2008
2008
  ], BaseDataCaptureView.prototype, "_logoAnchor", void 0);
2009
2009
  __decorate([
2010
- ignoreFromSerialization
2010
+ nameForSerialization('logoOffset')
2011
2011
  ], BaseDataCaptureView.prototype, "_logoOffset", void 0);
2012
2012
  __decorate([
2013
- ignoreFromSerialization
2013
+ nameForSerialization('focusGesture')
2014
2014
  ], BaseDataCaptureView.prototype, "_focusGesture", void 0);
2015
2015
  __decorate([
2016
- ignoreFromSerialization
2016
+ nameForSerialization('zoomGesture')
2017
2017
  ], BaseDataCaptureView.prototype, "_zoomGesture", void 0);
2018
2018
  __decorate([
2019
- ignoreFromSerialization
2019
+ nameForSerialization('logoStyle')
2020
2020
  ], BaseDataCaptureView.prototype, "_logoStyle", void 0);
2021
2021
  __decorate([
2022
2022
  ignoreFromSerialization
@@ -2413,12 +2413,17 @@ class RectangularViewfinder extends DefaultSerializeable {
2413
2413
  get sizeWithUnitAndAspect() {
2414
2414
  return this._sizeWithUnitAndAspect;
2415
2415
  }
2416
+ set sizeWithUnitAndAspect(value) {
2417
+ this._sizeWithUnitAndAspect = value;
2418
+ this.update();
2419
+ }
2416
2420
  get coreDefaults() {
2417
2421
  return getCoreDefaults();
2418
2422
  }
2419
2423
  constructor(style, lineStyle) {
2420
2424
  super();
2421
2425
  this.type = 'rectangular';
2426
+ this.eventEmitter = FactoryMaker.getInstance('EventEmitter');
2422
2427
  const viewfinderStyle = style || this.coreDefaults.RectangularViewfinder.defaultStyle;
2423
2428
  this._style = this.coreDefaults.RectangularViewfinder.styles[viewfinderStyle].style;
2424
2429
  this._lineStyle = this.coreDefaults.RectangularViewfinder.styles[viewfinderStyle].lineStyle;
@@ -2444,36 +2449,43 @@ class RectangularViewfinder extends DefaultSerializeable {
2444
2449
  }
2445
2450
  set dimming(value) {
2446
2451
  this._dimming = value;
2452
+ this.update();
2447
2453
  }
2448
2454
  get disabledDimming() {
2449
2455
  return this._disabledDimming;
2450
2456
  }
2451
2457
  set disabledDimming(value) {
2452
2458
  this._disabledDimming = value;
2459
+ this.update();
2453
2460
  }
2454
2461
  get animation() {
2455
2462
  return this._animation;
2456
2463
  }
2457
2464
  set animation(animation) {
2458
2465
  this._animation = animation;
2466
+ this.update();
2459
2467
  }
2460
2468
  setSize(size) {
2461
- this._sizeWithUnitAndAspect = SizeWithUnitAndAspect.sizeWithWidthAndHeight(size);
2469
+ this.sizeWithUnitAndAspect = SizeWithUnitAndAspect.sizeWithWidthAndHeight(size);
2462
2470
  }
2463
2471
  setWidthAndAspectRatio(width, heightToWidthAspectRatio) {
2464
- this._sizeWithUnitAndAspect = SizeWithUnitAndAspect.sizeWithWidthAndAspectRatio(width, heightToWidthAspectRatio);
2472
+ this.sizeWithUnitAndAspect = SizeWithUnitAndAspect.sizeWithWidthAndAspectRatio(width, heightToWidthAspectRatio);
2465
2473
  }
2466
2474
  setHeightAndAspectRatio(height, widthToHeightAspectRatio) {
2467
- this._sizeWithUnitAndAspect = SizeWithUnitAndAspect.sizeWithHeightAndAspectRatio(height, widthToHeightAspectRatio);
2475
+ this.sizeWithUnitAndAspect = SizeWithUnitAndAspect.sizeWithHeightAndAspectRatio(height, widthToHeightAspectRatio);
2468
2476
  }
2469
2477
  setShorterDimensionAndAspectRatio(fraction, aspectRatio) {
2470
- this._sizeWithUnitAndAspect = SizeWithUnitAndAspect.sizeWithShorterDimensionAndAspectRatio(new NumberWithUnit(fraction, MeasureUnit.Fraction), aspectRatio);
2478
+ this.sizeWithUnitAndAspect = SizeWithUnitAndAspect.sizeWithShorterDimensionAndAspectRatio(new NumberWithUnit(fraction, MeasureUnit.Fraction), aspectRatio);
2471
2479
  }
2472
2480
  get disabledColor() {
2473
2481
  return this._disabledColor;
2474
2482
  }
2475
2483
  set disabledColor(value) {
2476
2484
  this._disabledColor = value;
2485
+ this.update();
2486
+ }
2487
+ update() {
2488
+ this.eventEmitter.emit('viewfinder.update');
2477
2489
  }
2478
2490
  }
2479
2491
  __decorate([
@@ -2498,6 +2510,9 @@ __decorate([
2498
2510
  __decorate([
2499
2511
  nameForSerialization('disabledColor')
2500
2512
  ], RectangularViewfinder.prototype, "_disabledColor", void 0);
2513
+ __decorate([
2514
+ ignoreFromSerialization
2515
+ ], RectangularViewfinder.prototype, "eventEmitter", void 0);
2501
2516
 
2502
2517
  var RectangularViewfinderStyle;
2503
2518
  (function (RectangularViewfinderStyle) {