scandit-react-native-datacapture-id 6.18.2 → 6.19.0-beta.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/THIRD_PARTY_OCR.txt +2 -2
- package/android/build.gradle +6 -2
- package/android/src/main/kotlin/com/scandit/datacapture/reactnative/id/ScanditDataCaptureIdModule.kt +18 -91
- package/android/src/main/kotlin/com/scandit/datacapture/reactnative/id/ScanditDataCaptureIdPackage.kt +12 -1
- package/ios/Sources/ScanditDataCaptureId+Defaults.swift +5 -9
- package/ios/Sources/ScanditDataCaptureId+Events.swift +11 -5
- package/js/native/IdCaptureListenerProxy.d.ts +1 -1
- package/js/native/IdCaptureListenerProxy.js +14 -10
- package/js/native/IdCaptureListenerProxy.js.map +1 -1
- package/js/private/Defaults.js +10 -10
- package/js/private/Defaults.js.map +1 -1
- package/js/private/PrivateIdCaptureSession.d.ts +3 -0
- package/package.json +2 -2
- package/scandit-react-native-datacapture-id.podspec +2 -1
- package/android/src/main/kotlin/com/scandit/datacapture/reactnative/id/data/defaults/IdCaptureOverlayDefaults.kt +0 -41
- package/android/src/main/kotlin/com/scandit/datacapture/reactnative/id/data/defaults/SerializableIdCaptureDefaults.kt +0 -28
- package/android/src/main/kotlin/com/scandit/datacapture/reactnative/id/data/defaults/SerializableIdDefaults.kt +0 -23
- package/android/src/main/kotlin/com/scandit/datacapture/reactnative/id/listener/RCTIdCaptureListener.kt +0 -137
package/THIRD_PARTY_OCR.txt
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
ScanditOCR /
|
|
1
|
+
ScanditOCR / ScanditTextCaptureBackend / ScanditIdCaptureBackend includes components licensed under the following licenses:
|
|
2
2
|
|
|
3
3
|
================================================================================================
|
|
4
4
|
By downloading, copying, installing or using the software you agree to this license.
|
|
@@ -448,5 +448,5 @@ Exhibit B - "Incompatible With Secondary Licenses" Notice
|
|
|
448
448
|
|
|
449
449
|
================================================================================================
|
|
450
450
|
|
|
451
|
-
The unchanged source code for Eigen used in ScanditOCR/
|
|
451
|
+
The unchanged source code for Eigen used in ScanditOCR/ScanditTextCaptureBackend/ScanditIdCaptureBackend can be found at
|
|
452
452
|
https://github.com/eigenteam/eigen-git-mirror
|
package/android/build.gradle
CHANGED
|
@@ -42,10 +42,14 @@ android {
|
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
dependencies {
|
|
45
|
-
def sdk_version = "6.
|
|
45
|
+
def sdk_version = "6.19.0-beta.0"
|
|
46
46
|
|
|
47
47
|
println("Version of the native sdk used in this build: ${safeExtGet('global_sdk_version', sdk_version)}")
|
|
48
|
-
|
|
48
|
+
if (findProject(':scandit-datacapture-frameworks-id') != null) {
|
|
49
|
+
api project(":scandit-datacapture-frameworks-id")
|
|
50
|
+
} else {
|
|
51
|
+
api "com.scandit.datacapture.frameworks:id:${safeExtGet('global_sdk_version', sdk_version)}"
|
|
52
|
+
}
|
|
49
53
|
api project(path: ':scandit-react-native-datacapture-core')
|
|
50
54
|
|
|
51
55
|
//noinspection GradleDynamicVersion
|
package/android/src/main/kotlin/com/scandit/datacapture/reactnative/id/ScanditDataCaptureIdModule.kt
CHANGED
|
@@ -10,145 +10,72 @@ import com.facebook.react.bridge.Promise
|
|
|
10
10
|
import com.facebook.react.bridge.ReactApplicationContext
|
|
11
11
|
import com.facebook.react.bridge.ReactContextBaseJavaModule
|
|
12
12
|
import com.facebook.react.bridge.ReactMethod
|
|
13
|
-
import com.
|
|
14
|
-
import com.scandit.datacapture.core.
|
|
15
|
-
import com.scandit.datacapture.core.capture.DataCaptureContextListener
|
|
16
|
-
import com.scandit.datacapture.core.json.JsonValue
|
|
17
|
-
import com.scandit.datacapture.frameworks.core.deserialization.DeserializationLifecycleObserver
|
|
18
|
-
import com.scandit.datacapture.frameworks.core.deserialization.Deserializers
|
|
19
|
-
import com.scandit.datacapture.id.capture.IdCapture
|
|
20
|
-
import com.scandit.datacapture.id.capture.IdCaptureListener
|
|
21
|
-
import com.scandit.datacapture.id.capture.serialization.IdCaptureDeserializer
|
|
22
|
-
import com.scandit.datacapture.id.capture.serialization.IdCaptureDeserializerListener
|
|
23
|
-
import com.scandit.datacapture.id.ui.overlay.IdCaptureOverlay
|
|
24
|
-
import com.scandit.datacapture.reactnative.core.data.defaults.SerializableCameraSettingsDefaults
|
|
25
|
-
import com.scandit.datacapture.reactnative.core.utils.LazyEventEmitter
|
|
26
|
-
import com.scandit.datacapture.reactnative.id.data.defaults.IdCaptureOverlayDefaults
|
|
27
|
-
import com.scandit.datacapture.reactnative.id.data.defaults.SerializableIdCaptureDefaults
|
|
28
|
-
import com.scandit.datacapture.reactnative.id.data.defaults.SerializableIdDefaults
|
|
29
|
-
import com.scandit.datacapture.reactnative.id.listener.RCTIdCaptureListener
|
|
13
|
+
import com.scandit.datacapture.frameworks.id.IdCaptureModule
|
|
14
|
+
import com.scandit.datacapture.reactnative.core.utils.ReactNativeResult
|
|
30
15
|
|
|
31
16
|
class ScanditDataCaptureIdModule(
|
|
32
17
|
reactContext: ReactApplicationContext,
|
|
33
|
-
private val
|
|
34
|
-
|
|
35
|
-
private val idCaptureListener: RCTIdCaptureListener =
|
|
36
|
-
RCTIdCaptureListener(eventEmitter)
|
|
37
|
-
) : ReactContextBaseJavaModule(reactContext),
|
|
38
|
-
IdCaptureDeserializerListener,
|
|
39
|
-
IdCaptureListener by idCaptureListener,
|
|
40
|
-
DataCaptureContextListener,
|
|
41
|
-
DeserializationLifecycleObserver.Observer {
|
|
18
|
+
private val idCaptureModule: IdCaptureModule,
|
|
19
|
+
) : ReactContextBaseJavaModule(reactContext) {
|
|
42
20
|
|
|
43
21
|
override fun getName(): String = "ScanditDataCaptureId"
|
|
44
22
|
|
|
45
23
|
init {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
DeserializationLifecycleObserver.attach(this)
|
|
24
|
+
// automatically register listeners
|
|
25
|
+
idCaptureModule.addListener()
|
|
49
26
|
}
|
|
50
27
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
field = value?.also { it.addListener(this) }
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
private var dataCaptureContext: DataCaptureContext? = null
|
|
58
|
-
private set(value) {
|
|
59
|
-
field?.removeListener(this)
|
|
60
|
-
field = value?.also { it.addListener(this) }
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
override fun onCatalystInstanceDestroy() {
|
|
64
|
-
DeserializationLifecycleObserver.detach(this)
|
|
65
|
-
Deserializers.Factory.removeModeDeserializer(idCaptureDeserializer)
|
|
66
|
-
idCaptureDeserializer.listener = this
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
override fun onModeDeserializationFinished(
|
|
70
|
-
deserializer: IdCaptureDeserializer,
|
|
71
|
-
mode: IdCapture,
|
|
72
|
-
json: JsonValue
|
|
73
|
-
) {
|
|
74
|
-
idCapture = mode.also {
|
|
75
|
-
if (json.contains("enabled")) {
|
|
76
|
-
it.isEnabled = json.requireByKeyAsBoolean("enabled")
|
|
77
|
-
}
|
|
78
|
-
}
|
|
28
|
+
override fun invalidate() {
|
|
29
|
+
idCaptureModule.onDestroy()
|
|
30
|
+
super.invalidate()
|
|
79
31
|
}
|
|
80
32
|
|
|
81
33
|
@ReactMethod
|
|
82
34
|
fun reset() {
|
|
83
|
-
|
|
35
|
+
idCaptureModule.resetMode()
|
|
84
36
|
}
|
|
85
37
|
|
|
86
38
|
@ReactMethod
|
|
87
39
|
fun finishDidCaptureCallback(enabled: Boolean) {
|
|
88
|
-
|
|
40
|
+
idCaptureModule.finishDidCaptureId(enabled)
|
|
89
41
|
}
|
|
90
42
|
|
|
91
43
|
@ReactMethod
|
|
92
44
|
fun finishDidLocalizeCallback(enabled: Boolean) {
|
|
93
|
-
|
|
45
|
+
idCaptureModule.finishDidLocalizeId(enabled)
|
|
94
46
|
}
|
|
95
47
|
|
|
96
48
|
@ReactMethod
|
|
97
49
|
fun finishDidRejectCallback(enabled: Boolean) {
|
|
98
|
-
|
|
50
|
+
idCaptureModule.finishDidRejectId(enabled)
|
|
99
51
|
}
|
|
100
52
|
|
|
101
53
|
@ReactMethod
|
|
102
54
|
fun finishDidTimeOutCallback(enabled: Boolean) {
|
|
103
|
-
|
|
55
|
+
idCaptureModule.finishDidTimeout(enabled)
|
|
104
56
|
}
|
|
105
57
|
|
|
106
58
|
@ReactMethod
|
|
107
59
|
fun verifyCapturedId(capturedIdJSON: String, promise: Promise) {
|
|
108
|
-
|
|
60
|
+
idCaptureModule.verifyCaptureId(capturedIdJSON, ReactNativeResult(promise))
|
|
109
61
|
}
|
|
110
62
|
|
|
111
63
|
@Suppress("UNUSED_PARAMETER")
|
|
112
64
|
@ReactMethod
|
|
113
65
|
fun createContextForCloudVerification(contextJSON: String, promise: Promise) {
|
|
114
|
-
|
|
66
|
+
idCaptureModule.createContextForCloudVerification(ReactNativeResult(promise))
|
|
115
67
|
}
|
|
116
68
|
|
|
117
69
|
@ReactMethod
|
|
118
70
|
fun verifyCapturedIdAsync(capturedIdJSON: String, promise: Promise) {
|
|
119
|
-
|
|
71
|
+
idCaptureModule.verifyCapturedIdCloud(capturedIdJSON, ReactNativeResult(promise))
|
|
120
72
|
}
|
|
121
73
|
|
|
122
74
|
override fun getConstants(): MutableMap<String, Any> = mutableMapOf(
|
|
123
|
-
DEFAULTS_KEY to
|
|
75
|
+
DEFAULTS_KEY to idCaptureModule.getDefaults()
|
|
124
76
|
)
|
|
125
77
|
|
|
126
|
-
override fun onDataCaptureContextDeserialized(dataCaptureContext: DataCaptureContext) {
|
|
127
|
-
this.dataCaptureContext = dataCaptureContext
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
override fun onDataCaptureContextDisposed() {
|
|
131
|
-
idCaptureListener.finishDidCaptureCallback(false)
|
|
132
|
-
idCapture = null
|
|
133
|
-
dataCaptureContext = null
|
|
134
|
-
}
|
|
135
|
-
|
|
136
78
|
companion object {
|
|
137
79
|
private const val DEFAULTS_KEY = "Defaults"
|
|
138
|
-
|
|
139
|
-
private val DEFAULTS: SerializableIdDefaults by lazy {
|
|
140
|
-
SerializableIdDefaults(
|
|
141
|
-
SerializableIdCaptureDefaults(
|
|
142
|
-
recommendedCameraSettings = SerializableCameraSettingsDefaults(
|
|
143
|
-
IdCapture.createRecommendedCameraSettings()
|
|
144
|
-
),
|
|
145
|
-
idCaptureOverlayDefaults = IdCaptureOverlayDefaults(
|
|
146
|
-
IdCaptureOverlay.defaultCapturedBrush(),
|
|
147
|
-
IdCaptureOverlay.defaultLocalizedBrush(),
|
|
148
|
-
IdCaptureOverlay.defaultRejectedBrush(),
|
|
149
|
-
)
|
|
150
|
-
)
|
|
151
|
-
)
|
|
152
|
-
}
|
|
153
80
|
}
|
|
154
81
|
}
|
|
@@ -10,13 +10,24 @@ import com.facebook.react.ReactPackage
|
|
|
10
10
|
import com.facebook.react.bridge.NativeModule
|
|
11
11
|
import com.facebook.react.bridge.ReactApplicationContext
|
|
12
12
|
import com.facebook.react.uimanager.ViewManager
|
|
13
|
+
import com.scandit.datacapture.frameworks.id.IdCaptureModule
|
|
14
|
+
import com.scandit.datacapture.frameworks.id.listeners.FrameworksIdCaptureListener
|
|
15
|
+
import com.scandit.datacapture.reactnative.core.utils.ReactNativeEventEmitter
|
|
13
16
|
|
|
14
17
|
class ScanditDataCaptureIdPackage : ReactPackage {
|
|
15
18
|
override fun createNativeModules(
|
|
16
19
|
reactContext: ReactApplicationContext
|
|
17
|
-
): MutableList<NativeModule> =
|
|
20
|
+
): MutableList<NativeModule> =
|
|
21
|
+
mutableListOf(ScanditDataCaptureIdModule(reactContext, getIdCaptureModule(reactContext)))
|
|
18
22
|
|
|
19
23
|
override fun createViewManagers(
|
|
20
24
|
reactContext: ReactApplicationContext
|
|
21
25
|
): MutableList<ViewManager<*, *>> = mutableListOf()
|
|
26
|
+
|
|
27
|
+
private fun getIdCaptureModule(reactContext: ReactApplicationContext): IdCaptureModule {
|
|
28
|
+
val emitter = ReactNativeEventEmitter(reactContext)
|
|
29
|
+
return IdCaptureModule(FrameworksIdCaptureListener(emitter)).also {
|
|
30
|
+
it.onCreate(reactContext)
|
|
31
|
+
}
|
|
32
|
+
}
|
|
22
33
|
}
|
|
@@ -10,17 +10,13 @@ import ScanditDataCaptureCore
|
|
|
10
10
|
|
|
11
11
|
extension ScanditDataCaptureId {
|
|
12
12
|
override func constantsToExport() -> [AnyHashable: Any]! {
|
|
13
|
-
return ["Defaults":
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
var defaults: [String: Any] {
|
|
17
|
-
return ["IdCapture": idCaptureDefaults]
|
|
13
|
+
return ["Defaults": idCaptureDefaults]
|
|
18
14
|
}
|
|
19
15
|
|
|
20
16
|
var idCaptureDefaults: [String: Any] {
|
|
21
17
|
return [
|
|
22
18
|
"RecommendedCameraSettings": recommendedCameraSettings,
|
|
23
|
-
"
|
|
19
|
+
"IdCaptureOverlay": idCaptureOverlayDefaults
|
|
24
20
|
]
|
|
25
21
|
}
|
|
26
22
|
|
|
@@ -30,9 +26,9 @@ extension ScanditDataCaptureId {
|
|
|
30
26
|
|
|
31
27
|
var idCaptureOverlayDefaults: [AnyHashable: Any] {
|
|
32
28
|
return [
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"
|
|
29
|
+
"DefaultCapturedBrush": IdCaptureOverlay.defaultCapturedBrush.rntsdc_dictionary,
|
|
30
|
+
"DefaultLocalizedBrush": IdCaptureOverlay.defaultLocalizedBrush.rntsdc_dictionary,
|
|
31
|
+
"DefaultRejectedBrush": IdCaptureOverlay.defaultRejectedBrush.rntsdc_dictionary
|
|
36
32
|
]
|
|
37
33
|
}
|
|
38
34
|
}
|
|
@@ -7,10 +7,10 @@
|
|
|
7
7
|
import Foundation
|
|
8
8
|
|
|
9
9
|
enum ScanditDataCaptureIdEvent: String, CaseIterable {
|
|
10
|
-
case didCapture = "
|
|
11
|
-
case didLocalize = "
|
|
12
|
-
case didReject = "
|
|
13
|
-
case didTimeOut = "
|
|
10
|
+
case didCapture = "IdCaptureListener.didCaptureId"
|
|
11
|
+
case didLocalize = "IdCaptureListener.didLocalizeId"
|
|
12
|
+
case didReject = "IdCaptureListener.didRejectId"
|
|
13
|
+
case didTimeOut = "IdCaptureListener.didTimeout"
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
extension ScanditDataCaptureId {
|
|
@@ -30,7 +30,13 @@ extension ScanditDataCaptureId {
|
|
|
30
30
|
|
|
31
31
|
func sendEvent(withName name: ScanditDataCaptureIdEvent, body: Any!) -> Bool {
|
|
32
32
|
guard hasListeners else { return false }
|
|
33
|
-
|
|
33
|
+
do {
|
|
34
|
+
let bodyData = try JSONSerialization.data(withJSONObject: body, options: [])
|
|
35
|
+
let jsonBody = String(data: bodyData, encoding: .utf8)
|
|
36
|
+
sendEvent(withName: name.rawValue, body: jsonBody)
|
|
37
|
+
} catch {
|
|
38
|
+
sendEvent(withName: name.rawValue, body: body)
|
|
39
|
+
}
|
|
34
40
|
return true
|
|
35
41
|
}
|
|
36
42
|
}
|
|
@@ -2,7 +2,7 @@ import { IdCapture } from '../IdCapture';
|
|
|
2
2
|
export declare class IdCaptureListenerProxy {
|
|
3
3
|
private mode;
|
|
4
4
|
private nativeListeners;
|
|
5
|
-
static forIdCapture(
|
|
5
|
+
static forIdCapture(idCapture: IdCapture): IdCaptureListenerProxy;
|
|
6
6
|
subscribeListener(): void;
|
|
7
7
|
unsubscribeListener(): void;
|
|
8
8
|
private notifyListenersOfDidCapture;
|
|
@@ -10,42 +10,46 @@ var EventEmitter = new react_native_1.NativeEventEmitter(NativeModule);
|
|
|
10
10
|
// tslint:enable:variable-name
|
|
11
11
|
var IdCaptureListenerEventName;
|
|
12
12
|
(function (IdCaptureListenerEventName) {
|
|
13
|
-
IdCaptureListenerEventName["didCapture"] = "
|
|
14
|
-
IdCaptureListenerEventName["didLocalize"] = "
|
|
15
|
-
IdCaptureListenerEventName["didReject"] = "
|
|
16
|
-
IdCaptureListenerEventName["didTimeOut"] = "
|
|
13
|
+
IdCaptureListenerEventName["didCapture"] = "IdCaptureListener.didCaptureId";
|
|
14
|
+
IdCaptureListenerEventName["didLocalize"] = "IdCaptureListener.didLocalizeId";
|
|
15
|
+
IdCaptureListenerEventName["didReject"] = "IdCaptureListener.didRejectId";
|
|
16
|
+
IdCaptureListenerEventName["didTimeOut"] = "IdCaptureListener.didTimeout";
|
|
17
17
|
})(IdCaptureListenerEventName || (IdCaptureListenerEventName = {}));
|
|
18
18
|
var IdCaptureListenerProxy = /** @class */ (function () {
|
|
19
19
|
function IdCaptureListenerProxy() {
|
|
20
20
|
this.nativeListeners = [];
|
|
21
21
|
}
|
|
22
|
-
IdCaptureListenerProxy.forIdCapture = function (
|
|
22
|
+
IdCaptureListenerProxy.forIdCapture = function (idCapture) {
|
|
23
23
|
var proxy = new IdCaptureListenerProxy();
|
|
24
|
-
proxy.mode =
|
|
24
|
+
proxy.mode = idCapture;
|
|
25
25
|
return proxy;
|
|
26
26
|
};
|
|
27
27
|
IdCaptureListenerProxy.prototype.subscribeListener = function () {
|
|
28
28
|
var _this = this;
|
|
29
29
|
var didCaptureListener = EventEmitter.addListener(IdCaptureListenerEventName.didCapture, function (body) {
|
|
30
|
-
var
|
|
30
|
+
var payload = JSON.parse(body);
|
|
31
|
+
var session = IdCaptureSession_1.IdCaptureSession.fromJSON(JSON.parse(payload.session));
|
|
31
32
|
_this.notifyListenersOfDidCapture(session);
|
|
32
33
|
NativeModule.finishDidCaptureCallback(_this.mode.isEnabled);
|
|
33
34
|
});
|
|
34
35
|
this.nativeListeners.push(didCaptureListener);
|
|
35
36
|
var didLocalizeListener = EventEmitter.addListener(IdCaptureListenerEventName.didLocalize, function (body) {
|
|
36
|
-
var
|
|
37
|
+
var payload = JSON.parse(body);
|
|
38
|
+
var session = IdCaptureSession_1.IdCaptureSession.fromJSON(JSON.parse(payload.session));
|
|
37
39
|
_this.notifyListenersOfDidLocalize(session);
|
|
38
40
|
NativeModule.finishDidLocalizeCallback(_this.mode.isEnabled);
|
|
39
41
|
});
|
|
40
42
|
this.nativeListeners.push(didLocalizeListener);
|
|
41
43
|
var didRejectListener = EventEmitter.addListener(IdCaptureListenerEventName.didReject, function (body) {
|
|
42
|
-
var
|
|
44
|
+
var payload = JSON.parse(body);
|
|
45
|
+
var session = IdCaptureSession_1.IdCaptureSession.fromJSON(JSON.parse(payload.session));
|
|
43
46
|
_this.notifyListenersOfDidReject(session);
|
|
44
47
|
NativeModule.finishDidRejectCallback(_this.mode.isEnabled);
|
|
45
48
|
});
|
|
46
49
|
this.nativeListeners.push(didRejectListener);
|
|
47
50
|
var didTimeOutListener = EventEmitter.addListener(IdCaptureListenerEventName.didTimeOut, function (body) {
|
|
48
|
-
var
|
|
51
|
+
var payload = JSON.parse(body);
|
|
52
|
+
var session = IdCaptureSession_1.IdCaptureSession.fromJSON(JSON.parse(payload.session));
|
|
49
53
|
_this.notifyListenersOfDidTimeOut(session);
|
|
50
54
|
NativeModule.finishDidTimeOutCallback(_this.mode.isEnabled);
|
|
51
55
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IdCaptureListenerProxy.js","sourceRoot":"","sources":["../../ts/native/IdCaptureListenerProxy.ts"],"names":[],"mappings":";;;AAAA,6CAAsF;AACtF,2FAA0F;AAI1F,wDAAuD;AAIvD,+BAA+B;AAC/B,IAAM,YAAY,GAAG,4BAAa,CAAC,oBAAoB,CAAC;AACxD,IAAM,YAAY,GAAG,IAAI,iCAAkB,CAAC,YAAY,CAAC,CAAC;AAC1D,8BAA8B;AAE9B,IAAK,0BAKJ;AALD,WAAK,0BAA0B;IAC7B,
|
|
1
|
+
{"version":3,"file":"IdCaptureListenerProxy.js","sourceRoot":"","sources":["../../ts/native/IdCaptureListenerProxy.ts"],"names":[],"mappings":";;;AAAA,6CAAsF;AACtF,2FAA0F;AAI1F,wDAAuD;AAIvD,+BAA+B;AAC/B,IAAM,YAAY,GAAG,4BAAa,CAAC,oBAAoB,CAAC;AACxD,IAAM,YAAY,GAAG,IAAI,iCAAkB,CAAC,YAA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AAC,WAAW,CAAC,KAAI,CAAC,IAAI,EAAE,OAAO,EAAE,yBAAW,CAAC,YAAY,CAAC,CAAC;aACpE;QACH,CAAC,CAAC,CAAC;QACH,IAAI,CAAC,oBAAoB,GAAG,KAAK,CAAC;IACpC,CAAC;IAEO,4DAA2B,GAAnC,UAAoC,OAAyB;QAA7D,iBAaC;QAZC,IAAM,IAAI,GAAG,IAAI,CAAC,IAA+B,CAAC;QAClD,IAAI,CAAC,oBAAoB,GAAG,IAAI,CAAC;QACjC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,UAAA,QAAQ;YAC7B,IAAI,QAAQ,CAAC,mBAAmB,EAAE;gBAChC,QAAQ,CAAC,mBAAmB,CAC1B,KAAI,CAAC,IAAI,EACT,OAAO,EACP,yBAAW,CAAC,YAAY,CACzB,CAAC;aACH;QACH,CAAC,CAAC,CAAC;QACH,IAAI,CAAC,oBAAoB,GAAG,KAAK,CAAC;IACpC,CAAC;IACH,6BAAC;AAAD,CAAC,AAjHD,IAiHC;AAjHY,wDAAsB"}
|
package/js/private/Defaults.js
CHANGED
|
@@ -10,28 +10,28 @@ var NativeModule = react_native_1.NativeModules.ScanditDataCaptureId;
|
|
|
10
10
|
exports.Defaults = {
|
|
11
11
|
IdCapture: {
|
|
12
12
|
RecommendedCameraSettings: Camera_Related_1.CameraSettings
|
|
13
|
-
.fromJSON(NativeModule.Defaults.
|
|
13
|
+
.fromJSON(NativeModule.Defaults.RecommendedCameraSettings),
|
|
14
14
|
IdCaptureOverlayDefaults: {
|
|
15
15
|
defaultCapturedBrush: {
|
|
16
16
|
fillColor: Common_1.Color
|
|
17
|
-
.fromJSON(NativeModule.Defaults.
|
|
17
|
+
.fromJSON(NativeModule.Defaults.IdCaptureOverlay.DefaultCapturedBrush.fillColor),
|
|
18
18
|
strokeColor: Common_1.Color
|
|
19
|
-
.fromJSON(NativeModule.Defaults.
|
|
20
|
-
strokeWidth: NativeModule.Defaults.
|
|
19
|
+
.fromJSON(NativeModule.Defaults.IdCaptureOverlay.DefaultCapturedBrush.strokeColor),
|
|
20
|
+
strokeWidth: NativeModule.Defaults.IdCaptureOverlay.DefaultCapturedBrush.strokeWidth,
|
|
21
21
|
},
|
|
22
22
|
defaultLocalizedBrush: {
|
|
23
23
|
fillColor: Common_1.Color
|
|
24
|
-
.fromJSON(NativeModule.Defaults.
|
|
24
|
+
.fromJSON(NativeModule.Defaults.IdCaptureOverlay.DefaultLocalizedBrush.fillColor),
|
|
25
25
|
strokeColor: Common_1.Color
|
|
26
|
-
.fromJSON(NativeModule.Defaults.
|
|
27
|
-
strokeWidth: NativeModule.Defaults.
|
|
26
|
+
.fromJSON(NativeModule.Defaults.IdCaptureOverlay.DefaultLocalizedBrush.strokeColor),
|
|
27
|
+
strokeWidth: NativeModule.Defaults.IdCaptureOverlay.DefaultLocalizedBrush.strokeWidth,
|
|
28
28
|
},
|
|
29
29
|
defaultRejectedBrush: {
|
|
30
30
|
fillColor: Common_1.Color
|
|
31
|
-
.fromJSON(NativeModule.Defaults.
|
|
31
|
+
.fromJSON(NativeModule.Defaults.IdCaptureOverlay.DefaultRejectedBrush.fillColor),
|
|
32
32
|
strokeColor: Common_1.Color
|
|
33
|
-
.fromJSON(NativeModule.Defaults.
|
|
34
|
-
strokeWidth: NativeModule.Defaults.
|
|
33
|
+
.fromJSON(NativeModule.Defaults.IdCaptureOverlay.DefaultRejectedBrush.strokeColor),
|
|
34
|
+
strokeWidth: NativeModule.Defaults.IdCaptureOverlay.DefaultRejectedBrush.strokeWidth,
|
|
35
35
|
},
|
|
36
36
|
},
|
|
37
37
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Defaults.js","sourceRoot":"","sources":["../../ts/private/Defaults.ts"],"names":[],"mappings":";;;AAAA,6CAA6C;AAC7C,0FAAyF;AAEzF,0EAAwE;AAGxE,yCAAyC;AACzC,IAAM,YAAY,GAAG,4BAAa,CAAC,oBAAoB,CAAC;AAExD,yCAAyC;AAC5B,QAAA,Q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AC,oBAAoB,CAAC,SAAS,CAAC;gBACpF,WAAW,EAAG,cAA6B;qBACtC,QAAQ,CAAC,YAAY,CAAC,QAAQ,CAAC,gBAAgB,CAAC,oBAAoB,CAAC,WAAW,CAAC;gBACtF,WAAW,EAAE,YAAY,CAAC,QAAQ,CAAC,gBAAgB,CAAC,oBAAoB,CAAC,WAAW;aACvF;SACJ;KACF;CACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "scandit-react-native-datacapture-id",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.19.0-beta.0",
|
|
4
4
|
"description": "Scandit Data Capture SDK for React Native",
|
|
5
5
|
"homepage": "https://github.com/Scandit/scandit-react-native-datacapture-id",
|
|
6
6
|
"main": "js/index.js",
|
|
@@ -29,6 +29,6 @@
|
|
|
29
29
|
"typescript": "^3.8.3"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"scandit-react-native-datacapture-core": "6.
|
|
32
|
+
"scandit-react-native-datacapture-core": "6.19.0-beta.0"
|
|
33
33
|
}
|
|
34
34
|
}
|
|
@@ -16,7 +16,8 @@ Pod::Spec.new do |s|
|
|
|
16
16
|
s.requires_arc = true
|
|
17
17
|
s.module_name = "ScanditDataCaptureId"
|
|
18
18
|
s.header_dir = "ScanditDataCaptureId"
|
|
19
|
-
s.dependency 'ScanditIdCapture', '= 6.
|
|
19
|
+
s.dependency 'ScanditIdCapture', '= 6.19.0-beta.0'
|
|
20
|
+
s.dependency 'ScanditIDC', '= 6.19.0-beta.0'
|
|
20
21
|
|
|
21
22
|
s.dependency "React"
|
|
22
23
|
s.dependency "scandit-react-native-datacapture-core"
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* This file is part of the Scandit Data Capture SDK
|
|
3
|
-
*
|
|
4
|
-
* Copyright (C) 2021- Scandit AG. All rights reserved.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
package com.scandit.datacapture.reactnative.id.data.defaults
|
|
8
|
-
|
|
9
|
-
import com.scandit.datacapture.core.ui.style.Brush
|
|
10
|
-
import com.scandit.datacapture.reactnative.core.data.defaults.SerializableBrushDefaults
|
|
11
|
-
import com.scandit.datacapture.reactnative.core.data.defaults.SerializableWritableMap
|
|
12
|
-
import org.json.JSONObject
|
|
13
|
-
|
|
14
|
-
class IdCaptureOverlayDefaults(
|
|
15
|
-
private val defaultCapturedBrush: Brush,
|
|
16
|
-
private val defaultLocalizedBrush: Brush,
|
|
17
|
-
private val defaultRejectedBrush: Brush,
|
|
18
|
-
) {
|
|
19
|
-
|
|
20
|
-
fun defaultsMap(): SerializableWritableMap {
|
|
21
|
-
val map = mutableMapOf<String, JSONObject>()
|
|
22
|
-
|
|
23
|
-
map[FIELD_DEFAULT_CAPTURED_BRUSH] = SerializableBrushDefaults(
|
|
24
|
-
defaultCapturedBrush
|
|
25
|
-
).toJSONObject()
|
|
26
|
-
map[FIELD_DEFAULT_LOCALIZED_BRUSH] = SerializableBrushDefaults(
|
|
27
|
-
defaultLocalizedBrush
|
|
28
|
-
).toJSONObject()
|
|
29
|
-
map[FIELD_DEFAULT_REJECTED_BRUSH] = SerializableBrushDefaults(
|
|
30
|
-
defaultRejectedBrush
|
|
31
|
-
).toJSONObject()
|
|
32
|
-
|
|
33
|
-
return SerializableWritableMap(JSONObject(map as Map<String, JSONObject>))
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
private companion object {
|
|
37
|
-
private const val FIELD_DEFAULT_CAPTURED_BRUSH = "defaultCapturedBrush"
|
|
38
|
-
private const val FIELD_DEFAULT_LOCALIZED_BRUSH = "defaultLocalizedBrush"
|
|
39
|
-
private const val FIELD_DEFAULT_REJECTED_BRUSH = "defaultRejectedBrush"
|
|
40
|
-
}
|
|
41
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* This file is part of the Scandit Data Capture SDK
|
|
3
|
-
*
|
|
4
|
-
* Copyright (C) 2021- Scandit AG. All rights reserved.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
package com.scandit.datacapture.reactnative.id.data.defaults
|
|
8
|
-
|
|
9
|
-
import com.scandit.datacapture.reactnative.core.data.SerializableData
|
|
10
|
-
import com.scandit.datacapture.reactnative.core.data.defaults.SerializableCameraSettingsDefaults
|
|
11
|
-
import com.scandit.datacapture.reactnative.core.utils.putData
|
|
12
|
-
import com.scandit.datacapture.reactnative.core.utils.writableMap
|
|
13
|
-
|
|
14
|
-
class SerializableIdCaptureDefaults(
|
|
15
|
-
private val recommendedCameraSettings: SerializableCameraSettingsDefaults,
|
|
16
|
-
private val idCaptureOverlayDefaults: IdCaptureOverlayDefaults,
|
|
17
|
-
) : SerializableData {
|
|
18
|
-
|
|
19
|
-
override fun toWritableMap() = writableMap {
|
|
20
|
-
putMap(FIELD_RECOMMENDED_CAMERA_SETTINGS, recommendedCameraSettings.toWritableMap())
|
|
21
|
-
putData(FIELD_ID_CAPTURE_OVERLAY_DEFAULTS, idCaptureOverlayDefaults.defaultsMap())
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
private companion object {
|
|
25
|
-
const val FIELD_RECOMMENDED_CAMERA_SETTINGS = "RecommendedCameraSettings"
|
|
26
|
-
const val FIELD_ID_CAPTURE_OVERLAY_DEFAULTS = "IdCaptureOverlayDefaults"
|
|
27
|
-
}
|
|
28
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* This file is part of the Scandit Data Capture SDK
|
|
3
|
-
*
|
|
4
|
-
* Copyright (C) 2021- Scandit AG. All rights reserved.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
package com.scandit.datacapture.reactnative.id.data.defaults
|
|
8
|
-
|
|
9
|
-
import com.scandit.datacapture.reactnative.core.data.SerializableData
|
|
10
|
-
import com.scandit.datacapture.reactnative.core.utils.writableMap
|
|
11
|
-
|
|
12
|
-
class SerializableIdDefaults(
|
|
13
|
-
private val serializableIdCaptureDefaults: SerializableIdCaptureDefaults
|
|
14
|
-
) : SerializableData {
|
|
15
|
-
|
|
16
|
-
override fun toWritableMap() = writableMap {
|
|
17
|
-
putMap(FIELD_ID_CAPTURE_DEFAULTS, serializableIdCaptureDefaults.toWritableMap())
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
private companion object {
|
|
21
|
-
const val FIELD_ID_CAPTURE_DEFAULTS = "IdCapture"
|
|
22
|
-
}
|
|
23
|
-
}
|
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* This file is part of the Scandit Data Capture SDK
|
|
3
|
-
*
|
|
4
|
-
* Copyright (C) 2021- Scandit AG. All rights reserved.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
package com.scandit.datacapture.reactnative.id.listener
|
|
8
|
-
|
|
9
|
-
import com.facebook.react.bridge.Promise
|
|
10
|
-
import com.facebook.react.modules.core.DeviceEventManagerModule
|
|
11
|
-
import com.scandit.datacapture.core.capture.DataCaptureContext
|
|
12
|
-
import com.scandit.datacapture.core.data.FrameData
|
|
13
|
-
import com.scandit.datacapture.frameworks.core.utils.LastFrameData
|
|
14
|
-
import com.scandit.datacapture.id.capture.IdCapture
|
|
15
|
-
import com.scandit.datacapture.id.capture.IdCaptureListener
|
|
16
|
-
import com.scandit.datacapture.id.capture.IdCaptureSession
|
|
17
|
-
import com.scandit.datacapture.id.data.CapturedId
|
|
18
|
-
import com.scandit.datacapture.id.verification.aamvacloud.AamvaCloudVerifier
|
|
19
|
-
import com.scandit.datacapture.id.verification.aamvavizbarcode.AamvaVizBarcodeComparisonVerifier
|
|
20
|
-
import com.scandit.datacapture.reactnative.core.utils.EventWithResult
|
|
21
|
-
import com.scandit.datacapture.reactnative.core.utils.writableMap
|
|
22
|
-
import java.util.concurrent.atomic.AtomicReference
|
|
23
|
-
|
|
24
|
-
class RCTIdCaptureListener(
|
|
25
|
-
private val eventEmitter: DeviceEventManagerModule.RCTDeviceEventEmitter
|
|
26
|
-
) : IdCaptureListener {
|
|
27
|
-
|
|
28
|
-
private val latestSession: AtomicReference<IdCaptureSession?> = AtomicReference()
|
|
29
|
-
private var cloudVerifier: AamvaCloudVerifier? = null
|
|
30
|
-
|
|
31
|
-
private val onIdCaptured =
|
|
32
|
-
EventWithResult<Boolean>(ID_CAPTURE_DID_CAPTURE, eventEmitter)
|
|
33
|
-
private val onIdLocalized =
|
|
34
|
-
EventWithResult<Boolean>(ID_CAPTURE_DID_LOCALIZE, eventEmitter)
|
|
35
|
-
private val onIdRejected =
|
|
36
|
-
EventWithResult<Boolean>(ID_CAPTURE_DID_REJECT, eventEmitter)
|
|
37
|
-
private val onIdTimedOut =
|
|
38
|
-
EventWithResult<Boolean>(ID_CAPTURE_DID_TIMEOUT, eventEmitter)
|
|
39
|
-
|
|
40
|
-
override fun onIdCaptured(mode: IdCapture, session: IdCaptureSession, data: FrameData) {
|
|
41
|
-
latestSession.set(session)
|
|
42
|
-
LastFrameData.frameData.set(data)
|
|
43
|
-
val params = writableMap {
|
|
44
|
-
putString(FIELD_SESSION, session.toJson())
|
|
45
|
-
}
|
|
46
|
-
val enabled = onIdCaptured.emitForResult(params, mode.isEnabled)
|
|
47
|
-
mode.isEnabled = enabled
|
|
48
|
-
LastFrameData.frameData.set(null)
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
override fun onIdLocalized(mode: IdCapture, session: IdCaptureSession, data: FrameData) {
|
|
52
|
-
latestSession.set(session)
|
|
53
|
-
LastFrameData.frameData.set(data)
|
|
54
|
-
val params = writableMap {
|
|
55
|
-
putString(FIELD_SESSION, session.toJson())
|
|
56
|
-
}
|
|
57
|
-
val enabled = onIdLocalized.emitForResult(params, mode.isEnabled)
|
|
58
|
-
mode.isEnabled = enabled
|
|
59
|
-
LastFrameData.frameData.set(null)
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
override fun onIdRejected(mode: IdCapture, session: IdCaptureSession, data: FrameData) {
|
|
63
|
-
latestSession.set(session)
|
|
64
|
-
LastFrameData.frameData.set(data)
|
|
65
|
-
val params = writableMap {
|
|
66
|
-
putString(FIELD_SESSION, session.toJson())
|
|
67
|
-
}
|
|
68
|
-
val enabled = onIdRejected.emitForResult(params, mode.isEnabled)
|
|
69
|
-
mode.isEnabled = enabled
|
|
70
|
-
LastFrameData.frameData.set(null)
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
override fun onIdCaptureTimedOut(mode: IdCapture, session: IdCaptureSession, data: FrameData) {
|
|
74
|
-
latestSession.set(session)
|
|
75
|
-
LastFrameData.frameData.set(data)
|
|
76
|
-
val params = writableMap {
|
|
77
|
-
putString(FIELD_SESSION, session.toJson())
|
|
78
|
-
}
|
|
79
|
-
val enabled = onIdTimedOut.emitForResult(params, mode.isEnabled)
|
|
80
|
-
mode.isEnabled = enabled
|
|
81
|
-
LastFrameData.frameData.set(null)
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
fun finishDidCaptureCallback(enabled: Boolean) {
|
|
85
|
-
onIdCaptured.onResult(enabled)
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
fun finishDidLocalizeCallback(enabled: Boolean) {
|
|
89
|
-
onIdLocalized.onResult(enabled)
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
fun finishDidRejectCallback(enabled: Boolean) {
|
|
93
|
-
onIdRejected.onResult(enabled)
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
fun finishDidTimeOutCallback(enabled: Boolean) {
|
|
97
|
-
onIdTimedOut.onResult(enabled)
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
fun verifyCapturedId(capturedIdJSON: String, promise: Promise) {
|
|
101
|
-
val capturedId = CapturedId.fromJson(capturedIdJSON)
|
|
102
|
-
promise.resolve(AamvaVizBarcodeComparisonVerifier.create().verify(capturedId).toJson())
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
fun createContextForCloudVerification(promise: Promise, context: DataCaptureContext?) {
|
|
106
|
-
if (context == null) {
|
|
107
|
-
return promise.reject(
|
|
108
|
-
"createContextForCloudVerification",
|
|
109
|
-
"Data Capture Context not available"
|
|
110
|
-
)
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
cloudVerifier = AamvaCloudVerifier.create(context)
|
|
114
|
-
promise.resolve(null)
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
fun verifyCapturedIdAsync(capturedIdJSON: String, promise: Promise) {
|
|
118
|
-
val capturedId = CapturedId.fromJson(capturedIdJSON)
|
|
119
|
-
val verificationTask = cloudVerifier?.verify(capturedId)
|
|
120
|
-
|
|
121
|
-
verificationTask?.doOnVerificationResult { cloudResult ->
|
|
122
|
-
promise.resolve(cloudResult.toJson())
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
verificationTask?.doOnConnectionFailure { error ->
|
|
126
|
-
promise.reject("OnConnectionFailure", error.message)
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
companion object {
|
|
131
|
-
const val ID_CAPTURE_DID_CAPTURE = "idCaptureListener-didCapture"
|
|
132
|
-
const val ID_CAPTURE_DID_LOCALIZE = "idCaptureListener-didLocalize"
|
|
133
|
-
const val ID_CAPTURE_DID_REJECT = "idCaptureListener-didReject"
|
|
134
|
-
const val ID_CAPTURE_DID_TIMEOUT = "idCaptureListener-didTimeOut"
|
|
135
|
-
const val FIELD_SESSION = "session"
|
|
136
|
-
}
|
|
137
|
-
}
|