scandit-capacitor-datacapture-core 6.27.2 → 6.28.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.
- package/ScanditCapacitorDatacaptureCore.podspec +1 -1
- package/android/build.gradle +1 -1
- package/android/src/main/java/com/scandit/capacitor/datacapture/core/ScanditCaptureCoreNative.kt +21 -38
- package/android/src/main/java/com/scandit/capacitor/datacapture/core/handlers/DataCaptureViewHandler.kt +3 -0
- package/dist/core.js +49 -33
- package/dist/core.js.map +1 -1
- package/dist/dts/ts/Capacitor/Capacitor.d.ts +1 -3
- package/dist/dts/ts/Capacitor/DataCaptureViewProxy.d.ts +1 -3
- package/dist/index.js +15 -22
- package/dist/index.js.map +1 -1
- package/ios/Plugin/Plugin.m +2 -4
- package/ios/Plugin/ScanditCaptureCore.swift +26 -45
- package/package.json +3 -3
- package/scripts/detect_frameworks.rb +1 -6
package/android/build.gradle
CHANGED
package/android/src/main/java/com/scandit/capacitor/datacapture/core/ScanditCaptureCoreNative.kt
CHANGED
|
@@ -2,20 +2,22 @@ package com.scandit.capacitor.datacapture.core
|
|
|
2
2
|
|
|
3
3
|
import android.Manifest
|
|
4
4
|
import android.util.Log
|
|
5
|
-
import com.getcapacitor
|
|
5
|
+
import com.getcapacitor.JSObject
|
|
6
|
+
import com.getcapacitor.PermissionState
|
|
7
|
+
import com.getcapacitor.Plugin
|
|
8
|
+
import com.getcapacitor.PluginCall
|
|
9
|
+
import com.getcapacitor.PluginMethod
|
|
6
10
|
import com.getcapacitor.annotation.CapacitorPlugin
|
|
7
11
|
import com.getcapacitor.annotation.Permission
|
|
8
12
|
import com.getcapacitor.annotation.PermissionCallback
|
|
9
13
|
import com.scandit.capacitor.datacapture.core.data.ResizeAndMoveInfo
|
|
10
|
-
import com.scandit.capacitor.datacapture.core.errors
|
|
14
|
+
import com.scandit.capacitor.datacapture.core.errors.JsonParseError
|
|
15
|
+
import com.scandit.capacitor.datacapture.core.errors.NullFrameError
|
|
11
16
|
import com.scandit.capacitor.datacapture.core.handlers.DataCaptureViewHandler
|
|
12
17
|
import com.scandit.capacitor.datacapture.core.utils.CapacitorResult
|
|
13
18
|
import com.scandit.datacapture.core.source.FrameSourceState
|
|
14
19
|
import com.scandit.datacapture.core.source.FrameSourceStateDeserializer
|
|
15
|
-
import com.scandit.datacapture.core.ui.DataCaptureView
|
|
16
20
|
import com.scandit.datacapture.frameworks.core.CoreModule
|
|
17
|
-
import com.scandit.datacapture.frameworks.core.deserialization.DefaultDeserializationLifecycleObserver
|
|
18
|
-
import com.scandit.datacapture.frameworks.core.deserialization.DeserializationLifecycleObserver
|
|
19
21
|
import com.scandit.datacapture.frameworks.core.events.Emitter
|
|
20
22
|
import com.scandit.datacapture.frameworks.core.listeners.FrameworksDataCaptureContextListener
|
|
21
23
|
import com.scandit.datacapture.frameworks.core.listeners.FrameworksDataCaptureViewListener
|
|
@@ -36,7 +38,6 @@ import org.json.JSONObject
|
|
|
36
38
|
)
|
|
37
39
|
class ScanditCaptureCoreNative :
|
|
38
40
|
Plugin(),
|
|
39
|
-
DeserializationLifecycleObserver.Observer,
|
|
40
41
|
Emitter {
|
|
41
42
|
|
|
42
43
|
companion object {
|
|
@@ -60,8 +61,6 @@ class ScanditCaptureCoreNative :
|
|
|
60
61
|
)
|
|
61
62
|
private val mainThread: MainThread = DefaultMainThread.getInstance()
|
|
62
63
|
private val lastFrameData: LastFrameData = DefaultLastFrameData.getInstance()
|
|
63
|
-
private val deserializationLifecycleObserver: DeserializationLifecycleObserver =
|
|
64
|
-
DefaultDeserializationLifecycleObserver.getInstance()
|
|
65
64
|
|
|
66
65
|
private var lastFrameSourceState: FrameSourceState = FrameSourceState.OFF
|
|
67
66
|
|
|
@@ -91,7 +90,6 @@ class ScanditCaptureCoreNative :
|
|
|
91
90
|
|
|
92
91
|
captureViewHandler.attachWebView(bridge.webView, bridge.activity)
|
|
93
92
|
coreModule.onCreate(this.context)
|
|
94
|
-
deserializationLifecycleObserver.attach(this)
|
|
95
93
|
}
|
|
96
94
|
|
|
97
95
|
override fun handleOnStart() {
|
|
@@ -112,18 +110,9 @@ class ScanditCaptureCoreNative :
|
|
|
112
110
|
}
|
|
113
111
|
|
|
114
112
|
override fun handleOnDestroy() {
|
|
115
|
-
deserializationLifecycleObserver.detach(this)
|
|
116
113
|
coreModule.onDestroy()
|
|
117
114
|
}
|
|
118
115
|
|
|
119
|
-
override fun onDataCaptureViewDeserialized(dataCaptureView: DataCaptureView?) {
|
|
120
|
-
if (dataCaptureView == null) {
|
|
121
|
-
captureViewHandler.disposeCurrentDataCaptureView()
|
|
122
|
-
return
|
|
123
|
-
}
|
|
124
|
-
captureViewHandler.attachDataCaptureView(dataCaptureView, this.activity)
|
|
125
|
-
}
|
|
126
|
-
|
|
127
116
|
private fun checkCameraPermission(): Boolean =
|
|
128
117
|
getPermissionState("camera") == PermissionState.GRANTED
|
|
129
118
|
|
|
@@ -350,33 +339,27 @@ class ScanditCaptureCoreNative :
|
|
|
350
339
|
fun createDataCaptureView(call: PluginCall) {
|
|
351
340
|
val viewJson = call.data.getString("viewJson")
|
|
352
341
|
?: return call.reject(EMPTY_STRING_ERROR)
|
|
353
|
-
coreModule.createDataCaptureView(viewJson, CapacitorResult(call))
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
fun updateDataCaptureView(call: PluginCall) {
|
|
358
|
-
val viewJson = call.data.getString("viewJson")
|
|
359
|
-
?: return call.reject(EMPTY_STRING_ERROR)
|
|
360
|
-
coreModule.updateDataCaptureView(viewJson, CapacitorResult(call))
|
|
342
|
+
val view = coreModule.createDataCaptureView(viewJson, CapacitorResult(call))
|
|
343
|
+
if (view != null) {
|
|
344
|
+
captureViewHandler.attachDataCaptureView(view, this.activity)
|
|
345
|
+
}
|
|
361
346
|
}
|
|
362
347
|
|
|
363
348
|
@PluginMethod
|
|
364
|
-
fun
|
|
365
|
-
val
|
|
366
|
-
|
|
367
|
-
|
|
349
|
+
fun removeDataCaptureView(call: PluginCall) {
|
|
350
|
+
val dcViewToRemove = captureViewHandler.dataCaptureView
|
|
351
|
+
if (dcViewToRemove != null) {
|
|
352
|
+
coreModule.dataCaptureViewDisposed(dcViewToRemove)
|
|
353
|
+
}
|
|
354
|
+
captureViewHandler.disposeCurrentDataCaptureView()
|
|
355
|
+
call.resolve()
|
|
368
356
|
}
|
|
369
357
|
|
|
370
358
|
@PluginMethod
|
|
371
|
-
fun
|
|
372
|
-
val
|
|
359
|
+
fun updateDataCaptureView(call: PluginCall) {
|
|
360
|
+
val viewJson = call.data.getString("viewJson")
|
|
373
361
|
?: return call.reject(EMPTY_STRING_ERROR)
|
|
374
|
-
coreModule.
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
@PluginMethod
|
|
378
|
-
fun removeAllOverlays(call: PluginCall) {
|
|
379
|
-
coreModule.removeAllOverlays(CapacitorResult(call))
|
|
362
|
+
coreModule.updateDataCaptureView(viewJson, CapacitorResult(call))
|
|
380
363
|
}
|
|
381
364
|
|
|
382
365
|
override fun emit(eventName: String, payload: MutableMap<String, Any?>) {
|
|
@@ -30,6 +30,9 @@ class DataCaptureViewHandler(
|
|
|
30
30
|
private val webView: View?
|
|
31
31
|
get() = webViewReference.get()
|
|
32
32
|
|
|
33
|
+
val dataCaptureView: DataCaptureView?
|
|
34
|
+
get() = dataCaptureViewReference.get()
|
|
35
|
+
|
|
33
36
|
fun attachDataCaptureView(dataCaptureView: DataCaptureView, activity: AppCompatActivity) {
|
|
34
37
|
if (this.dataCaptureViewReference.get() != dataCaptureView) {
|
|
35
38
|
disposeCurrentDataCaptureView()
|
package/dist/core.js
CHANGED
|
@@ -989,16 +989,6 @@ class DataCaptureContextSettings extends DefaultSerializeable {
|
|
|
989
989
|
}
|
|
990
990
|
}
|
|
991
991
|
|
|
992
|
-
class DataCaptureContextFeatures {
|
|
993
|
-
static get featureFlags() {
|
|
994
|
-
return this._featureFlags;
|
|
995
|
-
}
|
|
996
|
-
static set featureFlags(value) {
|
|
997
|
-
this._featureFlags = value;
|
|
998
|
-
}
|
|
999
|
-
}
|
|
1000
|
-
DataCaptureContextFeatures._featureFlags = {};
|
|
1001
|
-
|
|
1002
992
|
var DataCaptureContextEvents;
|
|
1003
993
|
(function (DataCaptureContextEvents) {
|
|
1004
994
|
DataCaptureContextEvents["didChangeStatus"] = "DataCaptureContextListener.onStatusChanged";
|
|
@@ -1060,9 +1050,7 @@ class DataCaptureContextController {
|
|
|
1060
1050
|
initializeContextFromJSON() {
|
|
1061
1051
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1062
1052
|
try {
|
|
1063
|
-
|
|
1064
|
-
DataCaptureContextFeatures.featureFlags =
|
|
1065
|
-
JSON.parse(featureFlagsString);
|
|
1053
|
+
yield this._proxy.contextFromJSON(this.context);
|
|
1066
1054
|
}
|
|
1067
1055
|
catch (error) {
|
|
1068
1056
|
this.notifyListenersOfDeserializationError(error);
|
|
@@ -1231,6 +1219,9 @@ DataCaptureContext.instance = null;
|
|
|
1231
1219
|
__decorate([
|
|
1232
1220
|
nameForSerialization('frameSource')
|
|
1233
1221
|
], DataCaptureContext.prototype, "_frameSource", void 0);
|
|
1222
|
+
__decorate([
|
|
1223
|
+
ignoreFromSerialization
|
|
1224
|
+
], DataCaptureContext.prototype, "view", void 0);
|
|
1234
1225
|
__decorate([
|
|
1235
1226
|
ignoreFromSerialization
|
|
1236
1227
|
], DataCaptureContext.prototype, "modes", void 0);
|
|
@@ -1765,11 +1756,13 @@ var DataCaptureViewEvents;
|
|
|
1765
1756
|
DataCaptureViewEvents["didChangeSize"] = "DataCaptureViewListener.onSizeChanged";
|
|
1766
1757
|
})(DataCaptureViewEvents || (DataCaptureViewEvents = {}));
|
|
1767
1758
|
class DataCaptureViewController extends BaseController {
|
|
1768
|
-
static forDataCaptureView(view) {
|
|
1759
|
+
static forDataCaptureView(view, autoCreateNativeView) {
|
|
1769
1760
|
const controller = new DataCaptureViewController();
|
|
1770
1761
|
controller.view = view;
|
|
1771
|
-
|
|
1772
|
-
|
|
1762
|
+
if (autoCreateNativeView) {
|
|
1763
|
+
controller.createView();
|
|
1764
|
+
controller.subscribeListener();
|
|
1765
|
+
}
|
|
1773
1766
|
return controller;
|
|
1774
1767
|
}
|
|
1775
1768
|
constructor() {
|
|
@@ -1796,6 +1789,15 @@ class DataCaptureViewController extends BaseController {
|
|
|
1796
1789
|
hide() {
|
|
1797
1790
|
return this._proxy.hide();
|
|
1798
1791
|
}
|
|
1792
|
+
createNativeView() {
|
|
1793
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1794
|
+
yield this.createView();
|
|
1795
|
+
this.subscribeListener();
|
|
1796
|
+
});
|
|
1797
|
+
}
|
|
1798
|
+
removeNativeView() {
|
|
1799
|
+
return this._proxy.removeView();
|
|
1800
|
+
}
|
|
1799
1801
|
createView() {
|
|
1800
1802
|
return this._proxy.createView(JSON.stringify(this.view.toJSON()));
|
|
1801
1803
|
}
|
|
@@ -1805,12 +1807,6 @@ class DataCaptureViewController extends BaseController {
|
|
|
1805
1807
|
dispose() {
|
|
1806
1808
|
this.unsubscribeListener();
|
|
1807
1809
|
}
|
|
1808
|
-
addOverlay(overlay) {
|
|
1809
|
-
return this._proxy.addOverlay(JSON.stringify(overlay.toJSON()));
|
|
1810
|
-
}
|
|
1811
|
-
removeOverlay(overlay) {
|
|
1812
|
-
return this._proxy.removeOverlay(JSON.stringify(overlay.toJSON()));
|
|
1813
|
-
}
|
|
1814
1810
|
subscribeListener() {
|
|
1815
1811
|
var _a, _b;
|
|
1816
1812
|
this._proxy.registerListenerForViewEvents();
|
|
@@ -1901,18 +1897,20 @@ class BaseDataCaptureView extends DefaultSerializeable {
|
|
|
1901
1897
|
get privateContext() {
|
|
1902
1898
|
return this.context;
|
|
1903
1899
|
}
|
|
1904
|
-
static forContext(context) {
|
|
1905
|
-
const view = new BaseDataCaptureView();
|
|
1900
|
+
static forContext(context, autoCreateNativeView = true) {
|
|
1901
|
+
const view = new BaseDataCaptureView(autoCreateNativeView);
|
|
1906
1902
|
view.context = context;
|
|
1903
|
+
view.isViewCreated = autoCreateNativeView;
|
|
1907
1904
|
return view;
|
|
1908
1905
|
}
|
|
1909
|
-
constructor() {
|
|
1906
|
+
constructor(autoCreateNativeView) {
|
|
1910
1907
|
super();
|
|
1911
1908
|
this._context = null;
|
|
1912
1909
|
this.overlays = [];
|
|
1913
1910
|
this.controls = [];
|
|
1914
1911
|
this.listeners = [];
|
|
1915
|
-
this.
|
|
1912
|
+
this.isViewCreated = false;
|
|
1913
|
+
this.controller = DataCaptureViewController.forDataCaptureView(this, autoCreateNativeView);
|
|
1916
1914
|
this._scanAreaMargins = this.coreDefaults.DataCaptureView.scanAreaMargins;
|
|
1917
1915
|
this._pointOfInterest = this.coreDefaults.DataCaptureView.pointOfInterest;
|
|
1918
1916
|
this._logoAnchor = this.coreDefaults.DataCaptureView.logoAnchor;
|
|
@@ -1927,7 +1925,7 @@ class BaseDataCaptureView extends DefaultSerializeable {
|
|
|
1927
1925
|
}
|
|
1928
1926
|
overlay.view = this;
|
|
1929
1927
|
this.overlays.push(overlay);
|
|
1930
|
-
this.controller.
|
|
1928
|
+
this.controller.updateView();
|
|
1931
1929
|
}
|
|
1932
1930
|
removeOverlay(overlay) {
|
|
1933
1931
|
if (!this.overlays.includes(overlay)) {
|
|
@@ -1935,7 +1933,7 @@ class BaseDataCaptureView extends DefaultSerializeable {
|
|
|
1935
1933
|
}
|
|
1936
1934
|
overlay.view = null;
|
|
1937
1935
|
this.overlays.splice(this.overlays.indexOf(overlay), 1);
|
|
1938
|
-
this.controller.
|
|
1936
|
+
this.controller.updateView();
|
|
1939
1937
|
}
|
|
1940
1938
|
addListener(listener) {
|
|
1941
1939
|
if (!this.listeners.includes(listener)) {
|
|
@@ -1979,11 +1977,29 @@ class BaseDataCaptureView extends DefaultSerializeable {
|
|
|
1979
1977
|
controlUpdated() {
|
|
1980
1978
|
this.controller.updateView();
|
|
1981
1979
|
}
|
|
1980
|
+
createNativeView() {
|
|
1981
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1982
|
+
if (this.isViewCreated) {
|
|
1983
|
+
return Promise.resolve();
|
|
1984
|
+
}
|
|
1985
|
+
yield this.controller.createNativeView();
|
|
1986
|
+
this.isViewCreated = true;
|
|
1987
|
+
});
|
|
1988
|
+
}
|
|
1989
|
+
removeNativeView() {
|
|
1990
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1991
|
+
if (!this.isViewCreated) {
|
|
1992
|
+
return Promise.resolve();
|
|
1993
|
+
}
|
|
1994
|
+
this.controller.removeNativeView();
|
|
1995
|
+
this.isViewCreated = false;
|
|
1996
|
+
});
|
|
1997
|
+
}
|
|
1982
1998
|
dispose() {
|
|
1983
|
-
this.overlays.forEach(overlay => this.removeOverlay(overlay));
|
|
1984
1999
|
this.overlays = [];
|
|
1985
2000
|
this.listeners.forEach(listener => this.removeListener(listener));
|
|
1986
2001
|
this.controller.dispose();
|
|
2002
|
+
this.isViewCreated = false;
|
|
1987
2003
|
}
|
|
1988
2004
|
// HTML Views only
|
|
1989
2005
|
setFrame(frame, isUnderContent = false) {
|
|
@@ -2036,15 +2052,15 @@ __decorate([
|
|
|
2036
2052
|
__decorate([
|
|
2037
2053
|
nameForSerialization('logoStyle')
|
|
2038
2054
|
], BaseDataCaptureView.prototype, "_logoStyle", void 0);
|
|
2039
|
-
__decorate([
|
|
2040
|
-
ignoreFromSerialization
|
|
2041
|
-
], BaseDataCaptureView.prototype, "overlays", void 0);
|
|
2042
2055
|
__decorate([
|
|
2043
2056
|
ignoreFromSerialization
|
|
2044
2057
|
], BaseDataCaptureView.prototype, "controller", void 0);
|
|
2045
2058
|
__decorate([
|
|
2046
2059
|
ignoreFromSerialization
|
|
2047
2060
|
], BaseDataCaptureView.prototype, "listeners", void 0);
|
|
2061
|
+
__decorate([
|
|
2062
|
+
ignoreFromSerialization
|
|
2063
|
+
], BaseDataCaptureView.prototype, "isViewCreated", void 0);
|
|
2048
2064
|
|
|
2049
2065
|
class ZoomSwitchControl extends DefaultSerializeable {
|
|
2050
2066
|
constructor() {
|
|
@@ -2887,5 +2903,5 @@ var Expiration;
|
|
|
2887
2903
|
|
|
2888
2904
|
createEventEmitter();
|
|
2889
2905
|
|
|
2890
|
-
export { AimerViewfinder, Anchor, BaseController, BaseDataCaptureView, BaseNativeProxy, Brush, Camera, CameraController, CameraPosition, CameraSettings, Color, ContextStatus, ControlImage, DataCaptureContext, DataCaptureContextEvents,
|
|
2906
|
+
export { AimerViewfinder, Anchor, BaseController, BaseDataCaptureView, BaseNativeProxy, Brush, Camera, CameraController, CameraPosition, CameraSettings, Color, ContextStatus, ControlImage, DataCaptureContext, DataCaptureContextEvents, DataCaptureContextSettings, DataCaptureViewController, DataCaptureViewEvents, DefaultSerializeable, Direction, EventEmitter, Expiration, FactoryMaker, Feedback, FocusGestureStrategy, FocusRange, FrameSourceListenerEvents, FrameSourceState, ImageBuffer, ImageFrameSource, LaserlineViewfinder, LaserlineViewfinderStyle, LicenseInfo, LogoStyle, MarginsWithUnit, MeasureUnit, NoViewfinder, NoneLocationSelection, NumberWithUnit, Orientation, Point, PointWithUnit, PrivateFocusGestureDeserializer, PrivateFrameData, PrivateZoomGestureDeserializer, Quadrilateral, RadiusLocationSelection, Rect, RectWithUnit, RectangularLocationSelection, RectangularViewfinder, RectangularViewfinderAnimation, RectangularViewfinderLineStyle, RectangularViewfinderStyle, ScanIntention, Size, SizeWithAspect, SizeWithUnit, SizeWithUnitAndAspect, SizingMode, Sound, SpotlightViewfinder, SwipeToZoom, TapToFocus, TorchState, TorchSwitchControl, Vibration, VibrationType, VideoResolution, WaveFormVibration, ZoomSwitchControl, getCoreDefaults, ignoreFromSerialization, ignoreFromSerializationIfNull, loadCoreDefaults, nameForSerialization, serializationDefault };
|
|
2891
2907
|
//# sourceMappingURL=core.js.map
|