scandit-capacitor-datacapture-core 8.6.2 → 8.7.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.
- package/Package.swift +1 -11
- package/ScanditCapacitorDatacaptureCore.podspec +1 -2
- package/android/build.gradle +1 -1
- package/android/src/main/java/com/scandit/capacitor/datacapture/core/ScanditCaptureCoreNative.java +5 -3
- package/dist/core.js +6137 -3035
- package/dist/core.js.map +1 -1
- package/dist/dts/core.d.ts +6993 -887
- package/dist/dts/index.d.ts +246 -3
- package/dist/index.js +300 -255
- package/dist/index.js.map +1 -1
- package/ios/Sources/ScanditCapacitorCore/ScanditCaptureCore.swift +6 -5
- package/package.json +8 -5
- package/ios/Sources/ScanditCapacitorCoreObjC/SDCVolumeButtonObserver.h +0 -23
- package/ios/Sources/ScanditCapacitorCoreObjC/SDCVolumeButtonObserver.m +0 -35
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { HTMLElementState, BaseDataCaptureView, HtmlElementPosition, HtmlElementSize, ignoreFromSerialization, loadCoreDefaults,
|
|
1
|
+
import { HTMLElementState, BaseDataCaptureView, HtmlElementPosition, HtmlElementSize, ignoreFromSerialization, getCoreDefaults, loadCoreDefaults, buildStaticCoreDefaultsJson, FactoryMaker, AimerViewfinder, Anchor, Brush, Camera, CameraPosition, CameraSettings, CameraSwitchControl, ClusteringMode, Color, ColorFillOverlay, ContextStatus, DataCaptureContext, DataCaptureContextSettings, Direction, Expiration, Feedback, FocusGestureStrategy, FocusRange, FontFamily, FrameDataSettings, FrameDataSettingsBuilder, FrameSourceState, ImageBuffer, ImageFrameSource, LaserlineViewfinder, LicenseInfo, LogCategory, LogLevel, LogoStyle, MacroMode, MarginsWithUnit, MeasureUnit, NoViewfinder, NoneLocationSelection, NumberWithUnit, OpenSourceSoftwareLicenseInfo, Orientation, PinchToZoom, Point, PointWithUnit, Quadrilateral, RadiusLocationSelection, Rect, RectWithUnit, RectangularLocationSelection, RectangularViewfinder, RectangularViewfinderAnimation, RectangularViewfinderLineStyle, RectangularViewfinderStyle, ScanIntention, ScanditIcon, ScanditIconBuilder, ScanditIconShape, ScanditIconType, ScanditLogger, SelectionMode, SequenceFrameSource, Size, SizeWithAspect, SizeWithUnit, SizeWithUnitAndAspect, SizingMode, Sound, SwipeToZoom, TapToFocus, TextAlignment, TorchState, TorchSwitchControl, Vibration, VideoResolution, ZoomSwitchControl, ZoomSwitchOrientation, registerCoreProxies } from './core.js';
|
|
2
2
|
|
|
3
3
|
/******************************************************************************
|
|
4
4
|
Copyright (c) Microsoft Corporation.
|
|
@@ -297,257 +297,19 @@ __decorate([
|
|
|
297
297
|
|
|
298
298
|
class DataCaptureVersion {
|
|
299
299
|
static get pluginVersion() {
|
|
300
|
-
return '8.
|
|
300
|
+
return '8.7.0';
|
|
301
301
|
}
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
return null;
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
constructor(code, message) {
|
|
314
|
-
this.code = code;
|
|
315
|
-
this.message = message;
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
const capacitorExec = (successCallback, errorCallback, pluginName, functionName, args) => {
|
|
319
|
-
if (window.Scandit && window.Scandit.DEBUG) {
|
|
320
|
-
// tslint:disable-next-line:no-console
|
|
321
|
-
console.log(`Called native function: ${functionName}`, args, { success: successCallback, error: errorCallback });
|
|
322
|
-
}
|
|
323
|
-
const extendedSuccessCallback = (message) => {
|
|
324
|
-
const shouldCallback = message && message.shouldNotifyWhenFinished;
|
|
325
|
-
const finishCallbackID = shouldCallback ? message.finishCallbackID : null;
|
|
326
|
-
const started = Date.now();
|
|
327
|
-
let callbackResult;
|
|
328
|
-
if (successCallback) {
|
|
329
|
-
callbackResult = successCallback(message);
|
|
330
|
-
}
|
|
331
|
-
if (shouldCallback) {
|
|
332
|
-
const maxCallbackDuration = 50;
|
|
333
|
-
const callbackDuration = Date.now() - started;
|
|
334
|
-
if (callbackDuration > maxCallbackDuration) {
|
|
335
|
-
// tslint:disable-next-line:no-console
|
|
336
|
-
console.log(`[SCANDIT WARNING] Took ${callbackDuration}ms to execute callback that's blocking native execution. You should keep this duration short, for more information, take a look at the documentation.`);
|
|
337
|
-
}
|
|
338
|
-
window.Capacitor.Plugins[pluginName].finishCallback([
|
|
339
|
-
{
|
|
340
|
-
finishCallbackID,
|
|
341
|
-
result: callbackResult,
|
|
342
|
-
},
|
|
343
|
-
]);
|
|
344
|
-
}
|
|
345
|
-
};
|
|
346
|
-
const extendedErrorCallback = (error) => {
|
|
347
|
-
if (errorCallback) {
|
|
348
|
-
const capacitorError = CapacitorError.fromJSON(error);
|
|
349
|
-
if (capacitorError !== null) {
|
|
350
|
-
error = capacitorError;
|
|
351
|
-
}
|
|
352
|
-
errorCallback(error);
|
|
353
|
-
}
|
|
354
|
-
};
|
|
355
|
-
window.Capacitor.Plugins[pluginName][functionName](args).then(extendedSuccessCallback, extendedErrorCallback);
|
|
356
|
-
};
|
|
357
|
-
const doReturnWithFinish = (finishCallbackID, result) => {
|
|
358
|
-
if (window.Capacitor.Plugins.ScanditBarcodeNative) {
|
|
359
|
-
window.Capacitor.Plugins.ScanditBarcodeNative.finishCallback({ result: Object.assign({ finishCallbackID }, result) });
|
|
360
|
-
}
|
|
361
|
-
else if (window.Capacitor.Plugins.ScanditIdNative) {
|
|
362
|
-
window.Capacitor.Plugins.ScanditIdNative.finishCallback({ result: Object.assign({ finishCallbackID }, result) });
|
|
363
|
-
}
|
|
364
|
-
return result;
|
|
365
|
-
};
|
|
366
|
-
|
|
367
|
-
const pluginName = 'ScanditCaptureCoreNative';
|
|
368
|
-
// tslint:disable-next-line:variable-name
|
|
369
|
-
const Capacitor$1 = {
|
|
370
|
-
pluginName,
|
|
371
|
-
defaults: {},
|
|
372
|
-
exec: (success, error, functionName, args) => capacitorExec(success, error, pluginName, functionName, args),
|
|
373
|
-
};
|
|
374
|
-
const getDefaults = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
375
|
-
try {
|
|
376
|
-
const defaultsJson = yield window.Capacitor.Plugins[pluginName]['getDefaults']();
|
|
377
|
-
loadCoreDefaults(defaultsJson);
|
|
378
|
-
Capacitor$1.defaults = getCoreDefaults();
|
|
379
|
-
}
|
|
380
|
-
catch (error) {
|
|
381
|
-
// tslint:disable-next-line:no-console
|
|
382
|
-
console.warn(error);
|
|
383
|
-
}
|
|
384
|
-
return Capacitor$1.defaults;
|
|
385
|
-
});
|
|
386
|
-
class CapacitorNativeCaller {
|
|
387
|
-
constructor(pluginName) {
|
|
388
|
-
this.pluginName = pluginName;
|
|
389
|
-
}
|
|
390
|
-
get framework() {
|
|
391
|
-
return 'capacitor';
|
|
392
|
-
}
|
|
393
|
-
get frameworkVersion() {
|
|
394
|
-
return (() => Capacitor$1.defaults.capacitorVersion)();
|
|
395
|
-
}
|
|
396
|
-
callFn(fnName, args, _meta) {
|
|
397
|
-
// meta parameter ignored - Capacitor handles events automatically through plugin system
|
|
398
|
-
const plugin = window.Capacitor.Plugins[this.pluginName];
|
|
399
|
-
if (!plugin || typeof plugin[fnName] !== 'function') {
|
|
400
|
-
// tslint:disable-next-line:no-console
|
|
401
|
-
console.error(`Function '${fnName}' not found in plugin '${this.pluginName}'`);
|
|
402
|
-
return Promise.reject(new Error(`Function '${fnName}' not found in plugin '${this.pluginName}'`));
|
|
403
|
-
}
|
|
404
|
-
return plugin[fnName](args);
|
|
405
|
-
}
|
|
406
|
-
registerEvent(evName, handler) {
|
|
407
|
-
return window.Capacitor.Plugins[this.pluginName].addListener(evName, handler);
|
|
408
|
-
}
|
|
409
|
-
unregisterEvent(_evName, subscription) {
|
|
410
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
411
|
-
if (subscription) {
|
|
412
|
-
yield subscription.remove();
|
|
413
|
-
}
|
|
414
|
-
});
|
|
415
|
-
}
|
|
416
|
-
eventHook(ev) {
|
|
417
|
-
return ev;
|
|
418
|
-
}
|
|
419
|
-
}
|
|
420
|
-
|
|
421
|
-
var VolumeButtonObserverEvent;
|
|
422
|
-
(function (VolumeButtonObserverEvent) {
|
|
423
|
-
VolumeButtonObserverEvent["DidChangeVolume"] = "didChangeVolume";
|
|
424
|
-
})(VolumeButtonObserverEvent || (VolumeButtonObserverEvent = {}));
|
|
425
|
-
class VolumeButtonObserverProxy {
|
|
426
|
-
static forVolumeButtonObserver(volumeButtonObserver) {
|
|
427
|
-
const proxy = new VolumeButtonObserverProxy();
|
|
428
|
-
proxy.volumeButtonObserver = volumeButtonObserver;
|
|
429
|
-
proxy.subscribe();
|
|
430
|
-
return proxy;
|
|
431
|
-
}
|
|
432
|
-
dispose() {
|
|
433
|
-
this.unsubscribe();
|
|
434
|
-
}
|
|
435
|
-
subscribe() {
|
|
436
|
-
this.subscriber = window.Capacitor.Plugins[Capacitor$1.pluginName].addListener(VolumeButtonObserverEvent.DidChangeVolume, this.notifyListeners.bind(this));
|
|
437
|
-
}
|
|
438
|
-
unsubscribe() {
|
|
439
|
-
this.subscriber.remove();
|
|
440
|
-
}
|
|
441
|
-
notifyListeners(event) {
|
|
442
|
-
if (!event) {
|
|
443
|
-
// The event could be undefined/null in case the plugin result did not pass a "message",
|
|
444
|
-
// which could happen e.g. in case of "ok" results, which could signal e.g. successful
|
|
445
|
-
// listener subscriptions.
|
|
446
|
-
return doReturnWithFinish('', null);
|
|
447
|
-
}
|
|
448
|
-
if (this.volumeButtonObserver.didChangeVolume && event.name === VolumeButtonObserverEvent.DidChangeVolume) {
|
|
449
|
-
this.volumeButtonObserver.didChangeVolume();
|
|
450
|
-
return doReturnWithFinish(event.name, null);
|
|
451
|
-
}
|
|
452
|
-
}
|
|
453
|
-
}
|
|
454
|
-
|
|
455
|
-
class VolumeButtonObserver {
|
|
456
|
-
constructor(didChangeVolume) {
|
|
457
|
-
this.didChangeVolume = didChangeVolume;
|
|
458
|
-
this.initialize();
|
|
459
|
-
}
|
|
460
|
-
dispose() {
|
|
461
|
-
if (this.proxy) {
|
|
462
|
-
this.proxy.dispose();
|
|
463
|
-
this.proxy = null;
|
|
464
|
-
this.didChangeVolume = null;
|
|
465
|
-
}
|
|
466
|
-
}
|
|
467
|
-
initialize() {
|
|
468
|
-
if (!this.proxy) {
|
|
469
|
-
this.proxy = VolumeButtonObserverProxy.forVolumeButtonObserver(this);
|
|
470
|
-
}
|
|
302
|
+
/**
|
|
303
|
+
* Version of the native SDK the plugin is running against. Read from the Core defaults
|
|
304
|
+
* singleton, whose `Version` key is part of the dynamic residual — so this is only populated
|
|
305
|
+
* once `applyDynamicDefaults()` has completed, and empty before native is reachable.
|
|
306
|
+
*/
|
|
307
|
+
static get sdkVersion() {
|
|
308
|
+
var _a;
|
|
309
|
+
return (_a = getCoreDefaults().Version) !== null && _a !== void 0 ? _a : '';
|
|
471
310
|
}
|
|
472
311
|
}
|
|
473
312
|
|
|
474
|
-
// Core Geometry & Units
|
|
475
|
-
|
|
476
|
-
var CoreExports = /*#__PURE__*/Object.freeze({
|
|
477
|
-
__proto__: null,
|
|
478
|
-
AimerViewfinder: AimerViewfinder,
|
|
479
|
-
get Anchor () { return Anchor; },
|
|
480
|
-
Brush: Brush,
|
|
481
|
-
Camera: Camera,
|
|
482
|
-
get CameraPosition () { return CameraPosition; },
|
|
483
|
-
CameraSettings: CameraSettings,
|
|
484
|
-
CameraSwitchControl: CameraSwitchControl,
|
|
485
|
-
get ClusteringMode () { return ClusteringMode; },
|
|
486
|
-
Color: Color,
|
|
487
|
-
ContextStatus: ContextStatus,
|
|
488
|
-
DataCaptureContext: DataCaptureContext,
|
|
489
|
-
DataCaptureContextSettings: DataCaptureContextSettings,
|
|
490
|
-
DataCaptureVersion: DataCaptureVersion,
|
|
491
|
-
DataCaptureView: DataCaptureView,
|
|
492
|
-
get Direction () { return Direction; },
|
|
493
|
-
get Expiration () { return Expiration; },
|
|
494
|
-
Feedback: Feedback,
|
|
495
|
-
get FocusGestureStrategy () { return FocusGestureStrategy; },
|
|
496
|
-
get FocusRange () { return FocusRange; },
|
|
497
|
-
get FontFamily () { return FontFamily; },
|
|
498
|
-
FrameDataSettings: FrameDataSettings,
|
|
499
|
-
FrameDataSettingsBuilder: FrameDataSettingsBuilder,
|
|
500
|
-
get FrameSourceState () { return FrameSourceState; },
|
|
501
|
-
ImageBuffer: ImageBuffer,
|
|
502
|
-
ImageFrameSource: ImageFrameSource,
|
|
503
|
-
LaserlineViewfinder: LaserlineViewfinder,
|
|
504
|
-
LicenseInfo: LicenseInfo,
|
|
505
|
-
get LogoStyle () { return LogoStyle; },
|
|
506
|
-
get MacroMode () { return MacroMode; },
|
|
507
|
-
MarginsWithUnit: MarginsWithUnit,
|
|
508
|
-
get MeasureUnit () { return MeasureUnit; },
|
|
509
|
-
NoViewfinder: NoViewfinder,
|
|
510
|
-
NoneLocationSelection: NoneLocationSelection,
|
|
511
|
-
NumberWithUnit: NumberWithUnit,
|
|
512
|
-
OpenSourceSoftwareLicenseInfo: OpenSourceSoftwareLicenseInfo,
|
|
513
|
-
get Orientation () { return Orientation; },
|
|
514
|
-
PinchToZoom: PinchToZoom,
|
|
515
|
-
Point: Point,
|
|
516
|
-
PointWithUnit: PointWithUnit,
|
|
517
|
-
Quadrilateral: Quadrilateral,
|
|
518
|
-
RadiusLocationSelection: RadiusLocationSelection,
|
|
519
|
-
Rect: Rect,
|
|
520
|
-
RectWithUnit: RectWithUnit,
|
|
521
|
-
RectangularLocationSelection: RectangularLocationSelection,
|
|
522
|
-
RectangularViewfinder: RectangularViewfinder,
|
|
523
|
-
RectangularViewfinderAnimation: RectangularViewfinderAnimation,
|
|
524
|
-
get RectangularViewfinderLineStyle () { return RectangularViewfinderLineStyle; },
|
|
525
|
-
get RectangularViewfinderStyle () { return RectangularViewfinderStyle; },
|
|
526
|
-
get ScanIntention () { return ScanIntention; },
|
|
527
|
-
ScanditIcon: ScanditIcon,
|
|
528
|
-
ScanditIconBuilder: ScanditIconBuilder,
|
|
529
|
-
get ScanditIconShape () { return ScanditIconShape; },
|
|
530
|
-
get ScanditIconType () { return ScanditIconType; },
|
|
531
|
-
get SelectionMode () { return SelectionMode; },
|
|
532
|
-
SequenceFrameSource: SequenceFrameSource,
|
|
533
|
-
Size: Size,
|
|
534
|
-
SizeWithAspect: SizeWithAspect,
|
|
535
|
-
SizeWithUnit: SizeWithUnit,
|
|
536
|
-
SizeWithUnitAndAspect: SizeWithUnitAndAspect,
|
|
537
|
-
get SizingMode () { return SizingMode; },
|
|
538
|
-
Sound: Sound,
|
|
539
|
-
SwipeToZoom: SwipeToZoom,
|
|
540
|
-
TapToFocus: TapToFocus,
|
|
541
|
-
get TextAlignment () { return TextAlignment; },
|
|
542
|
-
get TorchState () { return TorchState; },
|
|
543
|
-
TorchSwitchControl: TorchSwitchControl,
|
|
544
|
-
Vibration: Vibration,
|
|
545
|
-
get VideoResolution () { return VideoResolution; },
|
|
546
|
-
VolumeButtonObserver: VolumeButtonObserver,
|
|
547
|
-
ZoomSwitchControl: ZoomSwitchControl,
|
|
548
|
-
get ZoomSwitchOrientation () { return ZoomSwitchOrientation; }
|
|
549
|
-
});
|
|
550
|
-
|
|
551
313
|
/*! Capacitor: https://capacitorjs.com/ - MIT License */
|
|
552
314
|
var ExceptionCode;
|
|
553
315
|
(function (ExceptionCode) {
|
|
@@ -745,7 +507,7 @@ const createCapacitor = (win) => {
|
|
|
745
507
|
};
|
|
746
508
|
const initCapacitorGlobal = (win) => (win.Capacitor = createCapacitor(win));
|
|
747
509
|
|
|
748
|
-
const Capacitor = /*#__PURE__*/ initCapacitorGlobal(typeof globalThis !== 'undefined'
|
|
510
|
+
const Capacitor$1 = /*#__PURE__*/ initCapacitorGlobal(typeof globalThis !== 'undefined'
|
|
749
511
|
? globalThis
|
|
750
512
|
: typeof self !== 'undefined'
|
|
751
513
|
? self
|
|
@@ -754,7 +516,7 @@ const Capacitor = /*#__PURE__*/ initCapacitorGlobal(typeof globalThis !== 'undef
|
|
|
754
516
|
: typeof global !== 'undefined'
|
|
755
517
|
? global
|
|
756
518
|
: {});
|
|
757
|
-
const registerPlugin = Capacitor.registerPlugin;
|
|
519
|
+
const registerPlugin = Capacitor$1.registerPlugin;
|
|
758
520
|
|
|
759
521
|
/**
|
|
760
522
|
* Base class web plugins should extend.
|
|
@@ -823,10 +585,10 @@ class WebPlugin {
|
|
|
823
585
|
};
|
|
824
586
|
}
|
|
825
587
|
unimplemented(msg = 'not implemented') {
|
|
826
|
-
return new Capacitor.Exception(msg, ExceptionCode.Unimplemented);
|
|
588
|
+
return new Capacitor$1.Exception(msg, ExceptionCode.Unimplemented);
|
|
827
589
|
}
|
|
828
590
|
unavailable(msg = 'not available') {
|
|
829
|
-
return new Capacitor.Exception(msg, ExceptionCode.Unavailable);
|
|
591
|
+
return new Capacitor$1.Exception(msg, ExceptionCode.Unavailable);
|
|
830
592
|
}
|
|
831
593
|
async removeListener(eventName, listenerFunc) {
|
|
832
594
|
const listeners = this.listeners[eventName];
|
|
@@ -1189,9 +951,290 @@ registerPlugin('SystemBars', {
|
|
|
1189
951
|
web: () => new SystemBarsPluginWeb(),
|
|
1190
952
|
});
|
|
1191
953
|
|
|
954
|
+
class CapacitorError {
|
|
955
|
+
static fromJSON(json) {
|
|
956
|
+
if (json && json.code && json.message) {
|
|
957
|
+
return new CapacitorError(json.code, json.message);
|
|
958
|
+
}
|
|
959
|
+
else {
|
|
960
|
+
return null;
|
|
961
|
+
}
|
|
962
|
+
}
|
|
963
|
+
constructor(code, message) {
|
|
964
|
+
this.code = code;
|
|
965
|
+
this.message = message;
|
|
966
|
+
}
|
|
967
|
+
}
|
|
968
|
+
const capacitorExec = (successCallback, errorCallback, pluginName, functionName, args) => {
|
|
969
|
+
if (window.Scandit && window.Scandit.DEBUG) {
|
|
970
|
+
// tslint:disable-next-line:no-console
|
|
971
|
+
console.log(`Called native function: ${functionName}`, args, { success: successCallback, error: errorCallback });
|
|
972
|
+
}
|
|
973
|
+
const extendedSuccessCallback = (message) => {
|
|
974
|
+
const shouldCallback = message && message.shouldNotifyWhenFinished;
|
|
975
|
+
const finishCallbackID = shouldCallback ? message.finishCallbackID : null;
|
|
976
|
+
const started = Date.now();
|
|
977
|
+
let callbackResult;
|
|
978
|
+
if (successCallback) {
|
|
979
|
+
callbackResult = successCallback(message);
|
|
980
|
+
}
|
|
981
|
+
if (shouldCallback) {
|
|
982
|
+
const maxCallbackDuration = 50;
|
|
983
|
+
const callbackDuration = Date.now() - started;
|
|
984
|
+
if (callbackDuration > maxCallbackDuration) {
|
|
985
|
+
// tslint:disable-next-line:no-console
|
|
986
|
+
console.log(`[SCANDIT WARNING] Took ${callbackDuration}ms to execute callback that's blocking native execution. You should keep this duration short, for more information, take a look at the documentation.`);
|
|
987
|
+
}
|
|
988
|
+
window.Capacitor.Plugins[pluginName].finishCallback([
|
|
989
|
+
{
|
|
990
|
+
finishCallbackID,
|
|
991
|
+
result: callbackResult,
|
|
992
|
+
},
|
|
993
|
+
]);
|
|
994
|
+
}
|
|
995
|
+
};
|
|
996
|
+
const extendedErrorCallback = (error) => {
|
|
997
|
+
if (errorCallback) {
|
|
998
|
+
const capacitorError = CapacitorError.fromJSON(error);
|
|
999
|
+
if (capacitorError !== null) {
|
|
1000
|
+
error = capacitorError;
|
|
1001
|
+
}
|
|
1002
|
+
errorCallback(error);
|
|
1003
|
+
}
|
|
1004
|
+
};
|
|
1005
|
+
window.Capacitor.Plugins[pluginName][functionName](args).then(extendedSuccessCallback, extendedErrorCallback);
|
|
1006
|
+
};
|
|
1007
|
+
const doReturnWithFinish = (finishCallbackID, result) => {
|
|
1008
|
+
if (window.Capacitor.Plugins.ScanditBarcodeNative) {
|
|
1009
|
+
window.Capacitor.Plugins.ScanditBarcodeNative.finishCallback({ result: Object.assign({ finishCallbackID }, result) });
|
|
1010
|
+
}
|
|
1011
|
+
else if (window.Capacitor.Plugins.ScanditIdNative) {
|
|
1012
|
+
window.Capacitor.Plugins.ScanditIdNative.finishCallback({ result: Object.assign({ finishCallbackID }, result) });
|
|
1013
|
+
}
|
|
1014
|
+
return result;
|
|
1015
|
+
};
|
|
1016
|
+
|
|
1017
|
+
const pluginName = 'ScanditCaptureCoreNative';
|
|
1018
|
+
// tslint:disable-next-line:variable-name
|
|
1019
|
+
const Capacitor = {
|
|
1020
|
+
pluginName,
|
|
1021
|
+
defaults: {},
|
|
1022
|
+
exec: (success, error, functionName, args) => capacitorExec(success, error, pluginName, functionName, args),
|
|
1023
|
+
};
|
|
1024
|
+
// Loaded synchronously at module-import time: get<X>Defaults() returns real static values
|
|
1025
|
+
// immediately, without waiting on a native round-trip and without the lazy ensureCoreDefaults()
|
|
1026
|
+
// fallback ever having to build a real one for Capacitor.
|
|
1027
|
+
const staticPlatform = Capacitor$1.getPlatform() === 'ios' ? 'ios' : 'android';
|
|
1028
|
+
loadCoreDefaults(buildStaticCoreDefaultsJson(staticPlatform));
|
|
1029
|
+
Capacitor.defaults = getCoreDefaults();
|
|
1030
|
+
/**
|
|
1031
|
+
* Fetches the narrow set of Core defaults that cannot be resolved statically (device id, SDK
|
|
1032
|
+
* version, probed camera positions, localized accessibility label) and merges them into the
|
|
1033
|
+
* already-loaded defaults singleton. Errors propagate — no swallowing.
|
|
1034
|
+
*/
|
|
1035
|
+
const applyDynamicDefaults = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
1036
|
+
const dynamicJson = yield window.Capacitor.Plugins[pluginName]['getDynamicDefaults']();
|
|
1037
|
+
// Merge raw JSON into raw JSON, then let parseDefaults produce the typed object — never merge
|
|
1038
|
+
// into the already-parsed one. Merging into parsed values happens to work while the residual is
|
|
1039
|
+
// strings/arrays, but the first dynamic key that parseDefaults converts (a Color, Brush or
|
|
1040
|
+
// PointWithUnit) would land as raw JSON inside a typed object and fail silently at the consumer,
|
|
1041
|
+
// far from here. This also matches how barcode/id/label apply their residual.
|
|
1042
|
+
const merged = buildStaticCoreDefaultsJson(staticPlatform);
|
|
1043
|
+
deepMerge(merged, dynamicJson);
|
|
1044
|
+
// bindInstanceIfNotExists would no-op on this second load, so drop the binding first.
|
|
1045
|
+
FactoryMaker.instances.delete('CoreDefaults');
|
|
1046
|
+
loadCoreDefaults(merged);
|
|
1047
|
+
Capacitor.defaults = getCoreDefaults();
|
|
1048
|
+
return Capacitor.defaults;
|
|
1049
|
+
});
|
|
1050
|
+
function deepMerge(target, source) {
|
|
1051
|
+
for (const key of Object.keys(source)) {
|
|
1052
|
+
const sourceValue = source[key];
|
|
1053
|
+
const targetValue = target[key];
|
|
1054
|
+
if (sourceValue &&
|
|
1055
|
+
targetValue &&
|
|
1056
|
+
typeof sourceValue === 'object' &&
|
|
1057
|
+
typeof targetValue === 'object' &&
|
|
1058
|
+
!Array.isArray(sourceValue)) {
|
|
1059
|
+
deepMerge(targetValue, sourceValue);
|
|
1060
|
+
}
|
|
1061
|
+
else {
|
|
1062
|
+
target[key] = sourceValue;
|
|
1063
|
+
}
|
|
1064
|
+
}
|
|
1065
|
+
}
|
|
1066
|
+
class CapacitorNativeCaller {
|
|
1067
|
+
constructor(pluginName) {
|
|
1068
|
+
this.pluginName = pluginName;
|
|
1069
|
+
}
|
|
1070
|
+
get framework() {
|
|
1071
|
+
return 'capacitor';
|
|
1072
|
+
}
|
|
1073
|
+
get frameworkVersion() {
|
|
1074
|
+
return (() => Capacitor.defaults.capacitorVersion)();
|
|
1075
|
+
}
|
|
1076
|
+
callFn(fnName, args, _meta) {
|
|
1077
|
+
// meta parameter ignored - Capacitor handles events automatically through plugin system
|
|
1078
|
+
const plugin = window.Capacitor.Plugins[this.pluginName];
|
|
1079
|
+
if (!plugin || typeof plugin[fnName] !== 'function') {
|
|
1080
|
+
// tslint:disable-next-line:no-console
|
|
1081
|
+
console.error(`Function '${fnName}' not found in plugin '${this.pluginName}'`);
|
|
1082
|
+
return Promise.reject(new Error(`Function '${fnName}' not found in plugin '${this.pluginName}'`));
|
|
1083
|
+
}
|
|
1084
|
+
return plugin[fnName](args);
|
|
1085
|
+
}
|
|
1086
|
+
registerEvent(evName, handler) {
|
|
1087
|
+
return window.Capacitor.Plugins[this.pluginName].addListener(evName, handler);
|
|
1088
|
+
}
|
|
1089
|
+
unregisterEvent(_evName, subscription) {
|
|
1090
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1091
|
+
if (subscription) {
|
|
1092
|
+
yield subscription.remove();
|
|
1093
|
+
}
|
|
1094
|
+
});
|
|
1095
|
+
}
|
|
1096
|
+
eventHook(ev) {
|
|
1097
|
+
return ev;
|
|
1098
|
+
}
|
|
1099
|
+
}
|
|
1100
|
+
|
|
1101
|
+
var VolumeButtonObserverEvent;
|
|
1102
|
+
(function (VolumeButtonObserverEvent) {
|
|
1103
|
+
VolumeButtonObserverEvent["DidChangeVolume"] = "didChangeVolume";
|
|
1104
|
+
})(VolumeButtonObserverEvent || (VolumeButtonObserverEvent = {}));
|
|
1105
|
+
class VolumeButtonObserverProxy {
|
|
1106
|
+
static forVolumeButtonObserver(onDidChangeVolume) {
|
|
1107
|
+
const proxy = new VolumeButtonObserverProxy();
|
|
1108
|
+
proxy.onDidChangeVolume = onDidChangeVolume;
|
|
1109
|
+
proxy.subscribe();
|
|
1110
|
+
return proxy;
|
|
1111
|
+
}
|
|
1112
|
+
dispose() {
|
|
1113
|
+
this.unsubscribe();
|
|
1114
|
+
}
|
|
1115
|
+
subscribe() {
|
|
1116
|
+
this.subscriber = window.Capacitor.Plugins[Capacitor.pluginName].addListener(VolumeButtonObserverEvent.DidChangeVolume, this.notifyListeners.bind(this));
|
|
1117
|
+
}
|
|
1118
|
+
unsubscribe() {
|
|
1119
|
+
this.subscriber.remove();
|
|
1120
|
+
}
|
|
1121
|
+
notifyListeners(event) {
|
|
1122
|
+
if (!event) {
|
|
1123
|
+
// The event could be undefined/null in case the plugin result did not pass a "message",
|
|
1124
|
+
// which could happen e.g. in case of "ok" results, which could signal e.g. successful
|
|
1125
|
+
// listener subscriptions.
|
|
1126
|
+
return doReturnWithFinish('', null);
|
|
1127
|
+
}
|
|
1128
|
+
if (event.name === VolumeButtonObserverEvent.DidChangeVolume) {
|
|
1129
|
+
this.onDidChangeVolume();
|
|
1130
|
+
return doReturnWithFinish(event.name, null);
|
|
1131
|
+
}
|
|
1132
|
+
}
|
|
1133
|
+
}
|
|
1134
|
+
|
|
1135
|
+
class VolumeButtonObserver {
|
|
1136
|
+
constructor(didChangeVolume) {
|
|
1137
|
+
this.didChangeVolume = didChangeVolume;
|
|
1138
|
+
this.initialize();
|
|
1139
|
+
}
|
|
1140
|
+
dispose() {
|
|
1141
|
+
if (this.proxy) {
|
|
1142
|
+
this.proxy.dispose();
|
|
1143
|
+
this.proxy = null;
|
|
1144
|
+
this.didChangeVolume = null;
|
|
1145
|
+
}
|
|
1146
|
+
}
|
|
1147
|
+
initialize() {
|
|
1148
|
+
if (!this.proxy) {
|
|
1149
|
+
this.proxy = VolumeButtonObserverProxy.forVolumeButtonObserver(() => { var _a; return (_a = this.didChangeVolume) === null || _a === void 0 ? void 0 : _a.call(this); });
|
|
1150
|
+
}
|
|
1151
|
+
}
|
|
1152
|
+
}
|
|
1153
|
+
|
|
1154
|
+
// Core Geometry & Units
|
|
1155
|
+
|
|
1156
|
+
var CoreExports = /*#__PURE__*/Object.freeze({
|
|
1157
|
+
__proto__: null,
|
|
1158
|
+
AimerViewfinder: AimerViewfinder,
|
|
1159
|
+
get Anchor () { return Anchor; },
|
|
1160
|
+
Brush: Brush,
|
|
1161
|
+
Camera: Camera,
|
|
1162
|
+
get CameraPosition () { return CameraPosition; },
|
|
1163
|
+
CameraSettings: CameraSettings,
|
|
1164
|
+
CameraSwitchControl: CameraSwitchControl,
|
|
1165
|
+
get ClusteringMode () { return ClusteringMode; },
|
|
1166
|
+
Color: Color,
|
|
1167
|
+
ColorFillOverlay: ColorFillOverlay,
|
|
1168
|
+
ContextStatus: ContextStatus,
|
|
1169
|
+
DataCaptureContext: DataCaptureContext,
|
|
1170
|
+
DataCaptureContextSettings: DataCaptureContextSettings,
|
|
1171
|
+
DataCaptureVersion: DataCaptureVersion,
|
|
1172
|
+
DataCaptureView: DataCaptureView,
|
|
1173
|
+
get Direction () { return Direction; },
|
|
1174
|
+
get Expiration () { return Expiration; },
|
|
1175
|
+
Feedback: Feedback,
|
|
1176
|
+
get FocusGestureStrategy () { return FocusGestureStrategy; },
|
|
1177
|
+
get FocusRange () { return FocusRange; },
|
|
1178
|
+
get FontFamily () { return FontFamily; },
|
|
1179
|
+
FrameDataSettings: FrameDataSettings,
|
|
1180
|
+
FrameDataSettingsBuilder: FrameDataSettingsBuilder,
|
|
1181
|
+
get FrameSourceState () { return FrameSourceState; },
|
|
1182
|
+
ImageBuffer: ImageBuffer,
|
|
1183
|
+
ImageFrameSource: ImageFrameSource,
|
|
1184
|
+
LaserlineViewfinder: LaserlineViewfinder,
|
|
1185
|
+
LicenseInfo: LicenseInfo,
|
|
1186
|
+
get LogCategory () { return LogCategory; },
|
|
1187
|
+
get LogLevel () { return LogLevel; },
|
|
1188
|
+
get LogoStyle () { return LogoStyle; },
|
|
1189
|
+
get MacroMode () { return MacroMode; },
|
|
1190
|
+
MarginsWithUnit: MarginsWithUnit,
|
|
1191
|
+
get MeasureUnit () { return MeasureUnit; },
|
|
1192
|
+
NoViewfinder: NoViewfinder,
|
|
1193
|
+
NoneLocationSelection: NoneLocationSelection,
|
|
1194
|
+
NumberWithUnit: NumberWithUnit,
|
|
1195
|
+
OpenSourceSoftwareLicenseInfo: OpenSourceSoftwareLicenseInfo,
|
|
1196
|
+
get Orientation () { return Orientation; },
|
|
1197
|
+
PinchToZoom: PinchToZoom,
|
|
1198
|
+
Point: Point,
|
|
1199
|
+
PointWithUnit: PointWithUnit,
|
|
1200
|
+
Quadrilateral: Quadrilateral,
|
|
1201
|
+
RadiusLocationSelection: RadiusLocationSelection,
|
|
1202
|
+
Rect: Rect,
|
|
1203
|
+
RectWithUnit: RectWithUnit,
|
|
1204
|
+
RectangularLocationSelection: RectangularLocationSelection,
|
|
1205
|
+
RectangularViewfinder: RectangularViewfinder,
|
|
1206
|
+
RectangularViewfinderAnimation: RectangularViewfinderAnimation,
|
|
1207
|
+
get RectangularViewfinderLineStyle () { return RectangularViewfinderLineStyle; },
|
|
1208
|
+
get RectangularViewfinderStyle () { return RectangularViewfinderStyle; },
|
|
1209
|
+
get ScanIntention () { return ScanIntention; },
|
|
1210
|
+
ScanditIcon: ScanditIcon,
|
|
1211
|
+
ScanditIconBuilder: ScanditIconBuilder,
|
|
1212
|
+
get ScanditIconShape () { return ScanditIconShape; },
|
|
1213
|
+
get ScanditIconType () { return ScanditIconType; },
|
|
1214
|
+
ScanditLogger: ScanditLogger,
|
|
1215
|
+
get SelectionMode () { return SelectionMode; },
|
|
1216
|
+
SequenceFrameSource: SequenceFrameSource,
|
|
1217
|
+
Size: Size,
|
|
1218
|
+
SizeWithAspect: SizeWithAspect,
|
|
1219
|
+
SizeWithUnit: SizeWithUnit,
|
|
1220
|
+
SizeWithUnitAndAspect: SizeWithUnitAndAspect,
|
|
1221
|
+
get SizingMode () { return SizingMode; },
|
|
1222
|
+
Sound: Sound,
|
|
1223
|
+
SwipeToZoom: SwipeToZoom,
|
|
1224
|
+
TapToFocus: TapToFocus,
|
|
1225
|
+
get TextAlignment () { return TextAlignment; },
|
|
1226
|
+
get TorchState () { return TorchState; },
|
|
1227
|
+
TorchSwitchControl: TorchSwitchControl,
|
|
1228
|
+
Vibration: Vibration,
|
|
1229
|
+
get VideoResolution () { return VideoResolution; },
|
|
1230
|
+
VolumeButtonObserver: VolumeButtonObserver,
|
|
1231
|
+
ZoomSwitchControl: ZoomSwitchControl,
|
|
1232
|
+
get ZoomSwitchOrientation () { return ZoomSwitchOrientation; }
|
|
1233
|
+
});
|
|
1234
|
+
|
|
1192
1235
|
class CapacitorCoreNativeCallerProvider {
|
|
1193
1236
|
getNativeCaller(_proxyType) {
|
|
1194
|
-
return new CapacitorNativeCaller(Capacitor
|
|
1237
|
+
return new CapacitorNativeCaller(Capacitor.pluginName);
|
|
1195
1238
|
}
|
|
1196
1239
|
}
|
|
1197
1240
|
|
|
@@ -1204,7 +1247,9 @@ initProxy();
|
|
|
1204
1247
|
class ScanditCaptureCorePluginImplementation {
|
|
1205
1248
|
initializePlugins() {
|
|
1206
1249
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1207
|
-
|
|
1250
|
+
// Static defaults are already loaded synchronously at module-import time (see
|
|
1251
|
+
// Capacitor.ts); only the narrow dynamic residual needs to be awaited here.
|
|
1252
|
+
const coreDefaults = yield applyDynamicDefaults();
|
|
1208
1253
|
let api = Object.assign({}, CoreExports);
|
|
1209
1254
|
for (const key of Object.keys(window.Capacitor.Plugins)) {
|
|
1210
1255
|
if (key.startsWith('Scandit') && key.indexOf('Native') < 0 && key !== corePluginName) {
|
|
@@ -1226,5 +1271,5 @@ registerPlugin(corePluginName, {
|
|
|
1226
1271
|
// tslint:disable-next-line:variable-name
|
|
1227
1272
|
const ScanditCaptureCorePlugin = new ScanditCaptureCorePluginImplementation();
|
|
1228
1273
|
|
|
1229
|
-
export { AimerViewfinder, Anchor, Brush, Camera, CameraPosition, CameraSettings, CameraSwitchControl, Capacitor
|
|
1274
|
+
export { AimerViewfinder, Anchor, Brush, Camera, CameraPosition, CameraSettings, CameraSwitchControl, Capacitor as CapacitorCore, CapacitorNativeCaller, ClusteringMode, Color, ColorFillOverlay, ContextStatus, DataCaptureContext, DataCaptureContextSettings, DataCaptureVersion, DataCaptureView, Direction, Expiration, Feedback, FocusGestureStrategy, FocusRange, FontFamily, FrameDataSettings, FrameDataSettingsBuilder, FrameSourceState, ImageBuffer, ImageFrameSource, LaserlineViewfinder, LicenseInfo, LogCategory, LogLevel, LogoStyle, MacroMode, MarginsWithUnit, MeasureUnit, NoViewfinder, NoneLocationSelection, NumberWithUnit, OpenSourceSoftwareLicenseInfo, Orientation, PinchToZoom, Point, PointWithUnit, Quadrilateral, RadiusLocationSelection, Rect, RectWithUnit, RectangularLocationSelection, RectangularViewfinder, RectangularViewfinderAnimation, RectangularViewfinderLineStyle, RectangularViewfinderStyle, ScanIntention, ScanditCaptureCorePlugin, ScanditCaptureCorePluginImplementation, ScanditIcon, ScanditIconBuilder, ScanditIconShape, ScanditIconType, ScanditLogger, SelectionMode, SequenceFrameSource, Size, SizeWithAspect, SizeWithUnit, SizeWithUnitAndAspect, SizingMode, Sound, SwipeToZoom, TapToFocus, TextAlignment, TorchState, TorchSwitchControl, Vibration, VideoResolution, VolumeButtonObserver, ZoomSwitchControl, ZoomSwitchOrientation, capacitorExec, doReturnWithFinish };
|
|
1230
1275
|
//# sourceMappingURL=index.js.map
|