scandit-react-native-datacapture-core 7.3.0 → 7.4.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.
@@ -1,5 +1,5 @@
1
- ScanditIdCaptureBackend / ScanditIDC / Scandit.DataCapture.IdCapture /
2
- scandit-...-datacapture-id includes components licensed under the licenses in
1
+ ScanditIdCaptureBackend / ScanditIDC / Scandit.DataCapture.IdCapture /
2
+ scandit-...-datacapture-id includes components licensed under the licenses in
3
3
  THIRD_PARTY.txt as well as the following licenses:
4
4
 
5
5
  ================================================================================
@@ -38,7 +38,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38
38
  ================================================================================
39
39
 
40
40
 
41
- Written by Sebastien Andrivet - Copyright (c) 2010-2017 Sebastien Andrivet.
41
+ Written by Sebastien Andrivet - Copyright (c) 2010-2017 Sebastien Andrivet.
42
42
  Copyright (c) 2022, MICROBLINK
43
43
  Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.
44
44
  Copyright 2019 Google LLC
@@ -47,6 +47,9 @@ Copyright 2008 Google Inc. All rights reserved.
47
47
  Copyright (c)2009-2024 D. R. Commander. All Rights Reserved.
48
48
  Copyright (c)2015 Viktor Szathmáry. All Rights Reserved.
49
49
  Copyright (c) 2012-2016 Free Software Foundation, Inc.
50
+ Copyright (c) 2020, Patrick Uiterwijk. All rights reserved.
51
+ Copyright (c) 2018-2024, Laurence Lundblade. All rights reserved.
52
+ Copyright (c) 2021, Arm Limited. All rights reserved.
50
53
 
51
54
  Redistribution and use in source and binary forms, with or without
52
55
  modification, are permitted provided that the following conditions are met:
@@ -74,6 +77,43 @@ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
74
77
  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
75
78
 
76
79
 
80
+ ================================================================================
81
+
82
+
83
+ Copyright (c) 2016-2018, The Linux Foundation.
84
+ Copyright (c) 2018-2024, Laurence Lundblade.
85
+ Copyright (c) 2021, Arm Limited.
86
+ All rights reserved.
87
+
88
+ Redistribution and use in source and binary forms, with or without
89
+ modification, are permitted provided that the following conditions are met:
90
+
91
+ * Redistributions of source code must retain the above copyright notice, this
92
+ list of conditions and the following disclaimer.
93
+
94
+ * Redistributions in binary form must reproduce the above copyright notice,
95
+ this list of conditions and the following disclaimer in the documentation
96
+ and/or other materials provided with the distribution.
97
+
98
+ * Neither the name of the Linux Foundation nor the names of its
99
+ contributors, nor the name “Laurence Lundblade” may be used to
100
+ endorse or promote products derived from this software without
101
+ specific prior written permission.
102
+
103
+
104
+ THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
105
+ WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
106
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
107
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
108
+ BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
109
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
110
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
111
+ BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
112
+ WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
113
+ OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
114
+ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
115
+
116
+
77
117
  ================================================================================
78
118
 
79
119
 
@@ -104,7 +144,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
104
144
  SOFTWARE.
105
145
 
106
146
 
107
- ================================================================================
147
+ ================================================================================
108
148
 
109
149
 
110
150
  Mozilla Public License Version 2.0
@@ -144,7 +184,7 @@ Mozilla Public License Version 2.0
144
184
  means any form of the work other than Source Code Form.
145
185
 
146
186
  1.7. "Larger Work"
147
- means a work that combines Covered Software with other material, in
187
+ means a work that combines Covered Software with other material, in
148
188
  a separate file or files, that is not Covered Software.
149
189
 
150
190
  1.8. "License"
@@ -485,6 +525,21 @@ Exhibit B - "Incompatible With Secondary Licenses" Notice
485
525
  The unchanged source code for Eigen can be found at https://github.com/eigenteam/eigen-git-mirror
486
526
 
487
527
 
488
- ================================================================================
528
+ ================================================================================
529
+
530
+
531
+ Copyright 2025 tuyen-vuduc
532
+
533
+ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
489
534
 
