@regulaforensics/face-sdk 8.4.1336-rc → 8.4.1343-nightly
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/RNFaceSDK.podspec +2 -2
- package/android/build.gradle +2 -2
- package/android/cordova.gradle +2 -2
- package/android/src/main/{java → kotlin}/com/regula/plugin/facesdk/Config.kt +94 -90
- package/android/src/main/{java/com/regula/plugin/facesdk/Main.kt → kotlin/com/regula/plugin/facesdk/Implementation.kt} +63 -41
- package/android/src/main/{java → kotlin}/com/regula/plugin/facesdk/JSONConstructor.kt +123 -75
- package/android/src/main/{java → kotlin}/com/regula/plugin/facesdk/Utils.kt +18 -2
- package/examples/capacitor/package.json +2 -2
- package/examples/ionic/package.json +2 -2
- package/examples/react_native/package.json +2 -2
- package/ios/Config.swift +100 -104
- package/ios/Decoder.swift +85 -64
- package/ios/Utils.swift +3 -0
- package/package.json +1 -1
- package/plugin.xml +8 -8
- package/test/json.tsx +73 -61
- package/test/package-lock.json +2 -5
- package/test/test.tsx +8 -11
- package/www/capacitor/index.js +4 -11
- package/www/capacitor/liveness/enrollment_config.js +10 -16
- package/www/capacitor/liveness/enrollment_response.js +14 -10
- package/www/capacitor/liveness/liveness_exception.js +3 -3
- package/www/capacitor/liveness/verification_config.js +16 -4
- package/www/capacitor/liveness/{verify_match_response.js → verification_match_response.js} +5 -5
- package/www/capacitor/liveness/verification_response.js +9 -9
- package/www/capacitor/person_database/person.js +16 -7
- package/www/capacitor/person_database/search_person.js +9 -0
- package/www/capacitor/person_database/search_person_filter.js +44 -0
- package/www/cordova.js +238 -245
- package/www/react-native/index.js +4 -11
- package/www/react-native/liveness/enrollment_config.js +10 -16
- package/www/react-native/liveness/enrollment_response.js +14 -10
- package/www/react-native/liveness/liveness_exception.js +3 -3
- package/www/react-native/liveness/verification_config.js +16 -4
- package/www/react-native/liveness/{verify_match_response.js → verification_match_response.js} +5 -5
- package/www/react-native/liveness/verification_response.js +9 -9
- package/www/react-native/person_database/person.js +16 -7
- package/www/react-native/person_database/search_person.js +9 -0
- package/www/react-native/person_database/search_person_filter.js +44 -0
- package/www/types/index.d.ts +4 -8
- package/www/types/liveness/enrollment_config.d.ts +4 -6
- package/www/types/liveness/enrollment_response.d.ts +5 -4
- package/www/types/liveness/liveness_exception.d.ts +2 -2
- package/www/types/liveness/verification_config.d.ts +49 -5
- package/www/types/liveness/verification_match_response.d.ts +6 -0
- package/www/types/liveness/verification_response.d.ts +5 -5
- package/www/types/person_database/person.d.ts +12 -8
- package/www/types/person_database/search_person.d.ts +6 -0
- package/www/types/person_database/search_person_filter.d.ts +16 -0
- package/www/capacitor/liveness/enrollment_request.js +0 -39
- package/www/capacitor/liveness/error_response.js +0 -21
- package/www/react-native/liveness/enrollment_request.js +0 -39
- package/www/react-native/liveness/error_response.js +0 -21
- package/www/types/liveness/enrollment_request.d.ts +0 -24
- package/www/types/liveness/error_response.d.ts +0 -6
- package/www/types/liveness/verify_match_response.d.ts +0 -6
- /package/android/src/main/{java → kotlin}/com/regula/plugin/facesdk/RNFaceApiModule.kt +0 -0
- /package/ios/{Main.swift → Implementation.swift} +0 -0
package/RNFaceSDK.podspec
CHANGED
|
@@ -5,7 +5,7 @@ source = File.join(__dir__, 'ios')
|
|
|
5
5
|
|
|
6
6
|
Pod::Spec.new do |s|
|
|
7
7
|
s.name = 'RNFaceSDK'
|
|
8
|
-
s.version = '8.4.
|
|
8
|
+
s.version = '8.4.1343-nightly'
|
|
9
9
|
s.summary = package['description']
|
|
10
10
|
s.license = package['license']
|
|
11
11
|
|
|
@@ -16,6 +16,6 @@ Pod::Spec.new do |s|
|
|
|
16
16
|
s.ios.deployment_target = '13.0'
|
|
17
17
|
s.source_files = [ 'ios/**/*.swift', 'ios/**/RN*.m' ]
|
|
18
18
|
s.exclude_files = [ 'ios/CDVFaceSDK.swift' ]
|
|
19
|
-
s.dependency '
|
|
19
|
+
s.dependency 'FaceSDKNightly', '9.9.4841'
|
|
20
20
|
s.dependency 'React'
|
|
21
21
|
end
|
package/android/build.gradle
CHANGED
|
@@ -20,7 +20,7 @@ android {
|
|
|
20
20
|
rootProject.allprojects {
|
|
21
21
|
repositories {
|
|
22
22
|
maven {
|
|
23
|
-
url "https://maven.regulaforensics.com/RegulaDocumentReader/
|
|
23
|
+
url "https://maven.regulaforensics.com/RegulaDocumentReader/Nightly"
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
}
|
|
@@ -29,7 +29,7 @@ dependencies {
|
|
|
29
29
|
//noinspection GradleDynamicVersion
|
|
30
30
|
implementation 'com.facebook.react:react-native:+'
|
|
31
31
|
//noinspection GradleDependency
|
|
32
|
-
implementation('com.regula.face:api:8.4.
|
|
32
|
+
implementation('com.regula.face:api:8.4.5342'){
|
|
33
33
|
transitive = true
|
|
34
34
|
}
|
|
35
35
|
}
|
package/android/cordova.gradle
CHANGED
|
@@ -6,13 +6,13 @@ android {
|
|
|
6
6
|
|
|
7
7
|
repositories {
|
|
8
8
|
maven {
|
|
9
|
-
url "https://maven.regulaforensics.com/RegulaDocumentReader/
|
|
9
|
+
url "https://maven.regulaforensics.com/RegulaDocumentReader/Nightly"
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
dependencies {
|
|
14
14
|
//noinspection GradleDependency
|
|
15
|
-
implementation('com.regula.face:api:8.4.
|
|
15
|
+
implementation('com.regula.face:api:8.4.5342'){
|
|
16
16
|
transitive = true
|
|
17
17
|
}
|
|
18
18
|
}
|
|
@@ -17,22 +17,23 @@ import com.regula.facesdk.enums.RecordingProcess
|
|
|
17
17
|
import org.json.JSONArray
|
|
18
18
|
import org.json.JSONObject
|
|
19
19
|
|
|
20
|
-
fun setFaceCaptureConfig(builder: FaceCaptureConfiguration.Builder, config: JSONObject) =
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
20
|
+
fun setFaceCaptureConfig(builder: FaceCaptureConfiguration.Builder, config: JSONObject) =
|
|
21
|
+
config.forEach { k, v ->
|
|
22
|
+
when (k) {
|
|
23
|
+
"copyright" -> builder.setCopyright(v as Boolean)
|
|
24
|
+
"cameraSwitchEnabled" -> builder.setCameraSwitchEnabled(v as Boolean)
|
|
25
|
+
"closeButtonEnabled" -> builder.setCloseButtonEnabled(v as Boolean)
|
|
26
|
+
"torchButtonEnabled" -> builder.setTorchButtonEnabled(v as Boolean)
|
|
27
|
+
"vibrateOnSteps" -> builder.setVibrateOnStep(v as Boolean)
|
|
28
|
+
"detectOcclusion" -> builder.setDetectOcclusion(v as Boolean)
|
|
29
|
+
"showFaceAnimation" -> builder.setShowFaceAnimation(v as Boolean)
|
|
30
|
+
"preventScreenRecording" -> builder.setPreventScreenRecording(v as Boolean)
|
|
31
|
+
"cameraPositionAndroid" -> builder.setCameraId(v.toInt())
|
|
32
|
+
"screenOrientation" -> builder.setScreenOrientation(*screenOrientationArrayFromJSON(v as JSONArray))
|
|
33
|
+
"timeout" -> builder.setTimeout(v.toFloat())
|
|
34
|
+
"holdStillDuration" -> builder.setHoldStillDuration(v.toFloat())
|
|
35
|
+
}
|
|
34
36
|
}
|
|
35
|
-
}
|
|
36
37
|
|
|
37
38
|
fun getFaceCaptureConfig(input: FaceCaptureConfiguration) = mapOf(
|
|
38
39
|
"copyright" to input.hasCopyright(),
|
|
@@ -49,25 +50,26 @@ fun getFaceCaptureConfig(input: FaceCaptureConfiguration) = mapOf(
|
|
|
49
50
|
"holdStillDuration" to input.holdStillDuration,
|
|
50
51
|
).toJson()
|
|
51
52
|
|
|
52
|
-
fun setLivenessConfig(builder: LivenessConfiguration.Builder, config: JSONObject) =
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
53
|
+
fun setLivenessConfig(builder: LivenessConfiguration.Builder, config: JSONObject) =
|
|
54
|
+
config.forEach { k, v ->
|
|
55
|
+
when (k) {
|
|
56
|
+
"copyright" -> builder.setCopyright(v as Boolean)
|
|
57
|
+
"cameraSwitchEnabled" -> builder.setCameraSwitchEnabled(v as Boolean)
|
|
58
|
+
"closeButtonEnabled" -> builder.setCloseButtonEnabled(v as Boolean)
|
|
59
|
+
"torchButtonEnabled" -> builder.setTorchButtonEnabled(v as Boolean)
|
|
60
|
+
"vibrateOnSteps" -> builder.setVibrateOnStep(v as Boolean)
|
|
61
|
+
"cameraPositionAndroid" -> builder.setCameraId(v.toInt())
|
|
62
|
+
"screenOrientation" -> builder.setScreenOrientation(*screenOrientationArrayFromJSON(v as JSONArray))
|
|
63
|
+
"locationTrackingEnabled" -> builder.setLocationTrackingEnabled(v as Boolean)
|
|
64
|
+
"preventScreenRecording" -> builder.setPreventScreenRecording(v as Boolean)
|
|
65
|
+
"attemptsCount" -> builder.setAttemptsCount(v.toInt())
|
|
66
|
+
"recordingProcess" -> builder.setRecordingProcess(RecordingProcess.values()[v.toInt()])
|
|
67
|
+
"livenessType" -> builder.setType(LivenessType.values()[v.toInt()])
|
|
68
|
+
"tag" -> builder.setTag(v as String)
|
|
69
|
+
"skipStep" -> builder.setSkipStep(*livenessSkipStepArrayFromJSON(v as JSONArray))
|
|
70
|
+
"metadata" -> builder.setMetadata(v as JSONObject)
|
|
71
|
+
}
|
|
69
72
|
}
|
|
70
|
-
}
|
|
71
73
|
|
|
72
74
|
fun getLivenessConfig(input: LivenessConfiguration) = mapOf(
|
|
73
75
|
"copyright" to input.hasCopyright(),
|
|
@@ -87,28 +89,28 @@ fun getLivenessConfig(input: LivenessConfiguration) = mapOf(
|
|
|
87
89
|
"metadata" to input.metadata,
|
|
88
90
|
).toJson()
|
|
89
91
|
|
|
90
|
-
fun setEnrollmentConfig(builder: EnrollmentConfiguration.Builder, config: JSONObject) =
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
92
|
+
fun setEnrollmentConfig(builder: EnrollmentConfiguration.Builder, config: JSONObject) =
|
|
93
|
+
config.forEach { k, v ->
|
|
94
|
+
when (k) {
|
|
95
|
+
"copyright" -> builder.setCopyright(v as Boolean)
|
|
96
|
+
"cameraSwitchEnabled" -> builder.setCameraSwitchEnabled(v as Boolean)
|
|
97
|
+
"closeButtonEnabled" -> builder.setCloseButtonEnabled(v as Boolean)
|
|
98
|
+
"torchButtonEnabled" -> builder.setTorchButtonEnabled(v as Boolean)
|
|
99
|
+
"vibrateOnSteps" -> builder.setVibrateOnStep(v as Boolean)
|
|
100
|
+
"cameraPositionAndroid" -> builder.setCameraId(v.toInt())
|
|
101
|
+
"screenOrientation" -> builder.setScreenOrientation(*screenOrientationArrayFromJSON(v as JSONArray))
|
|
102
|
+
"locationTrackingEnabled" -> builder.setLocationTrackingEnabled(v as Boolean)
|
|
103
|
+
"preventScreenRecording" -> builder.setPreventScreenRecording(v as Boolean)
|
|
104
|
+
"attemptsCount" -> builder.setAttemptsCount(v.toInt())
|
|
105
|
+
"recordingProcess" -> builder.setRecordingProcess(RecordingProcess.values()[v.toInt()])
|
|
106
|
+
"livenessType" -> builder.setType(LivenessType.values()[v.toInt()])
|
|
107
|
+
"tag" -> builder.setTag(v as String)
|
|
108
|
+
"skipStep" -> builder.setSkipStep(*livenessSkipStepArrayFromJSON(v as JSONArray))
|
|
109
|
+
"metadata" -> builder.setMetadata(v as JSONObject)
|
|
110
|
+
"person" -> builder.setPerson(personFromJSON(v as JSONObject))
|
|
111
|
+
"searchFilter" -> builder.setSearchFilter(searchPersonFilterFromJSON(v as JSONObject))
|
|
112
|
+
}
|
|
110
113
|
}
|
|
111
|
-
}
|
|
112
114
|
|
|
113
115
|
fun getEnrollmentConfig(input: EnrollmentConfiguration) = mapOf(
|
|
114
116
|
"copyright" to input.hasCopyright(),
|
|
@@ -124,36 +126,35 @@ fun getEnrollmentConfig(input: EnrollmentConfiguration) = mapOf(
|
|
|
124
126
|
"recordingProcess" to input.recordingProcess.ordinal,
|
|
125
127
|
"livenessType" to input.type.ordinal,
|
|
126
128
|
"tag" to input.tag,
|
|
127
|
-
"externalId" to input.externalId,
|
|
128
|
-
"groupId" to input.groupId,
|
|
129
|
-
"checkDuplicatesEnabled" to input.isCheckDuplicatesEnabled,
|
|
130
|
-
"duplicatesThreshold" to input.duplicatesThreshold,
|
|
131
129
|
"skipStep" to generateLivenessSkipStepArray(input.skipStep),
|
|
132
130
|
"metadata" to input.metadata,
|
|
131
|
+
"person" to generatePerson(input.person),
|
|
132
|
+
"searchFilter" to generateSearchPersonFilter(input.searchFilter),
|
|
133
133
|
).toJson()
|
|
134
134
|
|
|
135
|
-
fun setVerificationConfig(builder: VerificationConfiguration.Builder, config: JSONObject) =
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
135
|
+
fun setVerificationConfig(builder: VerificationConfiguration.Builder, config: JSONObject) =
|
|
136
|
+
config.forEach { k, v ->
|
|
137
|
+
when (k) {
|
|
138
|
+
"copyright" -> builder.setCopyright(v as Boolean)
|
|
139
|
+
"cameraSwitchEnabled" -> builder.setCameraSwitchEnabled(v as Boolean)
|
|
140
|
+
"closeButtonEnabled" -> builder.setCloseButtonEnabled(v as Boolean)
|
|
141
|
+
"torchButtonEnabled" -> builder.setTorchButtonEnabled(v as Boolean)
|
|
142
|
+
"vibrateOnSteps" -> builder.setVibrateOnStep(v as Boolean)
|
|
143
|
+
"cameraPositionAndroid" -> builder.setCameraId(v.toInt())
|
|
144
|
+
"screenOrientation" -> builder.setScreenOrientation(*screenOrientationArrayFromJSON(v as JSONArray))
|
|
145
|
+
"locationTrackingEnabled" -> builder.setLocationTrackingEnabled(v as Boolean)
|
|
146
|
+
"preventScreenRecording" -> builder.setPreventScreenRecording(v as Boolean)
|
|
147
|
+
"attemptsCount" -> builder.setAttemptsCount(v.toInt())
|
|
148
|
+
"recordingProcess" -> builder.setRecordingProcess(RecordingProcess.values()[v.toInt()])
|
|
149
|
+
"livenessType" -> builder.setType(LivenessType.values()[v.toInt()])
|
|
150
|
+
"tag" -> builder.setTag(v as String)
|
|
151
|
+
"skipStep" -> builder.setSkipStep(*livenessSkipStepArrayFromJSON(v as JSONArray))
|
|
152
|
+
"metadata" -> builder.setMetadata(v as JSONObject)
|
|
153
|
+
"personId" -> builder.setPrivateProperty("u", v as String)
|
|
154
|
+
"externalId" -> builder.setPrivateProperty("v", v as String)
|
|
155
|
+
"threshold" -> builder.setThreshold(v.toFloat())
|
|
156
|
+
}
|
|
155
157
|
}
|
|
156
|
-
}
|
|
157
158
|
|
|
158
159
|
fun getVerificationConfig(input: VerificationConfiguration) = mapOf(
|
|
159
160
|
"copyright" to input.hasCopyright(),
|
|
@@ -169,19 +170,20 @@ fun getVerificationConfig(input: VerificationConfiguration) = mapOf(
|
|
|
169
170
|
"recordingProcess" to input.recordingProcess.ordinal,
|
|
170
171
|
"livenessType" to input.type.ordinal,
|
|
171
172
|
"tag" to input.tag,
|
|
172
|
-
"personId" to input.personId,
|
|
173
|
-
"groupId" to input.groupId,
|
|
174
|
-
"threshold" to input.threshold,
|
|
175
173
|
"skipStep" to generateLivenessSkipStepArray(input.skipStep),
|
|
176
174
|
"metadata" to input.metadata,
|
|
175
|
+
"personId" to input.personId,
|
|
176
|
+
"externalId" to input.externalId,
|
|
177
|
+
"threshold" to input.threshold,
|
|
177
178
|
).toJson()
|
|
178
179
|
|
|
179
|
-
fun setMatchFacesConfig(builder: MatchFacesConfiguration.Builder, config: JSONObject) =
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
180
|
+
fun setMatchFacesConfig(builder: MatchFacesConfiguration.Builder, config: JSONObject) =
|
|
181
|
+
config.forEach { k, v ->
|
|
182
|
+
when (k) {
|
|
183
|
+
"processingMode" -> builder.setProcessingMode(ProcessingMode.values()[v.toInt()])
|
|
184
|
+
"locationTrackingEnabled" -> builder.setLocationTrackingEnabled(v as Boolean)
|
|
185
|
+
}
|
|
183
186
|
}
|
|
184
|
-
}
|
|
185
187
|
|
|
186
188
|
fun getMatchFacesConfig(input: MatchFacesConfiguration) = mapOf(
|
|
187
189
|
"processingMode" to input.processingMode.ordinal,
|
|
@@ -209,7 +211,9 @@ fun getImageQualityCharacteristic(
|
|
|
209
211
|
"ImageWidth" -> ImageQualityGroup.ImageCharacteristic.imageWidthWithRange(min, max)
|
|
210
212
|
"ImageHeight" -> ImageQualityGroup.ImageCharacteristic.imageHeightWithRange(min, max)
|
|
211
213
|
"ImageWidthToHeight" -> ImageQualityGroup.ImageCharacteristic.imageWidthToHeightWithRange(min, max)
|
|
214
|
+
|
|
212
215
|
"ImageChannelsNumber" -> ImageQualityGroup.ImageCharacteristic.imageChannelsNumberWithValue(min)
|
|
216
|
+
|
|
213
217
|
"PaddingRatio" -> ImageQualityGroup.ImageCharacteristic.paddingRatio(min, max)
|
|
214
218
|
"ArtFace" -> ImageQualityGroup.ImageCharacteristic.artFace()
|
|
215
219
|
|
|
@@ -259,9 +263,9 @@ fun getImageQualityCharacteristic(
|
|
|
259
263
|
"BackgroundUniformity" -> ImageQualityGroup.QualityBackground.backgroundUniformity()
|
|
260
264
|
"ShadowsOnBackground" -> ImageQualityGroup.QualityBackground.shadowsOnBackground()
|
|
261
265
|
"OtherFaces" -> ImageQualityGroup.QualityBackground.otherFaces()
|
|
262
|
-
"BackgroundColorMatch" -> color?.let {
|
|
263
|
-
|
|
264
|
-
|
|
266
|
+
"BackgroundColorMatch" -> color?.let {
|
|
267
|
+
ImageQualityGroup.QualityBackground.backgroundColorMatchWithColor(it)
|
|
268
|
+
} ?: ImageQualityGroup.QualityBackground.backgroundColorMatch()
|
|
265
269
|
else -> throw Exception("ImageQualityCharacteristicName not found")
|
|
266
270
|
}
|
|
267
271
|
return customRange?.let { result.withCustomRange(it.min, it.max) } ?: result
|
|
@@ -50,7 +50,6 @@ fun methodCall(method: String, callback: (Any?) -> Unit): Any = when (method) {
|
|
|
50
50
|
"startLiveness" -> startLiveness(callback, argsNullable(0))
|
|
51
51
|
"startEnrollment" -> startEnrollment(callback, args(0))
|
|
52
52
|
"startVerification" -> startVerification(callback, args(0))
|
|
53
|
-
"enrollWithTrustedPhoto" -> enrollWithTrustedPhoto(callback, args(0))
|
|
54
53
|
"stopLiveness" -> stopLiveness()
|
|
55
54
|
"matchFaces" -> matchFaces(callback, args(0), argsNullable(1))
|
|
56
55
|
"splitComparedFaces" -> splitComparedFaces(callback, args(0), args(1))
|
|
@@ -106,12 +105,14 @@ fun getLocale(callback: Callback) = callback(Instance().locale)
|
|
|
106
105
|
fun setLocale(locale: String?) = locale.let { Instance().locale = it }
|
|
107
106
|
|
|
108
107
|
fun setLocalizationDictionary(dictionary: JSONObject?) {
|
|
109
|
-
localizationCallbacks =
|
|
108
|
+
localizationCallbacks =
|
|
109
|
+
LocalizationCallbacks { if (dictionary?.has(it) == true) dictionary.getString(it) else null }
|
|
110
110
|
Instance().setLocalizationCallback(localizationCallbacks!!)
|
|
111
111
|
}
|
|
112
112
|
|
|
113
113
|
fun setRequestHeaders(headers: JSONObject?) {
|
|
114
|
-
networkInterceptorListener =
|
|
114
|
+
networkInterceptorListener =
|
|
115
|
+
NetworkInterceptorListener { headers?.forEach { k, v -> it.header(k, v as String) } }
|
|
115
116
|
Instance().setNetworkInterceptorListener(networkInterceptorListener)
|
|
116
117
|
}
|
|
117
118
|
|
|
@@ -127,7 +128,11 @@ fun initialize(callback: Callback, config: JSONObject?) =
|
|
|
127
128
|
Instance().initialize(context, initConfigFromJSON(config), initCompletion(callback))
|
|
128
129
|
else
|
|
129
130
|
getBleWrapper()?.let {
|
|
130
|
-
Instance().initialize(
|
|
131
|
+
Instance().initialize(
|
|
132
|
+
context,
|
|
133
|
+
InitializationBleDeviceConfiguration(it),
|
|
134
|
+
initCompletion(callback)
|
|
135
|
+
)
|
|
131
136
|
} ?: callback(generateInitCompletion(false, InitException(InitErrorCode.LICENSE_IS_NULL)))
|
|
132
137
|
|
|
133
138
|
fun deinitialize() = Instance().deinitialize()
|
|
@@ -174,10 +179,6 @@ fun startVerification(callback: Callback, config: JSONObject) = Instance().start
|
|
|
174
179
|
livenessNotificationCompletion(),
|
|
175
180
|
)
|
|
176
181
|
|
|
177
|
-
fun enrollWithTrustedPhoto(callback: Callback, config: JSONObject) = Instance().enrollWithTrustedPhoto(
|
|
178
|
-
enrollmentRequestFromJSON(config),
|
|
179
|
-
) { callback(generateEnrollmentResponse(it)) }
|
|
180
|
-
|
|
181
182
|
fun stopLiveness() = Instance().stopLivenessProcessing(context)
|
|
182
183
|
|
|
183
184
|
fun matchFaces(callback: Callback, request: JSONObject, config: JSONObject?) = config?.let {
|
|
@@ -255,7 +256,9 @@ fun getPersonImage(callback: Callback, personId: String, imageId: String) = db.g
|
|
|
255
256
|
personId,
|
|
256
257
|
imageId,
|
|
257
258
|
object : PersonDBCallback<ByteArray> {
|
|
258
|
-
override fun onSuccess(data: ByteArray?) =
|
|
259
|
+
override fun onSuccess(data: ByteArray?) =
|
|
260
|
+
callback(generatePersonDBResponse(data.toBase64()!!, null))
|
|
261
|
+
|
|
259
262
|
override fun onFailure(error: String) = callback(generatePersonDBResponse(null, error))
|
|
260
263
|
}
|
|
261
264
|
)
|
|
@@ -310,7 +313,8 @@ fun getGroup(callback: Callback, groupId: String) = db.getGroup(
|
|
|
310
313
|
databaseItemCompletion(callback, ::generatePersonGroup)
|
|
311
314
|
)
|
|
312
315
|
|
|
313
|
-
fun getGroups(callback: Callback) =
|
|
316
|
+
fun getGroups(callback: Callback) =
|
|
317
|
+
db.getGroups(databasePageCompletion(callback, ::generatePersonGroup))
|
|
314
318
|
|
|
315
319
|
fun getGroupsForPage(callback: Callback, page: Int, size: Int) = db.getGroupsForPage(
|
|
316
320
|
page,
|
|
@@ -355,7 +359,9 @@ fun getPersonsInGroupForPage(
|
|
|
355
359
|
fun searchPerson(callback: Callback, searchPersonRequest: JSONObject) = db.searchPerson(
|
|
356
360
|
searchPersonRequestFromJSON(searchPersonRequest),
|
|
357
361
|
object : PersonDBCallback<List<SearchPerson>> {
|
|
358
|
-
override fun onSuccess(data: List<SearchPerson>?) =
|
|
362
|
+
override fun onSuccess(data: List<SearchPerson>?) =
|
|
363
|
+
callback(generatePersonDBResponse(data.toJsonNullable(::generateSearchPerson)!!, null))
|
|
364
|
+
|
|
359
365
|
override fun onFailure(error: String) = callback(generatePersonDBResponse(null, error))
|
|
360
366
|
}
|
|
361
367
|
)
|
|
@@ -364,7 +370,12 @@ fun initCompletion(callback: Callback) = FaceInitializationCompletion { success,
|
|
|
364
370
|
if (success) {
|
|
365
371
|
// initializes MutableLiveData
|
|
366
372
|
Instance().customization.uiConfigurationLive
|
|
367
|
-
Instance().setVideoEncoderCompletion { id, s ->
|
|
373
|
+
Instance().setVideoEncoderCompletion { id, s ->
|
|
374
|
+
sendEvent(
|
|
375
|
+
videoEncoderCompletionEvent,
|
|
376
|
+
generateVideoEncoderCompletion(id, s)
|
|
377
|
+
)
|
|
378
|
+
}
|
|
368
379
|
Instance().setOnClickListener { sendEvent(onCustomButtonTappedEvent, it.tag.toInt()) }
|
|
369
380
|
}
|
|
370
381
|
callback(generateInitCompletion(success, error))
|
|
@@ -384,7 +395,8 @@ fun livenessCompletion(callback: Callback) = LivenessCallback {
|
|
|
384
395
|
|
|
385
396
|
fun livenessNotificationCompletion() = object : LivenessNotificationCallback() {
|
|
386
397
|
override fun onCameraSwitched(cameraId: Int) = sendEvent(cameraSwitchEvent, cameraId)
|
|
387
|
-
override fun onLivenessNotification(ln: LivenessNotification) =
|
|
398
|
+
override fun onLivenessNotification(ln: LivenessNotification) =
|
|
399
|
+
sendEvent(livenessNotificationEvent, generateLivenessNotification(ln))
|
|
388
400
|
}
|
|
389
401
|
|
|
390
402
|
fun matchFacesCompletion(callback: Callback) = MatchFaceCallback {
|
|
@@ -395,39 +407,49 @@ fun detectFacesCompletion(callback: Callback) = DetectFacesCompletion {
|
|
|
395
407
|
callback(generateDetectFacesResponse(it))
|
|
396
408
|
}
|
|
397
409
|
|
|
398
|
-
fun verificationCompletion(callback: Callback) =
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
410
|
+
fun verificationCompletion(callback: Callback) =
|
|
411
|
+
{ livenessResponse: LivenessResponse, verificationResponse: VerificationResponse? ->
|
|
412
|
+
callback(
|
|
413
|
+
mapOf(
|
|
414
|
+
"livenessResponse" to generateLivenessResponse(livenessResponse),
|
|
415
|
+
"verificationResponse" to generateVerificationResponse(verificationResponse),
|
|
416
|
+
).toJson()
|
|
417
|
+
)
|
|
418
|
+
}
|
|
404
419
|
|
|
405
|
-
fun enrollmentCompletion(callback: Callback) =
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
420
|
+
fun enrollmentCompletion(callback: Callback) =
|
|
421
|
+
{ livenessResponse: LivenessResponse, enrollmentResponse: EnrollmentResponse? ->
|
|
422
|
+
callback(
|
|
423
|
+
mapOf(
|
|
424
|
+
"livenessResponse" to generateLivenessResponse(livenessResponse),
|
|
425
|
+
"enrollmentResponse" to generateEnrollmentResponse(enrollmentResponse),
|
|
426
|
+
).toJson()
|
|
427
|
+
)
|
|
428
|
+
}
|
|
411
429
|
|
|
412
|
-
fun <T> databaseItemCompletion(callback: Callback, toJson: ((T?) -> JSONObject?)?) =
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
}
|
|
430
|
+
fun <T> databaseItemCompletion(callback: Callback, toJson: ((T?) -> JSONObject?)?) =
|
|
431
|
+
object : PersonDBCallback<T> {
|
|
432
|
+
override fun onSuccess(data: T?) =
|
|
433
|
+
callback(generatePersonDBResponse(toJson?.let { it(data) } ?: true, null))
|
|
416
434
|
|
|
417
|
-
fun
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
435
|
+
override fun onFailure(error: String) = callback(generatePersonDBResponse(null, error))
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
fun <T : DbBaseItem?> databasePageCompletion(callback: Callback, toJson: (T?) -> JSONObject?) =
|
|
439
|
+
object : PersonDBCallback<PageableItemList<List<T>?, T>> {
|
|
440
|
+
override fun onSuccess(data: PageableItemList<List<T>?, T>?) = callback(
|
|
441
|
+
generatePersonDBResponse(
|
|
442
|
+
mapOf(
|
|
443
|
+
"items" to data!!.itemsList.toJsonNullable(toJson),
|
|
444
|
+
"page" to data.page,
|
|
445
|
+
"totalPages" to data.totalPages,
|
|
446
|
+
).toJson(),
|
|
447
|
+
null
|
|
448
|
+
)
|
|
426
449
|
)
|
|
427
|
-
)
|
|
428
450
|
|
|
429
|
-
|
|
430
|
-
}
|
|
451
|
+
override fun onFailure(error: String) = callback(generatePersonDBResponse(null, error))
|
|
452
|
+
}
|
|
431
453
|
|
|
432
454
|
// Weak references
|
|
433
455
|
var localizationCallbacks: LocalizationCallbacks? = null
|