scandit-capacitor-datacapture-core 7.0.2 → 7.1.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.
@@ -5,3 +5,4 @@ export { DataCaptureView } from './ts/DataCaptureView';
5
5
  export { BlockingModeListenerResult } from './ts/Capacitor/CommonCapacitor';
6
6
  export { doReturnWithFinish } from './ts/Capacitor/CommonCapacitor';
7
7
  export { capacitorExec } from './ts/Capacitor/CommonCapacitor';
8
+ export { CapacitorNativeCaller } from './ts/Capacitor/Capacitor';
@@ -1,11 +1,11 @@
1
- import { CameraPosition, CameraProxy, FrameSourceState } from 'scandit-datacapture-frameworks-core';
1
+ import { CameraPosition, CameraProxy, NativeCallResult } from 'scandit-datacapture-frameworks-core';
2
2
  export declare class NativeCameraProxy implements CameraProxy {
3
3
  private eventEmitter;
4
4
  private didChangeState;
5
5
  constructor();
6
- getFrame(frameId: string): Promise<string | null>;
7
- getCurrentCameraState(_position: CameraPosition): Promise<FrameSourceState>;
8
- isTorchAvailable(position: CameraPosition): Promise<boolean>;
6
+ getFrame(frameId: string): Promise<NativeCallResult | null>;
7
+ getCurrentCameraState(_position: CameraPosition): Promise<NativeCallResult>;
8
+ isTorchAvailable(position: CameraPosition): Promise<NativeCallResult>;
9
9
  switchCameraToDesiredState(desiredStateJson: string): Promise<void>;
10
10
  registerListenerForCameraEvents(): void;
11
11
  unregisterListenerForCameraEvents(): Promise<void>;
@@ -1,4 +1,4 @@
1
- import { CoreDefaults } from 'scandit-datacapture-frameworks-core';
1
+ import { CoreDefaults, NativeCaller } from 'scandit-datacapture-frameworks-core';
2
2
  import { Optional } from '../../definitions';
3
3
  export declare enum CapacitorFunction {
4
4
  GetDefaults = "getDefaults",
@@ -44,3 +44,11 @@ export declare const Capacitor: {
44
44
  ]>) => void;
45
45
  };
46
46
  export declare const getDefaults: () => Promise<CoreDefaults>;
47
+ export declare class CapacitorNativeCaller implements NativeCaller {
48
+ private pluginName;
49
+ constructor(pluginName: string);
50
+ callFn(fnName: string, args: object | undefined | null): Promise<any>;
51
+ registerEvent(evName: string, handler: (args: any) => Promise<void>): Promise<any>;
52
+ unregisterEvent(_evName: string, subscription: any): Promise<void>;
53
+ }
54
+ export declare const capacitorCoreNativeCaller: CapacitorNativeCaller;
@@ -1,8 +1,8 @@
1
- import { BaseNativeProxy, DataCaptureContextProxy } from 'scandit-datacapture-frameworks-core';
1
+ import { BaseNativeProxy, DataCaptureContextProxy, NativeCallResult } from 'scandit-datacapture-frameworks-core';
2
2
  export declare class NativeDataCaptureContextProxy extends BaseNativeProxy implements DataCaptureContextProxy {
3
3
  get framework(): string;
4
4
  get frameworkVersion(): string;
5
- contextFromJSON(contextJson: string): Promise<string>;
5
+ contextFromJSON(contextJson: string): Promise<NativeCallResult>;
6
6
  updateContextFromJSON(contextJson: string): Promise<void>;
7
7
  addModeToContext(modeJson: string): Promise<void>;
8
8
  removeModeFromContext(modeJson: string): Promise<void>;
@@ -12,6 +12,6 @@ export declare class NativeDataCaptureContextProxy extends BaseNativeProxy imple
12
12
  unregisterListenerForDataCaptureContext(): Promise<void>;
13
13
  subscribeDidChangeStatus(): void;
14
14
  subscribeDidStartObservingContext(): void;
15
- getOpenSourceSoftwareLicenseInfo(): Promise<string>;
15
+ getOpenSourceSoftwareLicenseInfo(): Promise<NativeCallResult>;
16
16
  private notifyListeners;
17
17
  }
