scandit-capacitor-datacapture-core 6.28.0-beta.1 → 6.28.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/ScanditCapacitorDatacaptureCore.podspec +1 -1
- package/android/build.gradle +1 -1
- package/android/src/main/java/com/scandit/capacitor/datacapture/core/ScanditCaptureCoreNative.kt +27 -40
- package/dist/core.js +14 -2
- package/dist/core.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/scripts/detect_frameworks.rb +6 -1
- package/android/src/main/java/com/scandit/capacitor/datacapture/core/communication/CameraPermissionGrantedListener.kt +0 -11
package/android/build.gradle
CHANGED
package/android/src/main/java/com/scandit/capacitor/datacapture/core/ScanditCaptureCoreNative.kt
CHANGED
|
@@ -10,13 +10,13 @@ import com.getcapacitor.PluginMethod
|
|
|
10
10
|
import com.getcapacitor.annotation.CapacitorPlugin
|
|
11
11
|
import com.getcapacitor.annotation.Permission
|
|
12
12
|
import com.getcapacitor.annotation.PermissionCallback
|
|
13
|
-
import com.scandit.capacitor.datacapture.core.communication.CameraPermissionGrantedListener
|
|
14
13
|
import com.scandit.capacitor.datacapture.core.data.ResizeAndMoveInfo
|
|
15
14
|
import com.scandit.capacitor.datacapture.core.errors.JsonParseError
|
|
16
15
|
import com.scandit.capacitor.datacapture.core.errors.NullFrameError
|
|
17
16
|
import com.scandit.capacitor.datacapture.core.handlers.DataCaptureViewHandler
|
|
18
17
|
import com.scandit.capacitor.datacapture.core.utils.CapacitorResult
|
|
19
18
|
import com.scandit.datacapture.core.source.FrameSourceState
|
|
19
|
+
import com.scandit.datacapture.core.source.FrameSourceStateDeserializer
|
|
20
20
|
import com.scandit.datacapture.frameworks.core.CoreModule
|
|
21
21
|
import com.scandit.datacapture.frameworks.core.events.Emitter
|
|
22
22
|
import com.scandit.datacapture.frameworks.core.listeners.FrameworksDataCaptureContextListener
|
|
@@ -116,45 +116,26 @@ class ScanditCaptureCoreNative :
|
|
|
116
116
|
private fun checkCameraPermission(): Boolean =
|
|
117
117
|
getPermissionState("camera") == PermissionState.GRANTED
|
|
118
118
|
|
|
119
|
-
private fun
|
|
120
|
-
if (
|
|
121
|
-
requestPermissionForAlias("camera", call, "
|
|
119
|
+
private fun checkOrRequestCameraPermissions(call: PluginCall) {
|
|
120
|
+
if (!checkCameraPermission()) {
|
|
121
|
+
requestPermissionForAlias("camera", call, "onCameraPermissionResult")
|
|
122
122
|
} else {
|
|
123
|
-
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
private fun checkOrRequestUpdateCameraPermission(call: PluginCall) {
|
|
128
|
-
if (getPermissionState("camera") != PermissionState.GRANTED) {
|
|
129
|
-
requestPermissionForAlias("camera", call, "updateCameraPermsCallback")
|
|
130
|
-
} else {
|
|
131
|
-
updateContext(call)
|
|
123
|
+
onCameraPermissionResult(call)
|
|
132
124
|
}
|
|
133
125
|
}
|
|
134
126
|
|
|
135
127
|
@Suppress("unused")
|
|
136
128
|
@PermissionCallback
|
|
137
|
-
private fun
|
|
138
|
-
if (
|
|
139
|
-
|
|
129
|
+
private fun onCameraPermissionResult(call: PluginCall) {
|
|
130
|
+
if (checkCameraPermission()) {
|
|
131
|
+
coreModule.switchToDesiredCameraState(lastFrameSourceState)
|
|
132
|
+
call.resolve()
|
|
133
|
+
return
|
|
140
134
|
}
|
|
141
|
-
updateContext(call)
|
|
142
|
-
}
|
|
143
135
|
|
|
144
|
-
|
|
145
|
-
@PermissionCallback
|
|
146
|
-
private fun updateCameraPermsCallback(call: PluginCall) {
|
|
147
|
-
if (getPermissionState("camera") == PermissionState.GRANTED) {
|
|
148
|
-
notifyCameraPermissionGrantedToPlugins()
|
|
149
|
-
}
|
|
150
|
-
updateContext(call)
|
|
136
|
+
call.reject("Camera permissions not granted.")
|
|
151
137
|
}
|
|
152
138
|
|
|
153
|
-
private fun notifyCameraPermissionGrantedToPlugins() =
|
|
154
|
-
plugins.filterIsInstance<CameraPermissionGrantedListener>().forEach {
|
|
155
|
-
it.onCameraPermissionGranted()
|
|
156
|
-
}
|
|
157
|
-
|
|
158
139
|
//region CameraProxy
|
|
159
140
|
@PluginMethod
|
|
160
141
|
fun getCurrentCameraState(call: PluginCall) =
|
|
@@ -180,19 +161,27 @@ class ScanditCaptureCoreNative :
|
|
|
180
161
|
|
|
181
162
|
@PluginMethod
|
|
182
163
|
fun switchCameraToDesiredState(call: PluginCall) {
|
|
183
|
-
val desiredStateJson = call.data.getString("desiredState") ?:
|
|
184
|
-
|
|
164
|
+
val desiredStateJson = call.data.getString("desiredState") ?: run {
|
|
165
|
+
call.reject(
|
|
166
|
+
"Missing desiredState argument in switchCameraToDesiredState."
|
|
167
|
+
)
|
|
168
|
+
return
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
if (checkCameraPermission()) {
|
|
172
|
+
coreModule.switchCameraToDesiredState(desiredStateJson, CapacitorResult(call))
|
|
173
|
+
lastFrameSourceState = coreModule.getCurrentCameraDesiredState() ?: FrameSourceState.OFF
|
|
174
|
+
return
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
lastFrameSourceState = FrameSourceStateDeserializer.fromJson(desiredStateJson)
|
|
178
|
+
checkOrRequestCameraPermissions(call)
|
|
185
179
|
}
|
|
186
180
|
//endregion
|
|
187
181
|
|
|
188
182
|
//region DataCaptureContextProxy
|
|
189
183
|
@PluginMethod
|
|
190
184
|
fun contextFromJSON(call: PluginCall) {
|
|
191
|
-
initializeContextFromJson(call)
|
|
192
|
-
checkOrRequestInitialCameraPermission(call)
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
private fun initializeContextFromJson(call: PluginCall) {
|
|
196
185
|
val jsonString = call.data.getString("context")
|
|
197
186
|
?: return call.reject(EMPTY_STRING_ERROR)
|
|
198
187
|
coreModule.createContextFromJson(jsonString, CapacitorResult(call))
|
|
@@ -208,9 +197,7 @@ class ScanditCaptureCoreNative :
|
|
|
208
197
|
}
|
|
209
198
|
|
|
210
199
|
@PluginMethod
|
|
211
|
-
fun updateContextFromJSON(call: PluginCall)
|
|
212
|
-
|
|
213
|
-
private fun updateContext(call: PluginCall) {
|
|
200
|
+
fun updateContextFromJSON(call: PluginCall) {
|
|
214
201
|
val jsonString = call.data.getString("context")
|
|
215
202
|
?: return call.reject(EMPTY_STRING_ERROR)
|
|
216
203
|
|
package/dist/core.js
CHANGED
|
@@ -989,6 +989,16 @@ 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
|
+
|
|
992
1002
|
var DataCaptureContextEvents;
|
|
993
1003
|
(function (DataCaptureContextEvents) {
|
|
994
1004
|
DataCaptureContextEvents["didChangeStatus"] = "DataCaptureContextListener.onStatusChanged";
|
|
@@ -1050,7 +1060,9 @@ class DataCaptureContextController {
|
|
|
1050
1060
|
initializeContextFromJSON() {
|
|
1051
1061
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1052
1062
|
try {
|
|
1053
|
-
yield this._proxy.contextFromJSON(this.context);
|
|
1063
|
+
const featureFlagsString = yield this._proxy.contextFromJSON(this.context);
|
|
1064
|
+
DataCaptureContextFeatures.featureFlags =
|
|
1065
|
+
JSON.parse(featureFlagsString);
|
|
1054
1066
|
}
|
|
1055
1067
|
catch (error) {
|
|
1056
1068
|
this.notifyListenersOfDeserializationError(error);
|
|
@@ -2903,5 +2915,5 @@ var Expiration;
|
|
|
2903
2915
|
|
|
2904
2916
|
createEventEmitter();
|
|
2905
2917
|
|
|
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 };
|
|
2918
|
+
export { AimerViewfinder, Anchor, BaseController, BaseDataCaptureView, BaseNativeProxy, Brush, Camera, CameraController, CameraPosition, CameraSettings, Color, ContextStatus, ControlImage, DataCaptureContext, DataCaptureContextEvents, DataCaptureContextFeatures, 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 };
|
|
2907
2919
|
//# sourceMappingURL=core.js.map
|