535
+ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
536
+
537
+ 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
538
+
539
+ 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
540
+
541
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
542
+
543
+
544
+ ================================================================================
490
545
 
@@ -25,7 +25,7 @@ buildscript {
25
25
  if (ext.has("kotlinVersion")) {
26
26
  ext.kotlinVersion()
27
27
  } else {
28
- ext.safeExtGet("kotlinVersion", "1.8.22")
28
+ ext.safeExtGet("kotlinVersion", "1.9.25")
29
29
  }
30
30
  }
31
31
 
@@ -68,7 +68,7 @@ if (file( "${rootProject.projectDir}/build-test.gradle").exists()) {
68
68
  }
69
69
 
70
70
  dependencies {
71
- def sdk_version = "7.3.0"
71
+ def sdk_version = "7.4.0-beta.2"
72
72
 
73
73
  println("Version of the native sdk used in this build: ${safeExtGet('global_sdk_version', sdk_version)}")
74
74
  if (findProject(':scandit-datacapture-frameworks-core') != null) {
@@ -10,11 +10,13 @@ import com.facebook.react.bridge.Promise
10
10
  import com.facebook.react.bridge.ReactApplicationContext
11
11
  import com.facebook.react.bridge.ReactContextBaseJavaModule
12
12
  import com.facebook.react.bridge.ReactMethod
13
+ import com.facebook.react.bridge.ReadableMap
13
14
  import com.facebook.react.uimanager.ViewGroupManager
14
15
  import com.scandit.datacapture.core.capture.DataCaptureVersion
15
16
  import com.scandit.datacapture.frameworks.core.CoreModule
16
17
  import com.scandit.datacapture.frameworks.core.FrameworkModule
17
18
  import com.scandit.datacapture.frameworks.core.errors.ModuleNotStartedError
19
+ import com.scandit.datacapture.frameworks.core.errors.ParameterNullError
18
20
  import com.scandit.datacapture.frameworks.core.locator.ServiceLocator
19
21
  import com.scandit.datacapture.frameworks.core.utils.DefaultMainThread
20
22
  import com.scandit.datacapture.frameworks.core.utils.MainThread
@@ -71,13 +73,13 @@ class ScanditDataCaptureCoreModule(
71
73
  }
72
74
 
73
75
  @ReactMethod
74
- fun registerListenerForViewEvents() {
75
- coreModule.registerDataCaptureViewListener()
76
+ fun registerListenerForViewEvents(viewId: Int) {
77
+ coreModule.registerDataCaptureViewListener(viewId)
76
78
  }
77
79
 
78
80
  @ReactMethod
79
- fun unregisterListenerForViewEvents() {
80
- coreModule.unregisterDataCaptureViewListener()
81
+ fun unregisterListenerForViewEvents(viewId: Int) {
82
+ coreModule.unregisterDataCaptureViewListener(viewId)
81
83
  }
82
84
 
83
85
  @ReactMethod
@@ -108,13 +110,29 @@ class ScanditDataCaptureCoreModule(
108
110
  }
109
111
 
110
112
  @ReactMethod
111
- fun viewPointForFramePoint(json: String, promise: Promise) {
112
- coreModule.viewPointForFramePoint(json, ReactNativeResult(promise))
113
+ fun viewPointForFramePoint(readableMap: ReadableMap, promise: Promise) {
114
+ val pointJson = readableMap.getString("point") ?: return promise.reject(
115
+ ParameterNullError("point")
116
+ )
117
+
118
+ coreModule.viewPointForFramePoint(
119
+ readableMap.getInt("viewId"),
120
+ pointJson,
121
+ ReactNativeResult(promise)
122
+ )
113
123
  }
114
124
 
115
125
  @ReactMethod
116
- fun viewQuadrilateralForFrameQuadrilateral(json: String, promise: Promise) {
117
- coreModule.viewQuadrilateralForFrameQuadrilateral(json, ReactNativeResult(promise))
126
+ fun viewQuadrilateralForFrameQuadrilateral(readableMap: ReadableMap, promise: Promise) {
127
+ val quadrilateralJson = readableMap.getString("quadrilateral") ?: return promise.reject(
128
+ ParameterNullError("quadrilateral")
129
+ )
130
+
131
+ coreModule.viewQuadrilateralForFrameQuadrilateral(
132
+ readableMap.getInt("viewId"),
133
+ quadrilateralJson,
134
+ ReactNativeResult(promise)
135
+ )
118
136
  }
119
137
 
120
138
  @ReactMethod
@@ -169,6 +187,16 @@ class ScanditDataCaptureCoreModule(
169
187
  coreModule.getOpenSourceSoftwareLicenseInfo(ReactNativeResult(promise))
170
188
  }
171
189
 
190
+ @ReactMethod
191
+ fun addListener(@Suppress("UNUSED_PARAMETER") eventName: String?) {
192
+ // Keep: Required for RN built in Event Emitter Calls.
193
+ }
194
+
195
+ @ReactMethod
196
+ fun removeListeners(@Suppress("UNUSED_PARAMETER") count: Int?) {
197
+ // Keep: Required for RN built in Event Emitter Calls.
198
+ }
199
+
172
200
  private val coreModule: CoreModule
173
201
  get() {
174
202
  return serviceLocator.resolve(CoreModule::class.java.name) as? CoreModule?
@@ -15,9 +15,6 @@ import com.scandit.datacapture.frameworks.core.CoreModule
15
15
  import com.scandit.datacapture.frameworks.core.events.Emitter
16
16
  import com.scandit.datacapture.frameworks.core.lifecycle.ActivityLifecycleDispatcher
17
17
  import com.scandit.datacapture.frameworks.core.lifecycle.DefaultActivityLifecycle
18
- import com.scandit.datacapture.frameworks.core.listeners.FrameworksDataCaptureContextListener
19
- import com.scandit.datacapture.frameworks.core.listeners.FrameworksDataCaptureViewListener
20
- import com.scandit.datacapture.frameworks.core.listeners.FrameworksFrameSourceListener
21
18
  import com.scandit.datacapture.frameworks.core.locator.DefaultServiceLocator
22
19
  import com.scandit.datacapture.reactnative.core.ui.DataCaptureViewManager
23
20
  import com.scandit.datacapture.reactnative.core.utils.ReactNativeEventEmitter
@@ -84,11 +81,7 @@ class ScanditDataCaptureCorePackage : ReactPackage {
84
81
  serviceLocator.remove(CoreModule::class.java.name)
85
82
 
86
83
  val eventEmitter: Emitter = ReactNativeEventEmitter(reactContext)
87
- val coreModule = CoreModule.create(
88
- FrameworksFrameSourceListener(eventEmitter),
89
- FrameworksDataCaptureContextListener(eventEmitter),
90
- FrameworksDataCaptureViewListener(eventEmitter)
91
- )
84
+ val coreModule = CoreModule.create(eventEmitter)
92
85
  coreModule.onCreate(reactContext)
93
86
  serviceLocator.register(coreModule)
94
87
  } finally {
@@ -48,12 +48,7 @@ class DataCaptureViewManager(
48
48
 
49
49
  override fun onDropViewInstance(view: FrameLayout) {
50
50
  // remove current DCView from core cache
51
- for (i in 0 until view.childCount) {
52
- val child = view.getChildAt(i)
53
- if (child is DataCaptureView) { // it should always be a DCView but you never know
54
- coreModule.dataCaptureViewDisposed(child)
55
- }
56
- }
51
+ coreModule.dataCaptureViewDisposed(view.id)
57
52
 
58
53
  super.onDropViewInstance(view)
59
54
  }
package/dist/core.js CHANGED
@@ -2238,13 +2238,13 @@ class DataCaptureViewController extends BaseController {
2238
2238
  }
2239
2239
  viewPointForFramePoint(point) {
2240
2240
  return __awaiter(this, void 0, void 0, function* () {
2241
- const result = yield this._proxy.viewPointForFramePoint(JSON.stringify(point.toJSON()));
2241
+ const result = yield this._proxy.viewPointForFramePoint({ viewId: this.view.viewId, pointJson: JSON.stringify(point.toJSON()) });
2242
2242
  return Point.fromJSON(JSON.parse(result.data));
2243
2243
  });
2244
2244
  }
2245
2245
  viewQuadrilateralForFrameQuadrilateral(quadrilateral) {
2246
2246
  return __awaiter(this, void 0, void 0, function* () {
2247
- const result = yield this._proxy.viewQuadrilateralForFrameQuadrilateral(JSON.stringify(quadrilateral.toJSON()));
2247
+ const result = yield this._proxy.viewQuadrilateralForFrameQuadrilateral({ viewId: this.view.viewId, quadrilateralJson: JSON.stringify(quadrilateral.toJSON()) });
2248
2248
  return Quadrilateral.fromJSON(JSON.parse(result.data));
2249
2249
  });
2250
2250
  }
@@ -2264,7 +2264,7 @@ class DataCaptureViewController extends BaseController {
2264
2264
  });
2265
2265
  }
2266
2266
  removeNativeView() {
2267
- return this._proxy.removeView();
2267
+ return this._proxy.removeView(this.view.viewId);
2268
2268
  }
2269
2269
  createView() {
2270
2270
  return this._proxy.createView(JSON.stringify(this.view.toJSON()));
@@ -2277,7 +2277,7 @@ class DataCaptureViewController extends BaseController {
2277
2277
  }
2278
2278
  subscribeListener() {
2279
2279
  var _a, _b;
2280
- this._proxy.registerListenerForViewEvents();
2280
+ this._proxy.registerListenerForViewEvents(this.view.viewId);
2281
2281
  (_b = (_a = this._proxy).subscribeDidChangeSize) === null || _b === void 0 ? void 0 : _b.call(_a);
2282
2282
  this.eventEmitter.on(DataCaptureViewEvents.didChangeSize, (data) => {
2283
2283
  const event = EventDataParser.parse(data);
@@ -2285,6 +2285,9 @@ class DataCaptureViewController extends BaseController {
2285
2285
  console.error('DataCaptureViewController didChangeSize payload is null');
2286
2286
  return;
2287
2287
  }
2288
+ if (event.viewId !== this.view.viewId) {
2289
+ return;
2290
+ }
2288
2291
  const size = Size.fromJSON(event.size);
2289
2292
  const orientation = event.orientation;
2290
2293
  this.view.listeners.forEach(listener => {
@@ -2295,7 +2298,7 @@ class DataCaptureViewController extends BaseController {
2295
2298
  });
2296
2299
  }
2297
2300
  unsubscribeListener() {
2298
- this._proxy.unregisterListenerForViewEvents();
2301
+ this._proxy.unregisterListenerForViewEvents(this.view.viewId);
2299
2302
  this.eventEmitter.removeAllListeners(DataCaptureViewEvents.didChangeSize);
2300
2303
  }
2301
2304
  }
@@ -2320,6 +2323,13 @@ class BaseDataCaptureView extends DefaultSerializeable {
2320
2323
  get scanAreaMargins() {
2321
2324
  return this._scanAreaMargins;
2322
2325
  }
2326
+ get viewId() {
2327
+ var _a;
2328
+ return (_a = this._viewId) !== null && _a !== void 0 ? _a : -1;
2329
+ }
2330
+ set viewId(newValue) {
2331
+ this._viewId = newValue;
2332
+ }
2323
2333
  set scanAreaMargins(newValue) {
2324
2334
  this._scanAreaMargins = newValue;
2325
2335
  this.controller.updateView();
@@ -2378,7 +2388,6 @@ class BaseDataCaptureView extends DefaultSerializeable {
2378
2388
  constructor(autoCreateNativeView) {
2379
2389
  super();
2380
2390
  this._context = null;
2381
- this.viewId = null;
2382
2391
  this.overlays = [];
2383
2392
  this.controls = [];
2384
2393
  this.listeners = [];
@@ -2450,11 +2459,12 @@ class BaseDataCaptureView extends DefaultSerializeable {
2450
2459
  controlUpdated() {
2451
2460
  this.controller.updateView();
2452
2461
  }
2453
- createNativeView() {
2462
+ createNativeView(viewId) {
2454
2463
  return __awaiter(this, void 0, void 0, function* () {
2455
2464
  if (this.isViewCreated) {
2456
2465
  return Promise.resolve();
2457
2466
  }
2467
+ this.viewId = viewId;
2458
2468
  yield this.controller.createNativeView();
2459
2469
  this.isViewCreated = true;
2460
2470
  });
@@ -2507,8 +2517,8 @@ __decorate([
2507
2517
  nameForSerialization('scanAreaMargins')
2508
2518
  ], BaseDataCaptureView.prototype, "_scanAreaMargins", void 0);
2509
2519
  __decorate([
2510
- ignoreFromSerializationIfNull
2511
- ], BaseDataCaptureView.prototype, "viewId", void 0);
2520
+ nameForSerialization('viewId')
2521
+ ], BaseDataCaptureView.prototype, "_viewId", void 0);
2512
2522
  __decorate([
2513
2523
  nameForSerialization('pointOfInterest')
2514
2524
  ], BaseDataCaptureView.prototype, "_pointOfInterest", void 0);
@@ -2981,6 +2991,19 @@ class AimerViewfinder extends DefaultSerializeable {
2981
2991
  }
2982
2992
  }
2983
2993
 
2994
+ class LaserlineViewfinder extends DefaultSerializeable {
2995
+ get coreDefaults() {
2996
+ return getCoreDefaults();
2997
+ }
2998
+ constructor() {
2999
+ super();
3000
+ this.type = 'laserline';
3001
+ this.width = this.coreDefaults.LaserlineViewfinder.width;
3002
+ this.enabledColor = this.coreDefaults.LaserlineViewfinder.enabledColor;
3003
+ this.disabledColor = this.coreDefaults.LaserlineViewfinder.disabledColor;
3004
+ }
3005
+ }
3006
+
2984
3007
  function parseDefaults(jsonDefaults) {
2985
3008
  const coreDefaults = {
2986
3009
  Camera: {
@@ -3035,6 +3058,11 @@ function parseDefaults(jsonDefaults) {
3035
3058
  Brush: new Brush(Color
3036
3059
  .fromJSON(jsonDefaults.Brush.fillColor), Color
3037
3060
  .fromJSON(jsonDefaults.Brush.strokeColor), jsonDefaults.Brush.strokeWidth),
3061
+ LaserlineViewfinder: {
3062
+ width: NumberWithUnit.fromJSON(JSON.parse(jsonDefaults.LaserlineViewfinder.width)),
3063
+ enabledColor: Color.fromJSON(jsonDefaults.LaserlineViewfinder.enabledColor),
3064
+ disabledColor: Color.fromJSON(jsonDefaults.LaserlineViewfinder.disabledColor),
3065
+ },
3038
3066
  deviceID: jsonDefaults.deviceID,
3039
3067
  };
3040
3068
  // Inject defaults to avoid a circular dependency between these classes and the defaults
@@ -3401,6 +3429,97 @@ function createAdvancedInstanceAwareNativeProxy(nativeCaller, eventsEnum = undef
3401
3429
  return new AdvancedInstanceAwareNativeProxy(nativeCaller, eventsList);
3402
3430
  }
3403
3431
 
3432
+ /**
3433
+ * JS Proxy hook to act as middleware to all the calls performed by an AdvancedNativeProxy instance
3434
+ * This will allow AdvancedNativeProxy to call dynamically the methods defined in the interface defined
3435
+ * as parameter in createAdvancedNativeProxy function
3436
+ */
3437
+ const nativeProxyHook = {
3438
+ /**
3439
+ * Dynamic property getter for the AdvancedNativeProxy
3440
+ * In order to call a native method this needs to be preceded by the `$` symbol on the name, ie `$methodName`
3441
+ * In order to set a native event handler this needs to be preceded by `on$` prefix, ie `on$eventName`
3442
+ * @param advancedNativeProxy
3443
+ * @param prop
3444
+ */
3445
+ get(nativeProxy, prop) {
3446
+ // Important: $ and on$ are required since if they are not added all
3447
+ // properties present on AdvancedNativeProxy will be redirected to the
3448
+ // advancedNativeProxy._call, which will call native even for the own
3449
+ // properties of the class
3450
+ // All the methods with the following structure
3451
+ // $methodName will be redirected to the special _call
3452
+ // method on AdvancedNativeProxy
3453
+ if (prop.startsWith("$")) {
3454
+ if (prop in nativeProxy) {
3455
+ return nativeProxy[prop];
3456
+ }
3457
+ return (args) => {
3458
+ return nativeProxy._call(prop.substring(1), args);
3459
+ };
3460
+ }
3461
+ else {
3462
+ return nativeProxy[prop];
3463
+ }
3464
+ }
3465
+ };
3466
+ class NativeProxy extends BaseInstanceAwareNativeProxy {
3467
+ constructor(nativeCaller) {
3468
+ super();
3469
+ this.nativeCaller = nativeCaller;
3470
+ this.eventSubscriptions = new Map();
3471
+ this.eventHandlers = new Map();
3472
+ // Create the cached handler once
3473
+ this.cachedEventHandler = (eventName) => (args) => __awaiter(this, void 0, void 0, function* () {
3474
+ this.eventEmitter.emit(eventName, args);
3475
+ });
3476
+ // Wrapping the NativeProxy instance with the JS proxy hook
3477
+ return new Proxy(this, nativeProxyHook);
3478
+ }
3479
+ subscribeForEvents(events) {
3480
+ return __awaiter(this, void 0, void 0, function* () {
3481
+ for (const event of events) {
3482
+ yield this._registerEvent(event);
3483
+ }
3484
+ });
3485
+ }
3486
+ unsubscribeFromEvents(events) {
3487
+ return __awaiter(this, void 0, void 0, function* () {
3488
+ for (const event of events) {
3489
+ yield this._unregisterEvent(event);
3490
+ }
3491
+ });
3492
+ }
3493
+ dispose() {
3494
+ return __awaiter(this, void 0, void 0, function* () {
3495
+ for (const nativeEventName of this.eventSubscriptions.keys()) {
3496
+ yield this._unregisterEvent(nativeEventName);
3497
+ }
3498
+ this.eventSubscriptions.clear();
3499
+ });
3500
+ }
3501
+ _call(fnName, args) {
3502
+ return this.nativeCaller.callFn(fnName, args);
3503
+ }
3504
+ _registerEvent(event) {
3505
+ return __awaiter(this, void 0, void 0, function* () {
3506
+ const handler = this.cachedEventHandler(event);
3507
+ const subscription = yield this.nativeCaller.registerEvent(event, handler);
3508
+ this.eventSubscriptions.set(event, subscription);
3509
+ });
3510
+ }
3511
+ _unregisterEvent(event) {
3512
+ return __awaiter(this, void 0, void 0, function* () {
3513
+ const subscription = this.eventSubscriptions.get(event);
3514
+ yield this.nativeCaller.unregisterEvent(event, subscription);
3515
+ this.eventSubscriptions.delete(event);
3516
+ });
3517
+ }
3518
+ }
3519
+ function createNativeProxy(nativeCaller) {
3520
+ return new NativeProxy(nativeCaller);
3521
+ }
3522
+
3404
3523
  class BaseNewController {
3405
3524
  get _proxy() {
3406
3525
  return this._cachedProxy;
@@ -3412,5 +3531,5 @@ class BaseNewController {
3412
3531
 
3413
3532
  createEventEmitter();
3414
3533
 
3415
- export { AdvancedInstanceAwareNativeProxy, AdvancedNativeProxy, AimerViewfinder, Anchor, BaseController, BaseDataCaptureView, BaseInstanceAwareNativeProxy, BaseNativeProxy, BaseNewController, Brush, Camera, CameraController, CameraPosition, CameraSettings, Color, ContextStatus, ControlImage, DataCaptureContext, DataCaptureContextEvents, DataCaptureContextSettings, DataCaptureViewController, DataCaptureViewEvents, DefaultSerializeable, Direction, EventDataParser, EventEmitter, Expiration, FactoryMaker, Feedback, FocusGestureStrategy, FocusRange, FontFamily, FrameSourceListenerEvents, FrameSourceState, HTMLElementState, HtmlElementPosition, HtmlElementSize, ImageBuffer, ImageFrameSource, LicenseInfo, LogoStyle, MarginsWithUnit, MeasureUnit, NoViewfinder, NoneLocationSelection, NumberWithUnit, Observable, OpenSourceSoftwareLicenseInfo, Orientation, Point, PointWithUnit, PrivateFocusGestureDeserializer, PrivateFrameData, PrivateZoomGestureDeserializer, Quadrilateral, RadiusLocationSelection, Rect, RectWithUnit, RectangularLocationSelection, RectangularViewfinder, RectangularViewfinderAnimation, RectangularViewfinderLineStyle, RectangularViewfinderStyle, ScanIntention, ScanditIcon, ScanditIconBuilder, ScanditIconShape, ScanditIconType, Size, SizeWithAspect, SizeWithUnit, SizeWithUnitAndAspect, SizingMode, Sound, SwipeToZoom, TapToFocus, TextAlignment, TorchState, TorchSwitchControl, Vibration, VibrationType, VideoResolution, WaveFormVibration, ZoomSwitchControl, createAdvancedInstanceAwareNativeProxy, createAdvancedNativeFromCtorProxy, createAdvancedNativeProxy, getCoreDefaults, ignoreFromSerialization, ignoreFromSerializationIfNull, loadCoreDefaults, nameForSerialization, serializationDefault };
3534
+ export { AdvancedInstanceAwareNativeProxy, AdvancedNativeProxy, AimerViewfinder, Anchor, BaseController, BaseDataCaptureView, BaseInstanceAwareNativeProxy, BaseNativeProxy, BaseNewController, Brush, Camera, CameraController, CameraPosition, CameraSettings, Color, ContextStatus, ControlImage, DataCaptureContext, DataCaptureContextEvents, DataCaptureContextSettings, DataCaptureViewController, DataCaptureViewEvents, DefaultSerializeable, Direction, EventDataParser, EventEmitter, Expiration, FactoryMaker, Feedback, FocusGestureStrategy, FocusRange, FontFamily, FrameSourceListenerEvents, FrameSourceState, HTMLElementState, HtmlElementPosition, HtmlElementSize, ImageBuffer, ImageFrameSource, LaserlineViewfinder, LicenseInfo, LogoStyle, MarginsWithUnit, MeasureUnit, NativeProxy, NoViewfinder, NoneLocationSelection, NumberWithUnit, Observable, OpenSourceSoftwareLicenseInfo, Orientation, Point, PointWithUnit, PrivateFocusGestureDeserializer, PrivateFrameData, PrivateZoomGestureDeserializer, Quadrilateral, RadiusLocationSelection, Rect, RectWithUnit, RectangularLocationSelection, RectangularViewfinder, RectangularViewfinderAnimation, RectangularViewfinderLineStyle, RectangularViewfinderStyle, ScanIntention, ScanditIcon, ScanditIconBuilder, ScanditIconShape, ScanditIconType, Size, SizeWithAspect, SizeWithUnit, SizeWithUnitAndAspect, SizingMode, Sound, SwipeToZoom, TapToFocus, TextAlignment, TorchState, TorchSwitchControl, Vibration, VibrationType, VideoResolution, WaveFormVibration, ZoomSwitchControl, createAdvancedInstanceAwareNativeProxy, createAdvancedNativeFromCtorProxy, createAdvancedNativeProxy, createNativeProxy, getCoreDefaults, ignoreFromSerialization, ignoreFromSerializationIfNull, loadCoreDefaults, nameForSerialization, serializationDefault };
3416
3535
  //# sourceMappingURL=core.js.map