scandit-capacitor-datacapture-core 7.3.0-beta.2 → 7.4.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.
@@ -16,5 +16,5 @@ Pod::Spec.new do |s|
16
16
  s.swift_version = "5.7"
17
17
 
18
18
  s.dependency "Capacitor"
19
- s.dependency "scandit-datacapture-frameworks-core", '= 7.3.0-beta.2'
19
+ s.dependency "scandit-datacapture-frameworks-core", '= 7.4.0-beta.1'
20
20
  end
@@ -83,7 +83,7 @@ repositories {
83
83
  }
84
84
 
85
85
  dependencies {
86
- def sdk_version = "7.3.0-beta.2"
86
+ def sdk_version = "7.4.0-beta.1"
87
87
 
88
88
  implementation fileTree(dir: 'libs', include: ['*.jar'])
89
89
 
@@ -20,10 +20,6 @@ import com.scandit.datacapture.frameworks.core.CoreModule
20
20
  import com.scandit.datacapture.frameworks.core.events.Emitter
21
21
  import com.scandit.datacapture.frameworks.core.lifecycle.ActivityLifecycleDispatcher
22
22
  import com.scandit.datacapture.frameworks.core.lifecycle.DefaultActivityLifecycle
23
- import com.scandit.datacapture.frameworks.core.listeners.FrameworksDataCaptureContextListener
24
- import com.scandit.datacapture.frameworks.core.listeners.FrameworksDataCaptureViewListener
25
- import com.scandit.datacapture.frameworks.core.listeners.FrameworksFrameSourceDeserializer
26
- import com.scandit.datacapture.frameworks.core.listeners.FrameworksFrameSourceListener
27
23
  import org.json.JSONException
28
24
  import org.json.JSONObject
29
25
 
@@ -47,16 +43,11 @@ class ScanditCaptureCoreNative :
47
43
  "ScanditTextNative"
48
44
  )
49
45
  }
46
+
50
47
  private val lifecycleDispatcher: ActivityLifecycleDispatcher =
51
48
  DefaultActivityLifecycle.getInstance()
52
49
  private val captureViewHandler = DataCaptureViewHandler()
53
- private val frameSourceListener = FrameworksFrameSourceListener(this)
54
- private val coreModule = CoreModule(
55
- frameSourceListener,
56
- FrameworksDataCaptureContextListener(this),
57
- FrameworksDataCaptureViewListener(this),
58
- FrameworksFrameSourceDeserializer(frameSourceListener)
59
- )
50
+ private val coreModule = CoreModule.create(this)
60
51
  private var lastFrameSourceState: FrameSourceState = FrameSourceState.OFF
61
52
 
62
53
  private val plugins = mutableListOf<Plugin>()
@@ -92,7 +83,7 @@ class ScanditCaptureCoreNative :
92
83
  coreModule.switchToDesiredCameraState(lastFrameSourceState)
93
84
  }
94
85
  coreModule.registerDataCaptureContextListener()
95
- coreModule.registerDataCaptureViewListener()
86
+ coreModule.registerTopmostDataCaptureViewListener()
96
87
  coreModule.registerFrameSourceListener()
97
88
  lifecycleDispatcher.dispatchOnStart()
98
89
  }
@@ -102,7 +93,7 @@ class ScanditCaptureCoreNative :
102
93
  lastFrameSourceState = coreModule.getCurrentCameraDesiredState() ?: FrameSourceState.OFF
103
94
  coreModule.switchToDesiredCameraState(FrameSourceState.OFF)
104
95
  coreModule.unregisterDataCaptureContextListener()
105
- coreModule.unregisterDataCaptureViewListener()
96
+ coreModule.unregisterTopmostDataCaptureViewListener()
106
97
  coreModule.unregisterFrameSourceListener()
107
98
  }
108
99
 
@@ -246,15 +237,23 @@ class ScanditCaptureCoreNative :
246
237
  val pointJson = call.data.getString("point")
247
238
  ?: return call.reject(EMPTY_STRING_ERROR)
248
239
 
249
- coreModule.viewPointForFramePoint(pointJson, CapacitorResult(call))
240
+ val viewId = call.data.getInt("viewId")
241
+
242
+ coreModule.viewPointForFramePoint(viewId, pointJson, CapacitorResult(call))
250
243
  }
251
244
 
252
245
  @PluginMethod
253
246
  fun viewQuadrilateralForFrameQuadrilateral(call: PluginCall) {
254
- val pointJson = call.data.getString("point")
247
+ val quadrilateralJson = call.data.getString("quadrilateral")
255
248
  ?: return call.reject(EMPTY_STRING_ERROR)
256
249
 
257
- coreModule.viewQuadrilateralForFrameQuadrilateral(pointJson, CapacitorResult(call))
250
+ val viewId = call.data.getInt("viewId")
251
+
252
+ coreModule.viewQuadrilateralForFrameQuadrilateral(
253
+ viewId,
254
+ quadrilateralJson,
255
+ CapacitorResult(call)
256
+ )
258
257
  }
259
258
  //endregion
260
259
 
@@ -287,13 +286,15 @@ class ScanditCaptureCoreNative :
287
286
 
288
287
  @PluginMethod
289
288
  fun subscribeViewListener(call: PluginCall) {
290
- coreModule.registerDataCaptureViewListener()
289
+ val viewId = call.data.getInt("viewId")
290
+ coreModule.registerDataCaptureViewListener(viewId)
291
291
  call.resolve()
292
292
  }
293
293
 
294
294
  @PluginMethod
295
295
  fun unsubscribeViewListener(call: PluginCall) {
296
- coreModule.unregisterDataCaptureViewListener()
296
+ val viewId = call.data.getInt("viewId")
297
+ coreModule.unregisterDataCaptureViewListener(viewId)
297
298
  call.resolve()
298
299
  }
299
300
 
@@ -349,9 +350,10 @@ class ScanditCaptureCoreNative :
349
350
 
350
351
  @PluginMethod
351
352
  fun removeDataCaptureView(call: PluginCall) {
353
+ val viewId = call.data.getInt("viewId")
352
354
  // In capacitor we just show 1 datacapture view at a time
353
- val dcViewToRemove = captureViewHandler.dataCaptureView
354
- if (dcViewToRemove != null) {
355
+ val dcViewToRemove = coreModule.getDataCaptureViewById(viewId)
356
+ dcViewToRemove?.post {
355
357
  coreModule.dataCaptureViewDisposed(dcViewToRemove)
356
358
  captureViewHandler.removeDataCaptureView(dcViewToRemove)
357
359
  }
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
@@ -3412,5 +3440,5 @@ class BaseNewController {
3412
3440
 
3413
3441
  createEventEmitter();
3414
3442
 
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 };
3443
+ 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, 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 };
3416
3444
  //# sourceMappingURL=core.js.map