@regulaforensics/face-sdk 8.4.1338-nightly → 8.4.1344-rc
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 +5 -2
- 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
|
@@ -53,7 +53,6 @@ import com.regula.facesdk.model.Image
|
|
|
53
53
|
import com.regula.facesdk.model.LivenessNotification
|
|
54
54
|
import com.regula.facesdk.model.MatchFacesImage
|
|
55
55
|
import com.regula.facesdk.model.results.EnrollmentResponse
|
|
56
|
-
import com.regula.facesdk.model.results.ErrorResponse
|
|
57
56
|
import com.regula.facesdk.model.results.FaceCaptureResponse
|
|
58
57
|
import com.regula.facesdk.model.results.FaceSDKVersion
|
|
59
58
|
import com.regula.facesdk.model.results.LivenessResponse
|
|
@@ -70,8 +69,8 @@ import com.regula.facesdk.model.results.person.PersonGroup
|
|
|
70
69
|
import com.regula.facesdk.model.results.person.PersonImage
|
|
71
70
|
import com.regula.facesdk.model.results.person.SearchPerson
|
|
72
71
|
import com.regula.facesdk.model.results.person.SearchPerson.Detection
|
|
72
|
+
import com.regula.facesdk.model.results.person.SearchPersonFilter
|
|
73
73
|
import com.regula.facesdk.model.results.person.SearchPersonImage
|
|
74
|
-
import com.regula.facesdk.request.EnrollmentRequest
|
|
75
74
|
import com.regula.facesdk.request.MatchFacesRequest
|
|
76
75
|
import com.regula.facesdk.request.person.EditGroupPersonsRequest
|
|
77
76
|
import com.regula.facesdk.request.person.ImageUpload
|
|
@@ -111,7 +110,7 @@ fun livenessConfigFromJSON(input: JSONObject) = input.let {
|
|
|
111
110
|
fun generateLivenessConfig(input: LivenessConfiguration) = getLivenessConfig(input)
|
|
112
111
|
|
|
113
112
|
fun enrollmentConfigFromJSON(input: JSONObject) = input.let {
|
|
114
|
-
val result = EnrollmentConfiguration.Builder(
|
|
113
|
+
val result = EnrollmentConfiguration.Builder()
|
|
115
114
|
setEnrollmentConfig(result, it)
|
|
116
115
|
result.build()
|
|
117
116
|
}!!
|
|
@@ -119,7 +118,7 @@ fun enrollmentConfigFromJSON(input: JSONObject) = input.let {
|
|
|
119
118
|
fun generateEnrollmentConfig(input: EnrollmentConfiguration) = getEnrollmentConfig(input)
|
|
120
119
|
|
|
121
120
|
fun verificationConfigFromJSON(input: JSONObject) = input.let {
|
|
122
|
-
val result = VerificationConfiguration.Builder(
|
|
121
|
+
val result = VerificationConfiguration.Builder::class.constructor().instantiate()
|
|
123
122
|
setVerificationConfig(result, it)
|
|
124
123
|
result.build()
|
|
125
124
|
}!!
|
|
@@ -354,7 +353,10 @@ fun generateFaceCaptureImage(input: Image?) = input?.let {
|
|
|
354
353
|
fun faceCaptureResponseFromJSON(input: JSONObject) = input.let {
|
|
355
354
|
val result = FaceCaptureResponse::class.constructor().instantiate()
|
|
356
355
|
result.setPrivateProperty("image", faceCaptureImageFromJSON(it.getJSONObjectOrNull("image")))
|
|
357
|
-
result.setPrivateProperty(
|
|
356
|
+
result.setPrivateProperty(
|
|
357
|
+
"exception",
|
|
358
|
+
faceCaptureExceptionFromJSON(it.getJSONObjectOrNull("error"))
|
|
359
|
+
)
|
|
358
360
|
result
|
|
359
361
|
}
|
|
360
362
|
|
|
@@ -365,31 +367,16 @@ fun generateFaceCaptureResponse(it: FaceCaptureResponse) = mapOf(
|
|
|
365
367
|
|
|
366
368
|
// Liveness ------------------------------
|
|
367
369
|
|
|
368
|
-
fun enrollmentRequestFromJSON(input: JSONObject): EnrollmentRequest = input.let {
|
|
369
|
-
val externalId = it.getString("externalId")
|
|
370
|
-
val builder = if (it.has("trustedImage")) EnrollmentRequest.Builder(externalId, it.getString("trustedImage").toBitmap()!!)
|
|
371
|
-
else EnrollmentRequest.Builder(externalId, it.getString("trustedImageUrl"))
|
|
372
|
-
|
|
373
|
-
if (it.has("groupId")) builder.setGroupId(it.getString("groupId"))
|
|
374
|
-
builder.build()
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
fun generateEnrollmentRequest(input: EnrollmentRequest) = input.let {
|
|
378
|
-
mapOf(
|
|
379
|
-
"externalId" to it.externalId,
|
|
380
|
-
"groupId" to it.groupId,
|
|
381
|
-
"trustedImage" to it.trustedImage.toBase64(),
|
|
382
|
-
"trustedImageUrl" to it.trustedImageUrl,
|
|
383
|
-
).toJson()
|
|
384
|
-
}
|
|
385
|
-
|
|
386
370
|
fun livenessResponseFromJSON(input: JSONObject?) = input?.let {
|
|
387
371
|
val result = LivenessResponse()
|
|
388
372
|
it.getStringOrNull("image").toBitmap()?.let { bitmap ->
|
|
389
373
|
result.setPrivateProperty("bitmaps", arrayOf(bitmap))
|
|
390
374
|
}
|
|
391
375
|
result.setPrivateProperty("liveness", LivenessStatus.values()[it.getInt("liveness")])
|
|
392
|
-
result.setPrivateProperty(
|
|
376
|
+
result.setPrivateProperty(
|
|
377
|
+
"exception",
|
|
378
|
+
livenessExceptionFromJSON(it.getJSONObjectOrNull("error"))
|
|
379
|
+
)
|
|
393
380
|
result.setPrivateProperty("tag", it.getStringOrNull("tag"))
|
|
394
381
|
result.setPrivateProperty("transactionId", it.getStringOrNull("transactionId"))
|
|
395
382
|
result.setPrivateProperty("estimatedAge", it.getIntOrNull("estimatedAge"))
|
|
@@ -407,73 +394,60 @@ fun generateLivenessResponse(input: LivenessResponse?) = input?.let {
|
|
|
407
394
|
).toJson()
|
|
408
395
|
}
|
|
409
396
|
|
|
410
|
-
fun livenessNotificationFromJSON(it: JSONObject): LivenessNotification =
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
397
|
+
fun livenessNotificationFromJSON(it: JSONObject): LivenessNotification =
|
|
398
|
+
LivenessNotification.Builder().create(
|
|
399
|
+
LivenessProcessStatus.values()[it.getInt("status")],
|
|
400
|
+
livenessResponseFromJSON(it.getJSONObjectOrNull("response"))
|
|
401
|
+
).build()
|
|
414
402
|
|
|
415
403
|
fun generateLivenessNotification(it: LivenessNotification) = mapOf(
|
|
416
404
|
"status" to it.status.ordinal,
|
|
417
405
|
"response" to generateLivenessResponse(it.response)
|
|
418
406
|
).toJson()
|
|
419
407
|
|
|
420
|
-
fun errorResponseFromJSON(input: JSONObject?) = input?.let {
|
|
421
|
-
ErrorResponse(
|
|
422
|
-
it.getInt("code"),
|
|
423
|
-
it.getString("message")
|
|
424
|
-
)
|
|
425
|
-
}
|
|
426
|
-
|
|
427
|
-
fun generateErrorResponse(input: ErrorResponse?) = input?.let {
|
|
428
|
-
mapOf(
|
|
429
|
-
"code" to it.code,
|
|
430
|
-
"message" to it.message
|
|
431
|
-
).toJson()
|
|
432
|
-
}
|
|
433
|
-
|
|
434
408
|
fun enrollmentResponseFromJSON(input: JSONObject?) = input?.let {
|
|
435
409
|
EnrollmentResponse(
|
|
436
|
-
it.
|
|
437
|
-
it.
|
|
438
|
-
|
|
410
|
+
it.getBoolean("enrolled"),
|
|
411
|
+
personFromJSON(it.getJSONObjectOrNull("person")),
|
|
412
|
+
it.getJSONArrayOrNull("searchPersons").toArray<SearchPerson>(::searchPersonFromJSON)
|
|
439
413
|
)
|
|
440
414
|
}
|
|
441
415
|
|
|
442
416
|
fun generateEnrollmentResponse(input: EnrollmentResponse?) = input?.let {
|
|
443
417
|
mapOf(
|
|
444
|
-
"
|
|
445
|
-
"
|
|
446
|
-
"
|
|
418
|
+
"enrolled" to it.isEnrolled,
|
|
419
|
+
"person" to generatePerson(it.person),
|
|
420
|
+
"searchPersons" to it.searchPersons.toJson(::generateSearchPerson),
|
|
447
421
|
).toJson()
|
|
448
422
|
}
|
|
449
423
|
|
|
450
424
|
fun verifyMatchResponseFromJSON(input: JSONObject?) = input?.let {
|
|
451
425
|
VerificationMatchResponse(
|
|
452
|
-
it.getBoolean("
|
|
426
|
+
it.getBoolean("verified"),
|
|
453
427
|
it.get("similarity").toFloat()
|
|
454
428
|
)
|
|
455
429
|
}
|
|
456
430
|
|
|
457
431
|
fun generateVerifyMatchResponse(input: VerificationMatchResponse?) = input?.let {
|
|
458
432
|
mapOf(
|
|
459
|
-
"
|
|
433
|
+
"verified" to it.isVerified,
|
|
460
434
|
"similarity" to it.similarity
|
|
461
435
|
).toJson()
|
|
462
436
|
}
|
|
463
437
|
|
|
464
438
|
fun verificationResponseFromJSON(input: JSONObject?) = input?.let {
|
|
465
439
|
VerificationResponse(
|
|
466
|
-
it.getBoolean("
|
|
467
|
-
|
|
468
|
-
|
|
440
|
+
it.getBoolean("verified"),
|
|
441
|
+
personFromJSON(it.getJSONObjectOrNull("person")),
|
|
442
|
+
verifyMatchResponseFromJSON(it.getJSONObjectOrNull("match"))
|
|
469
443
|
)
|
|
470
444
|
}
|
|
471
445
|
|
|
472
446
|
fun generateVerificationResponse(input: VerificationResponse?) = input?.let {
|
|
473
447
|
mapOf(
|
|
474
|
-
"
|
|
448
|
+
"verified" to it.isVerified,
|
|
449
|
+
"person" to generatePerson(it.person),
|
|
475
450
|
"match" to generateVerifyMatchResponse(it.match),
|
|
476
|
-
"error" to generateErrorResponse(it.error),
|
|
477
451
|
).toJson()
|
|
478
452
|
}
|
|
479
453
|
|
|
@@ -548,7 +522,8 @@ fun matchFacesRequestFromJSON(input: JSONObject) = input.let {
|
|
|
548
522
|
val result = MatchFacesRequest(it.getJSONArray("images").toList(::matchFacesImageFromJSON)!!)
|
|
549
523
|
result.customMetadata = it.getJSONObjectOrNull("metadata")
|
|
550
524
|
result.tag = it.getStringOrNull("tag")
|
|
551
|
-
result.outputImageParams =
|
|
525
|
+
result.outputImageParams =
|
|
526
|
+
outputImageParamsFromJSON(it.getJSONObjectOrNull("outputImageParams"))
|
|
552
527
|
result
|
|
553
528
|
}
|
|
554
529
|
|
|
@@ -588,7 +563,13 @@ fun generateRect(input: Rect?) = input?.let {
|
|
|
588
563
|
}
|
|
589
564
|
|
|
590
565
|
fun matchFacesDetectionFaceFromJSON(input: JSONObject?) = input?.let {
|
|
591
|
-
val result = MatchFacesDetectionFace::class.constructor(
|
|
566
|
+
val result = MatchFacesDetectionFace::class.constructor(
|
|
567
|
+
Int::class,
|
|
568
|
+
Double::class,
|
|
569
|
+
ArrayList::class,
|
|
570
|
+
Rect::class,
|
|
571
|
+
Rect::class
|
|
572
|
+
).instantiate(
|
|
592
573
|
it.getIntOrNull("faceIndex"),
|
|
593
574
|
it.getDoubleOrNull("rotationAngle"),
|
|
594
575
|
it.getJSONArrayOrNull("landmarks").toList(::pointFromJSON).toArrayList(),
|
|
@@ -611,12 +592,19 @@ fun generateMatchFacesDetectionFace(input: MatchFacesDetectionFace?) = input?.le
|
|
|
611
592
|
}
|
|
612
593
|
|
|
613
594
|
fun matchFacesDetectionFromJSON(input: JSONObject): MatchFacesDetection = input.let {
|
|
614
|
-
val result =
|
|
615
|
-
|
|
616
|
-
|
|
595
|
+
val result =
|
|
596
|
+
MatchFacesDetection::class.constructor(Int::class, MatchFacesImage::class).instantiate(
|
|
597
|
+
it.getIntOrNull("imageIndex"),
|
|
598
|
+
matchFacesImageFromJSON(it.getJSONObjectOrNull("image"))
|
|
599
|
+
)
|
|
600
|
+
result.setPrivateProperty(
|
|
601
|
+
"faces",
|
|
602
|
+
it.getJSONArrayOrNull("faces").toList(::matchFacesDetectionFaceFromJSON)
|
|
603
|
+
)
|
|
604
|
+
result.setPrivateProperty(
|
|
605
|
+
"exception",
|
|
606
|
+
matchFacesExceptionFromJSON(it.getJSONObjectOrNull("error"))
|
|
617
607
|
)
|
|
618
|
-
result.setPrivateProperty("faces", it.getJSONArrayOrNull("faces").toList(::matchFacesDetectionFaceFromJSON))
|
|
619
|
-
result.setPrivateProperty("exception", matchFacesExceptionFromJSON(it.getJSONObjectOrNull("error")))
|
|
620
608
|
result
|
|
621
609
|
}
|
|
622
610
|
|
|
@@ -628,7 +616,12 @@ fun generateMatchFacesDetection(it: MatchFacesDetection) = mapOf(
|
|
|
628
616
|
).toJson()
|
|
629
617
|
|
|
630
618
|
fun comparedFaceFromJSON(input: JSONObject): MatchFacesComparedFace = input.let {
|
|
631
|
-
MatchFacesComparedFace::class.constructor(
|
|
619
|
+
MatchFacesComparedFace::class.constructor(
|
|
620
|
+
Int::class,
|
|
621
|
+
MatchFacesImage::class,
|
|
622
|
+
Integer::class,
|
|
623
|
+
MatchFacesDetectionFace::class
|
|
624
|
+
).instantiate(
|
|
632
625
|
it.getInt("imageIndex"),
|
|
633
626
|
matchFacesImageFromJSON(it.getJSONObject("image")),
|
|
634
627
|
it.getIntOrNull("faceIndex"),
|
|
@@ -644,7 +637,13 @@ fun generateComparedFace(it: MatchFacesComparedFace) = mapOf(
|
|
|
644
637
|
).toJson()
|
|
645
638
|
|
|
646
639
|
fun comparedFacesPairFromJSON(input: JSONObject): MatchFacesComparedFacesPair = input.let {
|
|
647
|
-
MatchFacesComparedFacesPair::class.constructor(
|
|
640
|
+
MatchFacesComparedFacesPair::class.constructor(
|
|
641
|
+
MatchFacesComparedFace::class,
|
|
642
|
+
MatchFacesComparedFace::class,
|
|
643
|
+
MatchFacesException::class,
|
|
644
|
+
Float::class,
|
|
645
|
+
Float::class
|
|
646
|
+
).instantiate(
|
|
648
647
|
comparedFaceFromJSON(it.getJSONObject("first")),
|
|
649
648
|
comparedFaceFromJSON(it.getJSONObject("second")),
|
|
650
649
|
matchFacesExceptionFromJSON(it.getJSONObjectOrNull("error")),
|
|
@@ -662,7 +661,12 @@ fun generateComparedFacesPair(it: MatchFacesComparedFacesPair) = mapOf(
|
|
|
662
661
|
).toJson()
|
|
663
662
|
|
|
664
663
|
fun matchFacesResponseFromJSON(input: JSONObject) = input.let {
|
|
665
|
-
MatchFacesResponse::class.constructor(
|
|
664
|
+
MatchFacesResponse::class.constructor(
|
|
665
|
+
ArrayList::class,
|
|
666
|
+
ArrayList::class,
|
|
667
|
+
String::class,
|
|
668
|
+
MatchFacesException::class
|
|
669
|
+
).instantiate(
|
|
666
670
|
it.getJSONArrayOrNull("detections").toList(::matchFacesDetectionFromJSON).toArrayList(),
|
|
667
671
|
it.getJSONArrayOrNull("results").toList(::comparedFacesPairFromJSON).toArrayList(),
|
|
668
672
|
it.getStringOrNull("tag"),
|
|
@@ -716,7 +720,8 @@ fun generateImageQualityCharacteristic(it: ImageQualityCharacteristic) = mapOf(
|
|
|
716
720
|
|
|
717
721
|
fun detectFacesConfigFromJSON(input: JSONObject?): DetectFacesConfiguration? = input?.let {
|
|
718
722
|
object : DetectFacesConfiguration() {init {
|
|
719
|
-
customQuality =
|
|
723
|
+
customQuality =
|
|
724
|
+
it.getJSONArrayOrNull("customQuality").toList(::imageQualityCharacteristicFromJSON)
|
|
720
725
|
outputImageParams = outputImageParamsFromJSON(it.getJSONObjectOrNull("outputImageParams"))
|
|
721
726
|
onlyCentralFace = it.getBooleanOrNull("onlyCentralFace")
|
|
722
727
|
attributes = it.getJSONArrayOrNull("attributes")?.let { attrs ->
|
|
@@ -814,7 +819,11 @@ fun generateDetectFaceResult(input: DetectFaceResult?) = input?.let {
|
|
|
814
819
|
}
|
|
815
820
|
|
|
816
821
|
fun detectFacesResponseFromJSON(input: JSONObject): DetectFacesResponse = input.let {
|
|
817
|
-
DetectFacesResponse::class.constructor(
|
|
822
|
+
DetectFacesResponse::class.constructor(
|
|
823
|
+
String::class,
|
|
824
|
+
List::class,
|
|
825
|
+
DetectFacesErrorException::class
|
|
826
|
+
).instantiate(
|
|
818
827
|
it.getStringOrNull("scenario"),
|
|
819
828
|
it.getJSONArrayOrNull("allDetections").toList(::detectFaceResultFromJSON),
|
|
820
829
|
detectFacesExceptionFromJSON(it.getJSONObjectOrNull("error")),
|
|
@@ -838,11 +847,14 @@ fun generatePersonDBResponse(data: Any?, error: String?) = mapOf(
|
|
|
838
847
|
fun personFromJSON(input: JSONObject?) = input?.let {
|
|
839
848
|
val result = Person::class.constructor().instantiate()
|
|
840
849
|
result.name = it.getString("name")
|
|
841
|
-
result.setPrivateProperty("
|
|
842
|
-
result.setPrivateProperty("
|
|
850
|
+
result.setPrivateProperty("g", it.getJSONArray("groups").toArray<String>())
|
|
851
|
+
result.setPrivateProperty("f", it.getString("updatedAt").toDate())
|
|
843
852
|
result.setPrivateProperty("a", it.getString("id"))
|
|
844
853
|
result.setPrivateProperty("b", it.getJSONObjectOrNull("metadata") ?: JSONObject())
|
|
845
854
|
result.setPrivateProperty("c", it.getString("createdAt").toDate())
|
|
855
|
+
result.expireAt = it.getStringOrNull("expireAt").toDate()
|
|
856
|
+
result.externalId = it.getStringOrNull("externalId")
|
|
857
|
+
result.timeToLive = it.getIntOrNull("ttl")
|
|
846
858
|
result
|
|
847
859
|
}
|
|
848
860
|
|
|
@@ -853,7 +865,10 @@ fun generatePerson(input: Person?) = input?.let {
|
|
|
853
865
|
"updatedAt" to it.updatedAt.toStr(),
|
|
854
866
|
"id" to it.id,
|
|
855
867
|
"metadata" to it.metadata,
|
|
856
|
-
"createdAt" to it.createdAt.toStr()
|
|
868
|
+
"createdAt" to it.createdAt.toStr(),
|
|
869
|
+
"expireAt" to it.expireAt.toStr(),
|
|
870
|
+
"externalId" to it.externalId,
|
|
871
|
+
"ttl" to it.timeToLive,
|
|
857
872
|
).toJson()
|
|
858
873
|
}
|
|
859
874
|
|
|
@@ -960,7 +975,10 @@ fun generateSearchPersonRequest(it: SearchPersonRequest) = mapOf(
|
|
|
960
975
|
|
|
961
976
|
fun searchPersonDetectionFromJSON(input: JSONObject?) = input?.let {
|
|
962
977
|
val result = Detection::class.constructor().instantiate()
|
|
963
|
-
result.setPrivateProperty(
|
|
978
|
+
result.setPrivateProperty(
|
|
979
|
+
"landmarks",
|
|
980
|
+
it.getJSONArrayOrNull("landmarks").toList(::pointFromJSON)
|
|
981
|
+
)
|
|
964
982
|
result.setPrivateProperty("rect", rectFromJSON(it.getJSONObject("rect")))
|
|
965
983
|
result.setPrivateProperty("cropImage", it.getStringOrNull("crop"))
|
|
966
984
|
result.setPrivateProperty("rotationAngle", it.getDouble("rotationAngle"))
|
|
@@ -979,7 +997,8 @@ fun generateSearchPersonDetection(input: Detection?) = input?.let {
|
|
|
979
997
|
}
|
|
980
998
|
|
|
981
999
|
fun searchPersonImageFromJSON(input: JSONObject): SearchPersonImage = input.let {
|
|
982
|
-
val result = SearchPersonImage::class.constructor(PersonImage::class)
|
|
1000
|
+
val result = SearchPersonImage::class.constructor(PersonImage::class)
|
|
1001
|
+
.instantiate(personImageFromJSON(it))
|
|
983
1002
|
result.similarity = it.getDouble("similarity")
|
|
984
1003
|
result.distance = it.getDouble("distance")
|
|
985
1004
|
result
|
|
@@ -999,8 +1018,11 @@ fun generateSearchPersonImage(it: SearchPersonImage) = mapOf(
|
|
|
999
1018
|
fun searchPersonFromJSON(input: JSONObject?) = input?.let {
|
|
1000
1019
|
val result = SearchPerson::class.constructor(Person::class).instantiate(personFromJSON(it))
|
|
1001
1020
|
result.images = it.getJSONArray("images").toList(::searchPersonImageFromJSON)
|
|
1002
|
-
result.setPrivateProperty(
|
|
1003
|
-
|
|
1021
|
+
result.setPrivateProperty(
|
|
1022
|
+
"detection",
|
|
1023
|
+
searchPersonDetectionFromJSON(it.getJSONObjectOrNull("detection"))
|
|
1024
|
+
)
|
|
1025
|
+
result.setPrivateProperty("g", it.getJSONArray("groups").toArray<String>())
|
|
1004
1026
|
result
|
|
1005
1027
|
}
|
|
1006
1028
|
|
|
@@ -1013,6 +1035,32 @@ fun generateSearchPerson(input: SearchPerson?) = input?.let {
|
|
|
1013
1035
|
"updatedAt" to it.updatedAt.toStr(),
|
|
1014
1036
|
"id" to it.id,
|
|
1015
1037
|
"metadata" to it.metadata,
|
|
1016
|
-
"createdAt" to it.createdAt.toStr()
|
|
1038
|
+
"createdAt" to it.createdAt.toStr(),
|
|
1039
|
+
"expireAt" to it.expireAt.toStr(),
|
|
1040
|
+
"externalId" to it.externalId,
|
|
1041
|
+
"ttl" to it.timeToLive,
|
|
1042
|
+
).toJson()
|
|
1043
|
+
}
|
|
1044
|
+
|
|
1045
|
+
fun searchPersonFilterFromJSON(input: JSONObject?) = input?.let {
|
|
1046
|
+
val result = SearchPersonFilter()
|
|
1047
|
+
result.groups = it.getJSONArray("groups").toArray<String>()
|
|
1048
|
+
result.threshold = it.get("threshold").toFloat()
|
|
1049
|
+
result.limit = it.getInt("limit")
|
|
1050
|
+
val fieldName = it.getStringOrNull("fieldName")
|
|
1051
|
+
val fieldValues = it.getJSONArrayOrNull("fieldValues").toArray<String>()
|
|
1052
|
+
val exclude = it.getBoolean("exclude")
|
|
1053
|
+
result.filterField(fieldName, fieldValues, exclude)
|
|
1054
|
+
result
|
|
1055
|
+
}
|
|
1056
|
+
|
|
1057
|
+
fun generateSearchPersonFilter(input: SearchPersonFilter?) = input?.let {
|
|
1058
|
+
mapOf(
|
|
1059
|
+
"groups" to it.groups.toJson(),
|
|
1060
|
+
"threshold" to it.threshold,
|
|
1061
|
+
"limit" to it.limit,
|
|
1062
|
+
"fieldName" to it.fieldName,
|
|
1063
|
+
"fieldValues" to it.fieldValues.toJson(),
|
|
1064
|
+
"exclude" to it.isExclude,
|
|
1017
1065
|
).toJson()
|
|
1018
1066
|
}
|
|
@@ -82,12 +82,24 @@ inline fun <reified T> JSONArray?.toArray() = this?.let {
|
|
|
82
82
|
result
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
+
inline fun <reified T> JSONArray?.toArray(fromJson: (JSONObject?) -> T?) = this?.let {
|
|
86
|
+
val result = arrayOfNulls<T>(length())
|
|
87
|
+
for (i in 0 until length()) result[i] = fromJson(getJSONObject(i))
|
|
88
|
+
result
|
|
89
|
+
}
|
|
90
|
+
|
|
85
91
|
fun <T> Array<T>?.toJson() = this?.let {
|
|
86
92
|
val result = JSONArray()
|
|
87
93
|
for (i in it.indices) result.put(i, it[i])
|
|
88
94
|
result
|
|
89
95
|
}
|
|
90
96
|
|
|
97
|
+
fun <T> Array<T>?.toJson(toJson: (T?) -> JSONObject?) = this?.let {
|
|
98
|
+
val result = JSONArray()
|
|
99
|
+
for (i in indices) result.put(i, toJson(this[i]))
|
|
100
|
+
result
|
|
101
|
+
}
|
|
102
|
+
|
|
91
103
|
fun <T> List<T>?.toArrayList(): ArrayList<T>? = this?.let { ArrayList(this) }
|
|
92
104
|
|
|
93
105
|
fun JSONObject.forEach(action: (String, Any) -> Unit) {
|
|
@@ -123,10 +135,14 @@ fun Any.toFloat() = when (this) {
|
|
|
123
135
|
}
|
|
124
136
|
|
|
125
137
|
@SuppressLint("SimpleDateFormat")
|
|
126
|
-
fun String
|
|
138
|
+
fun String?.toDate() = this?.let {
|
|
139
|
+
SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS").parse(this)!!
|
|
140
|
+
}
|
|
127
141
|
|
|
128
142
|
@SuppressLint("SimpleDateFormat")
|
|
129
|
-
fun Date
|
|
143
|
+
fun Date?.toStr(): String? = this?.let {
|
|
144
|
+
SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS").format(this)
|
|
145
|
+
}
|
|
130
146
|
|
|
131
147
|
fun Any.setColor(customization: Customization, value: Any) {
|
|
132
148
|
val uiConfig = customization.uiConfigurationLive.value!!
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
"android": "scripts/android.sh"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@regulaforensics/face-sdk": "8.4.
|
|
10
|
-
"@regulaforensics/face-core-basic": "8.4.
|
|
9
|
+
"@regulaforensics/face-sdk": "8.4.1344-rc",
|
|
10
|
+
"@regulaforensics/face-core-basic": "8.4.819-rc",
|
|
11
11
|
"@awesome-cordova-plugins/file": "^8.1.0",
|
|
12
12
|
"@awesome-cordova-plugins/camera": "^8.1.0",
|
|
13
13
|
"cordova-plugin-file": "^8.1.3",
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
"@awesome-cordova-plugins/camera": "^9.2.0",
|
|
21
21
|
"@awesome-cordova-plugins/dialogs": "^9.2.0",
|
|
22
22
|
"@awesome-cordova-plugins/file": "^9.2.0",
|
|
23
|
-
"@regulaforensics/face-sdk": "8.4.
|
|
24
|
-
"@regulaforensics/face-core-basic": "8.4.
|
|
23
|
+
"@regulaforensics/face-sdk": "8.4.1344-rc",
|
|
24
|
+
"@regulaforensics/face-core-basic": "8.4.819-rc",
|
|
25
25
|
"cordova-android": "^15.0.0",
|
|
26
26
|
"cordova-ios": "^8.1.1",
|
|
27
27
|
"cordova-plugin-camera": "^8.0.0",
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
"start": "expo start"
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@regulaforensics/face-sdk": "8.4.
|
|
12
|
-
"@regulaforensics/face-core-basic": "8.4.
|
|
11
|
+
"@regulaforensics/face-sdk": "8.4.1344-rc",
|
|
12
|
+
"@regulaforensics/face-core-basic": "8.4.819-rc",
|
|
13
13
|
"react-native": "^0.81.4",
|
|
14
14
|
"react-native-fs": "^2.20.0",
|
|
15
15
|
"react-native-image-picker": "^8.2.1",
|