@@ -1,10 +1,10 @@
1
- import { DataCaptureViewProxy, BaseNativeProxy } from 'scandit-datacapture-frameworks-core';
1
+ import { DataCaptureViewProxy, BaseNativeProxy, NativeCallResult } from 'scandit-datacapture-frameworks-core';
2
2
  export declare class NativeDataCaptureViewProxy extends BaseNativeProxy implements DataCaptureViewProxy {
3
3
  setPositionAndSize(top: number, left: number, width: number, height: number, shouldBeUnderWebView: boolean): Promise<void>;
4
4
  show(): Promise<void>;
5
5
  hide(): Promise<void>;
6
- viewPointForFramePoint(pointJson: string): Promise<string>;
7
- viewQuadrilateralForFrameQuadrilateral(quadrilateralJson: string): Promise<string>;
6
+ viewPointForFramePoint(pointJson: string): Promise<NativeCallResult>;
7
+ viewQuadrilateralForFrameQuadrilateral(quadrilateralJson: string): Promise<NativeCallResult>;
8
8
  createView(viewJson: string): Promise<void>;
9
9
  updateView(viewJson: string): Promise<void>;
10
10
  removeView(): Promise<void>;
@@ -1,9 +1,9 @@
1
- import { CameraPosition, ImageFrameSourceProxy, FrameSourceState } from 'scandit-datacapture-frameworks-core';
1
+ import { CameraPosition, ImageFrameSourceProxy, NativeCallResult } from 'scandit-datacapture-frameworks-core';
2
2
  export declare class NativeImageFrameSourceProxy implements ImageFrameSourceProxy {
3
3
  private eventEmitter;
4
4
  private didChangeState;
5
5
  constructor();
6
- getCurrentCameraState(position: CameraPosition): Promise<FrameSourceState>;
6
+ getCurrentCameraState(position: CameraPosition): Promise<NativeCallResult>;
7
7
  switchCameraToDesiredState(desiredStateJson: string): Promise<void>;
8
8
  registerListenerForEvents(): void;
9
9
  unregisterListenerForEvents(): void;
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { HTMLElementState, BaseDataCaptureView, HtmlElementPosition, HtmlElementSize, ignoreFromSerialization, loadCoreDefaults, getCoreDefaults, BaseNativeProxy, DataCaptureContextEvents, ContextStatus, DataCaptureViewEvents, FactoryMaker, FrameSourceListenerEvents, Feedback, Camera, Color, DataCaptureContext, DataCaptureContextSettings, MarginsWithUnit, NumberWithUnit, Point, PointWithUnit, Quadrilateral, RadiusLocationSelection, Rect, RectWithUnit, RectangularLocationSelection, Size, SizeWithAspect, SizeWithUnit, SizeWithUnitAndAspect, Brush, RectangularViewfinder, RectangularViewfinderAnimation, RectangularViewfinderLineStyle, RectangularViewfinderStyle, AimerViewfinder, CameraPosition, CameraSettings, FrameSourceState, TorchState, VideoResolution, FocusRange, FocusGestureStrategy, Anchor, TorchSwitchControl, ZoomSwitchControl, TapToFocus, SwipeToZoom, Direction, Orientation, MeasureUnit, NoneLocationSelection, SizingMode, Sound, NoViewfinder, Vibration, LicenseInfo, ImageFrameSource, OpenSourceSoftwareLicenseInfo } from './core.js';
2
- export { ImageBuffer, LogoStyle, ScanIntention } from './core.js';
1
+ import { HTMLElementState, BaseDataCaptureView, HtmlElementPosition, HtmlElementSize, ignoreFromSerialization, loadCoreDefaults, getCoreDefaults, BaseNativeProxy, DataCaptureContextEvents, DataCaptureViewEvents, FactoryMaker, FrameSourceListenerEvents, Feedback, Camera, Color, DataCaptureContext, DataCaptureContextSettings, MarginsWithUnit, NumberWithUnit, Point, PointWithUnit, Quadrilateral, RadiusLocationSelection, Rect, RectWithUnit, RectangularLocationSelection, Size, SizeWithAspect, SizeWithUnit, SizeWithUnitAndAspect, Brush, RectangularViewfinder, RectangularViewfinderAnimation, RectangularViewfinderLineStyle, RectangularViewfinderStyle, AimerViewfinder, CameraPosition, CameraSettings, FrameSourceState, TorchState, VideoResolution, FocusRange, FocusGestureStrategy, Anchor, TorchSwitchControl, ZoomSwitchControl, TapToFocus, SwipeToZoom, Direction, Orientation, MeasureUnit, NoneLocationSelection, SizingMode, Sound, NoViewfinder, Vibration, LicenseInfo, ImageFrameSource, OpenSourceSoftwareLicenseInfo } from './core.js';
2
+ export { ContextStatus, ImageBuffer, LogoStyle, ScanIntention } from './core.js';
3
3
 
4
4
  /******************************************************************************
5
5
  Copyright (c) Microsoft Corporation.
@@ -255,7 +255,7 @@ __decorate([
255
255
 
256
256
  class DataCaptureVersion {
257
257
  static get pluginVersion() {
258
- return '7.0.2';
258
+ return '7.1.0-beta.2';
259
259
  }
260
260
  }
261
261
 
@@ -371,6 +371,24 @@ const getDefaults = () => __awaiter(void 0, void 0, void 0, function* () {
371
371
  }
372
372
  return Capacitor$1.defaults;
373
373
  });
374
+ class CapacitorNativeCaller {
375
+ constructor(pluginName) {
376
+ this.pluginName = pluginName;
377
+ }
378
+ callFn(fnName, args) {
379
+ return window.Capacitor.Plugins[this.pluginName][fnName](args);
380
+ }
381
+ registerEvent(evName, handler) {
382
+ return window.Capacitor.Plugins[this.pluginName]
383
+ .addListener(evName, handler);
384
+ }
385
+ unregisterEvent(_evName, subscription) {
386
+ return __awaiter(this, void 0, void 0, function* () {
387
+ yield subscription.remove();
388
+ });
389
+ }
390
+ }
391
+ new CapacitorNativeCaller(Capacitor$1.pluginName);
374
392
 
375
393
  var VolumeButtonObserverEvent;
376
394
  (function (VolumeButtonObserverEvent) {
@@ -1102,11 +1120,8 @@ class NativeDataCaptureContextProxy extends BaseNativeProxy {
1102
1120
  return (() => Capacitor$1.defaults.capacitorVersion)();
1103
1121
  }
1104
1122
  contextFromJSON(contextJson) {
1105
- return __awaiter(this, void 0, void 0, function* () {
1106
- const result = yield window.Capacitor.Plugins[Capacitor$1.pluginName][CapacitorFunction.ContextFromJSON]({
1107
- context: contextJson,
1108
- });
1109
- return JSON.stringify(result);
1123
+ return window.Capacitor.Plugins[Capacitor$1.pluginName][CapacitorFunction.ContextFromJSON]({
1124
+ context: contextJson,
1110
1125
  });
1111
1126
  }
1112
1127
  updateContextFromJSON(contextJson) {
@@ -1145,10 +1160,7 @@ class NativeDataCaptureContextProxy extends BaseNativeProxy {
1145
1160
  .addListener(DataCaptureContextEvents.didStartObservingContext, this.notifyListeners.bind(this));
1146
1161
  }
1147
1162
  getOpenSourceSoftwareLicenseInfo() {
1148
- return __awaiter(this, void 0, void 0, function* () {
1149
- const result = yield window.Capacitor.Plugins[Capacitor$1.pluginName][CapacitorFunction.GetOpenSourceSoftwareLicenseInfo]();
1150
- return result.data;
1151
- });
1163
+ return window.Capacitor.Plugins[Capacitor$1.pluginName][CapacitorFunction.GetOpenSourceSoftwareLicenseInfo]();
1152
1164
  }
1153
1165
  notifyListeners(event) {
1154
1166
  if (!event) {
@@ -1157,14 +1169,9 @@ class NativeDataCaptureContextProxy extends BaseNativeProxy {
1157
1169
  // listener subscriptions.
1158
1170
  return;
1159
1171
  }
1160
- // event = {...event, ...event.argument, argument: undefined};
1161
1172
  switch (event.name) {
1162
1173
  case DataCaptureContextEvents.didChangeStatus:
1163
- // TODO: This needs to be fixed, not working on develop
1164
- //const contextStatus = (ContextStatus as any as PrivateContextStatus).fromJSON(event.context);
1165
- // this.eventEmitter.emit(DataCaptureContextEvents.didChangeStatus, contextStatus);
1166
- // https://scandit.atlassian.net/browse/SDC-21050
1167
- this.eventEmitter.emit(DataCaptureContextEvents.didChangeStatus, new ContextStatus());
1174
+ this.eventEmitter.emit(DataCaptureContextEvents.didChangeStatus, event.data);
1168
1175
  break;
1169
1176
  case DataCaptureContextEvents.didStartObservingContext:
1170
1177
  this.eventEmitter.emit(DataCaptureContextEvents.didStartObservingContext);
@@ -1186,19 +1193,13 @@ class NativeDataCaptureViewProxy extends BaseNativeProxy {
1186
1193
  return window.Capacitor.Plugins[Capacitor$1.pluginName][CapacitorFunction.HideView]();
1187
1194
  }
1188
1195
  viewPointForFramePoint(pointJson) {
1189
- return __awaiter(this, void 0, void 0, function* () {
1190
- const viewPoint = yield window.Capacitor.Plugins[Capacitor$1.pluginName][CapacitorFunction.ViewPointForFramePoint]({
1191
- point: pointJson,
1192
- });
1193
- return viewPoint.data;
1196
+ return window.Capacitor.Plugins[Capacitor$1.pluginName][CapacitorFunction.ViewPointForFramePoint]({
1197
+ point: pointJson,
1194
1198
  });
1195
1199
  }
1196
1200
  viewQuadrilateralForFrameQuadrilateral(quadrilateralJson) {
1197
- return __awaiter(this, void 0, void 0, function* () {
1198
- const viewQuadrilateral = yield window.Capacitor.Plugins[Capacitor$1.pluginName][CapacitorFunction.ViewQuadrilateralForFrameQuadrilateral]({
1199
- point: quadrilateralJson,
1200
- });
1201
- return viewQuadrilateral.data;
1201
+ return window.Capacitor.Plugins[Capacitor$1.pluginName][CapacitorFunction.ViewQuadrilateralForFrameQuadrilateral]({
1202
+ point: quadrilateralJson,
1202
1203
  });
1203
1204
  }
1204
1205
  createView(viewJson) {
@@ -1231,10 +1232,9 @@ class NativeDataCaptureViewProxy extends BaseNativeProxy {
1231
1232
  // listener subscriptions.
1232
1233
  return;
1233
1234
  }
1234
- event = Object.assign(Object.assign(Object.assign({}, event), event.argument), { argument: undefined });
1235
1235
  switch (event.name) {
1236
1236
  case DataCaptureViewEvents.didChangeSize:
1237
- this.eventEmitter.emit(DataCaptureViewEvents.didChangeSize, JSON.stringify(event));
1237
+ this.eventEmitter.emit(DataCaptureViewEvents.didChangeSize, event.data);
1238
1238
  break;
1239
1239
  }
1240
1240
  }
@@ -1245,30 +1245,18 @@ class NativeCameraProxy {
1245
1245
  this.eventEmitter = FactoryMaker.getInstance('EventEmitter');
1246
1246
  }
1247
1247
  getFrame(frameId) {
1248
- return __awaiter(this, void 0, void 0, function* () {
1249
- const frameDataJSONString = yield window.Capacitor.Plugins[Capacitor$1.pluginName][CapacitorFunction.GetFrame]({
1250
- frameId: frameId,
1251
- });
1252
- if (frameDataJSONString == null) {
1253
- return null;
1254
- }
1255
- return frameDataJSONString.data ? frameDataJSONString.data : frameDataJSONString;
1248
+ return window.Capacitor.Plugins[Capacitor$1.pluginName][CapacitorFunction.GetFrame]({
1249
+ frameId: frameId,
1256
1250
  });
1257
1251
  }
1258
1252
  getCurrentCameraState(_position) {
1259
- return __awaiter(this, void 0, void 0, function* () {
1260
- const cameraState = yield window.Capacitor.Plugins[Capacitor$1.pluginName][CapacitorFunction.GetCurrentCameraState]({
1261
- position: _position,
1262
- });
1263
- return cameraState.data;
1253
+ return window.Capacitor.Plugins[Capacitor$1.pluginName][CapacitorFunction.GetCurrentCameraState]({
1254
+ position: _position,
1264
1255
  });
1265
1256
  }
1266
1257
  isTorchAvailable(position) {
1267
- return __awaiter(this, void 0, void 0, function* () {
1268
- const torchAvailability = yield window.Capacitor.Plugins[Capacitor$1.pluginName][CapacitorFunction.GetIsTorchAvailable]({
1269
- position: position,
1270
- });
1271
- return torchAvailability.data;
1258
+ return window.Capacitor.Plugins[Capacitor$1.pluginName][CapacitorFunction.GetIsTorchAvailable]({
1259
+ position: position,
1272
1260
  });
1273
1261
  }
1274
1262
  switchCameraToDesiredState(desiredStateJson) {
@@ -1294,7 +1282,7 @@ class NativeCameraProxy {
1294
1282
  }
1295
1283
  switch (event.name) {
1296
1284
  case FrameSourceListenerEvents.didChangeState:
1297
- this.eventEmitter.emit(FrameSourceListenerEvents.didChangeState, event.state);
1285
+ this.eventEmitter.emit(FrameSourceListenerEvents.didChangeState, event.data);
1298
1286
  break;
1299
1287
  }
1300
1288
  }
@@ -1305,11 +1293,8 @@ class NativeImageFrameSourceProxy {
1305
1293
  this.eventEmitter = FactoryMaker.getInstance('EventEmitter');
1306
1294
  }
1307
1295
  getCurrentCameraState(position) {
1308
- return __awaiter(this, void 0, void 0, function* () {
1309
- const cameraState = yield window.Capacitor.Plugins[Capacitor$1.pluginName][CapacitorFunction.GetCurrentCameraState]({
1310
- position: position,
1311
- });
1312
- return cameraState.data;
1296
+ return window.Capacitor.Plugins[Capacitor$1.pluginName][CapacitorFunction.GetCurrentCameraState]({
1297
+ position: position,
1313
1298
  });
1314
1299
  }
1315
1300
  switchCameraToDesiredState(desiredStateJson) {
@@ -1335,7 +1320,7 @@ class NativeImageFrameSourceProxy {
1335
1320
  }
1336
1321
  switch (event.name) {
1337
1322
  case FrameSourceListenerEvents.didChangeState:
1338
- this.eventEmitter.emit(FrameSourceListenerEvents.didChangeState, event.state);
1323
+ this.eventEmitter.emit(FrameSourceListenerEvents.didChangeState, event.data);
1339
1324
  break;
1340
1325
  }
1341
1326
  }
@@ -1427,5 +1412,5 @@ registerPlugin(corePluginName, {
1427
1412
  // tslint:disable-next-line:variable-name
1428
1413
  const ScanditCaptureCorePlugin = new ScanditCaptureCorePluginImplementation();
1429
1414
 
1430
- export { AimerViewfinder, Anchor, Brush, Camera, CameraPosition, CameraSettings, Capacitor$1 as CapacitorCore, Color, ContextStatus, DataCaptureContext, DataCaptureContextSettings, DataCaptureVersion, DataCaptureView, Direction, Feedback, FocusGestureStrategy, FocusRange, FrameSourceState, ImageFrameSource, MarginsWithUnit, MeasureUnit, NoViewfinder, NoneLocationSelection, NumberWithUnit, OpenSourceSoftwareLicenseInfo, Orientation, Point, PointWithUnit, Quadrilateral, RadiusLocationSelection, Rect, RectWithUnit, RectangularLocationSelection, RectangularViewfinder, RectangularViewfinderAnimation, RectangularViewfinderLineStyle, RectangularViewfinderStyle, ScanditCaptureCorePlugin, ScanditCaptureCorePluginImplementation, Size, SizeWithAspect, SizeWithUnit, SizeWithUnitAndAspect, SizingMode, Sound, SwipeToZoom, TapToFocus, TorchState, TorchSwitchControl, Vibration, VideoResolution, VolumeButtonObserver, ZoomSwitchControl, capacitorExec, doReturnWithFinish };
1415
+ export { AimerViewfinder, Anchor, Brush, Camera, CameraPosition, CameraSettings, Capacitor$1 as CapacitorCore, CapacitorNativeCaller, Color, DataCaptureContext, DataCaptureContextSettings, DataCaptureVersion, DataCaptureView, Direction, Feedback, FocusGestureStrategy, FocusRange, FrameSourceState, ImageFrameSource, MarginsWithUnit, MeasureUnit, NoViewfinder, NoneLocationSelection, NumberWithUnit, OpenSourceSoftwareLicenseInfo, Orientation, Point, PointWithUnit, Quadrilateral, RadiusLocationSelection, Rect, RectWithUnit, RectangularLocationSelection, RectangularViewfinder, RectangularViewfinderAnimation, RectangularViewfinderLineStyle, RectangularViewfinderStyle, ScanditCaptureCorePlugin, ScanditCaptureCorePluginImplementation, Size, SizeWithAspect, SizeWithUnit, SizeWithUnitAndAspect, SizingMode, Sound, SwipeToZoom, TapToFocus, TorchState, TorchSwitchControl, Vibration, VideoResolution, VolumeButtonObserver, ZoomSwitchControl, capacitorExec, doReturnWithFinish };
1431
1416
  //# sourceMappingURL=index.js.map