scandit-react-native-datacapture-core 7.5.0-beta.2 → 7.6.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.
@@ -68,7 +68,7 @@ if (file( "${rootProject.projectDir}/build-test.gradle").exists()) {
68
68
  }
69
69
 
70
70
  dependencies {
71
- def sdk_version = "7.5.0-beta.2"
71
+ def sdk_version = "7.6.0-beta.1"
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) {
package/dist/core.js CHANGED
@@ -463,6 +463,10 @@ const advancedNativeProxyHook = {
463
463
  * @param prop
464
464
  */
465
465
  get(advancedNativeProxy, prop) {
466
+ // Early return if prop is not a string
467
+ if (typeof prop !== 'string') {
468
+ return undefined;
469
+ }
466
470
  // Important: $ and on$ are required since if they are not added all
467
471
  // properties present on AdvancedNativeProxy will be redirected to the
468
472
  // advancedNativeProxy._call, which will call native even for the own
@@ -1997,7 +2001,7 @@ class DataCaptureContextSettings extends DefaultSerializeable {
1997
2001
  }
1998
2002
  }
1999
2003
  __decorate([
2000
- nameForSerialization('frameSettings')
2004
+ nameForSerialization('frameDataSettings')
2001
2005
  ], DataCaptureContextSettings.prototype, "_frameSettings", void 0);
2002
2006
 
2003
2007
  class OpenSourceSoftwareLicenseInfo {
@@ -2234,25 +2238,39 @@ class DataCaptureContext extends DefaultSerializeable {
2234
2238
  this.controller.unsubscribeListener();
2235
2239
  }
2236
2240
  }
2241
+ /**
2242
+ * @deprecated Since 7.6.
2243
+ * Use setMode() instead. DataCaptureContext does not support multiple modes at the same time.
2244
+ */
2237
2245
  addMode(mode) {
2238
- if (!this.modes.includes(mode)) {
2239
- this.modes.push(mode);
2240
- mode._context = this;
2241
- this.controller.addModeToContext(mode);
2242
- }
2246
+ this.addModeInternal(mode);
2243
2247
  }
2244
2248
  setMode(mode) {
2245
2249
  if (this.modes.length > 0) {
2246
2250
  this.removeAllModes();
2247
2251
  }
2248
- this.addMode(mode);
2252
+ this.addModeInternal(mode);
2253
+ }
2254
+ addModeInternal(mode) {
2255
+ if (!this.modes.includes(mode)) {
2256
+ this.modes.push(mode);
2257
+ mode._context = this;
2258
+ this.controller.addModeToContext(mode);
2259
+ }
2249
2260
  }
2250
2261
  removeCurrentMode() {
2251
2262
  if (this.modes.length > 0) {
2252
- this.removeMode(this.modes[0]);
2263
+ this.removeModeInternal(this.modes[0]);
2253
2264
  }
2254
2265
  }
2266
+ /**
2267
+ * @deprecated Since 7.6.
2268
+ * Use removeCurrentMode() instead.
2269
+ */
2255
2270
  removeMode(mode) {
2271
+ this.removeModeInternal(mode);
2272
+ }
2273
+ removeModeInternal(mode) {
2256
2274
  if (this.modes.includes(mode)) {
2257
2275
  this.modes.splice(this.modes.indexOf(mode), 1);
2258
2276
  mode._context = null;
@@ -2324,17 +2342,9 @@ var DataCaptureViewEvents;
2324
2342
  DataCaptureViewEvents["didChangeSize"] = "DataCaptureViewListener.onSizeChanged";
2325
2343
  })(DataCaptureViewEvents || (DataCaptureViewEvents = {}));
2326
2344
  class DataCaptureViewController extends BaseController {
2327
- static forDataCaptureView(view, autoCreateNativeView) {
2328
- const controller = new DataCaptureViewController();
2329
- controller.view = view;
2330
- if (autoCreateNativeView) {
2331
- controller.createView();
2332
- controller.subscribeListener();
2333
- }
2334
- return controller;
2335
- }
2336
- constructor() {
2345
+ constructor(view) {
2337
2346
  super('DataCaptureViewProxy');
2347
+ this.view = view;
2338
2348
  }
2339
2349
  viewPointForFramePoint(point) {
2340
2350
  return __awaiter(this, void 0, void 0, function* () {
@@ -2488,13 +2498,12 @@ class BaseDataCaptureView extends DefaultSerializeable {
2488
2498
  get privateContext() {
2489
2499
  return this.context;
2490
2500
  }
2491
- static forContext(context, autoCreateNativeView = true) {
2492
- const view = new BaseDataCaptureView(autoCreateNativeView);
2501
+ static forContext(context) {
2502
+ const view = new BaseDataCaptureView(context);
2493
2503
  view.context = context;
2494
- view.isViewCreated = autoCreateNativeView;
2495
2504
  return view;
2496
2505
  }
2497
- constructor(autoCreateNativeView) {
2506
+ constructor(context) {
2498
2507
  super();
2499
2508
  this._context = null;
2500
2509
  this._viewId = -1;
@@ -2503,7 +2512,7 @@ class BaseDataCaptureView extends DefaultSerializeable {
2503
2512
  this.controls = [];
2504
2513
  this.listeners = [];
2505
2514
  this.isViewCreated = false;
2506
- this.controller = DataCaptureViewController.forDataCaptureView(this, autoCreateNativeView);
2515
+ this.context = context;
2507
2516
  this._scanAreaMargins = this.coreDefaults.DataCaptureView.scanAreaMargins;
2508
2517
  this._pointOfInterest = this.coreDefaults.DataCaptureView.pointOfInterest;
2509
2518
  this._logoAnchor = this.coreDefaults.DataCaptureView.logoAnchor;
@@ -2511,6 +2520,7 @@ class BaseDataCaptureView extends DefaultSerializeable {
2511
2520
  this._focusGesture = this.coreDefaults.DataCaptureView.focusGesture;
2512
2521
  this._zoomGesture = this.coreDefaults.DataCaptureView.zoomGesture;
2513
2522
  this._logoStyle = this.coreDefaults.DataCaptureView.logoStyle;
2523
+ this.controller = new DataCaptureViewController(this);
2514
2524
  }
2515
2525
  addOverlay(overlay) {
2516
2526
  if (this.overlays.includes(overlay)) {
@@ -2529,7 +2539,14 @@ class BaseDataCaptureView extends DefaultSerializeable {
2529
2539
  this.controller.updateView();
2530
2540
  }
2531
2541
  removeAllOverlays() {
2532
- this.overlays = [];
2542
+ if (this.overlays.length === 0) {
2543
+ return;
2544
+ }
2545
+ const overlaysCopy = [...this.overlays];
2546
+ for (const overlay of overlaysCopy) {
2547
+ overlay.view = null;
2548
+ this.overlays.splice(this.overlays.indexOf(overlay), 1);
2549
+ }
2533
2550
  this.controller.updateView();
2534
2551
  }
2535
2552
  addListener(listener) {
@@ -2594,7 +2611,7 @@ class BaseDataCaptureView extends DefaultSerializeable {
2594
2611
  });
2595
2612
  }
2596
2613
  dispose() {
2597
- this.overlays = [];
2614
+ this.removeAllOverlays();
2598
2615
  this.listeners.forEach(listener => this.removeListener(listener));
2599
2616
  this.controller.dispose();
2600
2617
  this.viewId = -1;
@@ -2933,6 +2950,7 @@ class CameraSettings extends DefaultSerializeable {
2933
2950
  return settings;
2934
2951
  }
2935
2952
  constructor(settings) {
2953
+ var _a, _b, _c, _d, _e, _f;
2936
2954
  super();
2937
2955
  this.focusHiddenProperties = [
2938
2956
  'range',
@@ -2949,13 +2967,13 @@ class CameraSettings extends DefaultSerializeable {
2949
2967
  focusGestureStrategy: CameraSettings.coreDefaults.Camera.Settings.focusGestureStrategy,
2950
2968
  shouldPreferSmoothAutoFocus: CameraSettings.coreDefaults.Camera.Settings.shouldPreferSmoothAutoFocus
2951
2969
  };
2952
- this.preferredResolution = CameraSettings.coreDefaults.Camera.Settings.preferredResolution;
2953
- this.zoomFactor = CameraSettings.coreDefaults.Camera.Settings.zoomFactor;
2954
- this.zoomGestureZoomFactor = CameraSettings.coreDefaults.Camera.Settings.zoomGestureZoomFactor;
2970
+ this.preferredResolution = (_a = settings === null || settings === void 0 ? void 0 : settings.preferredResolution) !== null && _a !== void 0 ? _a : CameraSettings.coreDefaults.Camera.Settings.preferredResolution;
2971
+ this.zoomFactor = (_b = settings === null || settings === void 0 ? void 0 : settings.zoomFactor) !== null && _b !== void 0 ? _b : CameraSettings.coreDefaults.Camera.Settings.zoomFactor;
2972
+ this.zoomGestureZoomFactor = (_c = settings === null || settings === void 0 ? void 0 : settings.zoomGestureZoomFactor) !== null && _c !== void 0 ? _c : CameraSettings.coreDefaults.Camera.Settings.zoomGestureZoomFactor;
2955
2973
  this.focus = {
2956
- range: CameraSettings.coreDefaults.Camera.Settings.focusRange,
2957
- focusGestureStrategy: CameraSettings.coreDefaults.Camera.Settings.focusGestureStrategy,
2958
- shouldPreferSmoothAutoFocus: CameraSettings.coreDefaults.Camera.Settings.shouldPreferSmoothAutoFocus,
2974
+ range: (_d = settings === null || settings === void 0 ? void 0 : settings.focusRange) !== null && _d !== void 0 ? _d : CameraSettings.coreDefaults.Camera.Settings.focusRange,
2975
+ focusGestureStrategy: (_e = settings === null || settings === void 0 ? void 0 : settings.focusGestureStrategy) !== null && _e !== void 0 ? _e : CameraSettings.coreDefaults.Camera.Settings.focusGestureStrategy,
2976
+ shouldPreferSmoothAutoFocus: (_f = settings === null || settings === void 0 ? void 0 : settings.shouldPreferSmoothAutoFocus) !== null && _f !== void 0 ? _f : CameraSettings.coreDefaults.Camera.Settings.shouldPreferSmoothAutoFocus,
2959
2977
  };
2960
2978
  if (settings !== undefined && settings !== null) {
2961
2979
  Object.getOwnPropertyNames(settings).forEach(propertyName => {
@@ -3460,6 +3478,10 @@ const advancedInstanceAwareNativeProxyHook = {
3460
3478
  * @param prop
3461
3479
  */
3462
3480
  get(advancedNativeProxy, prop) {
3481
+ // Early return if prop is not a string
3482
+ if (typeof prop !== 'string') {
3483
+ return undefined;
3484
+ }
3463
3485
  // Important: $ and on$ are required since if they are not added all
3464
3486
  // properties present on AdvancedNativeProxy will be redirected to the
3465
3487
  // advancedNativeProxy._call, which will call native even for the own
@@ -3584,6 +3606,10 @@ const nativeProxyHook = {
3584
3606
  * @param prop
3585
3607
  */
3586
3608
  get(nativeProxy, prop) {
3609
+ // Early return if prop is not a string
3610
+ if (typeof prop !== 'string') {
3611
+ return undefined;
3612
+ }
3587
3613
  // Important: $ and on$ are required since if they are not added all
3588
3614
  // properties present on AdvancedNativeProxy will be redirected to the
3589
3615
  // advancedNativeProxy._call, which will call native even for the own