@soyio/soyio-rn-sdk 5.0.0 → 6.0.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/README.md +28 -112
- package/package/src/bridges/facetec.js +16 -8
- package/package/src/bridges/facetec.js.map +1 -1
- package/package.json +9 -7
- package/android/build.gradle +0 -57
- package/android/libs/facetec-sdk-9.7.114.aar +0 -0
- package/android/src/main/AndroidManifest.xml +0 -8
- package/android/src/main/java/com/soyio/soyiorndk/AndroidFacetecSdkModule.kt +0 -224
- package/android/src/main/java/com/soyio/soyiorndk/AndroidFacetecSdkPackage.kt +0 -16
- package/android/src/main/java/com/soyio/soyiorndk/ApiDate.kt +0 -5
- package/android/src/main/java/com/soyio/soyiorndk/BaseFaceTecProcessor.kt +0 -75
- package/android/src/main/java/com/soyio/soyiorndk/FaceTecRequestService.kt +0 -115
- package/android/src/main/java/com/soyio/soyiorndk/FacetecConfig.kt +0 -311
- package/android/src/main/java/com/soyio/soyiorndk/SoyioIdOnlyProcessor.kt +0 -81
- package/android/src/main/java/com/soyio/soyiorndk/SoyioValidationProcessor.kt +0 -136
- package/android/src/main/res/drawable-nodpi/soyio_facetec_close.png +0 -0
- package/android/src/main/res/drawable-nodpi/soyio_facetec_id_front.png +0 -0
- package/android/src/main/res/values/strings.xml +0 -134
- package/assets/adaptive-icon.png +0 -0
- package/assets/favicon.png +0 -0
- package/assets/fonts/RobotoFlex.ttf +0 -0
- package/assets/icon.png +0 -0
- package/assets/images/SoyioRnSdk.xcassets/facetec-close.imageset/Contents.json +0 -23
- package/assets/images/SoyioRnSdk.xcassets/facetec-close.imageset/facetec-close@1x.png +0 -0
- package/assets/images/SoyioRnSdk.xcassets/facetec-close.imageset/facetec-close@2x.png +0 -0
- package/assets/images/SoyioRnSdk.xcassets/facetec-close.imageset/facetec-close@3x.png +0 -0
- package/assets/images/SoyioRnSdk.xcassets/facetec-id-front.imageset/Contents.json +0 -23
- package/assets/images/SoyioRnSdk.xcassets/facetec-id-front.imageset/facetec-id-front@1x.png +0 -0
- package/assets/images/SoyioRnSdk.xcassets/facetec-id-front.imageset/facetec-id-front@2x.png +0 -0
- package/assets/images/SoyioRnSdk.xcassets/facetec-id-front.imageset/facetec-id-front@3x.png +0 -0
- package/assets/splash.png +0 -0
- package/ios/ApiDate.swift +0 -5
- package/ios/FacetecConfig.swift +0 -217
- package/ios/FacetecStrings.swift +0 -139
- package/ios/Frameworks/FaceTecSDK.xcframework/Info.plist +0 -44
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64/FaceTecSDK.framework/Assets.car +0 -0
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64/FaceTecSDK.framework/FaceTecSDK +0 -0
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64/FaceTecSDK.framework/GenericGuidanceContentLayout.nib +0 -0
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64/FaceTecSDK.framework/Headers/FaceTecPublicApi.h +0 -1935
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64/FaceTecSDK.framework/Headers/FaceTecPublicStringKeys.h +0 -109
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64/FaceTecSDK.framework/Headers/FaceTecSDK.h +0 -16
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64/FaceTecSDK.framework/Info.plist +0 -0
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64/FaceTecSDK.framework/Modules/module.modulemap +0 -6
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64/FaceTecSDK.framework/PrivacyInfo.xcprivacy +0 -29
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64/FaceTecSDK.framework/ReadyScreenGuidanceContentLayout.nib +0 -0
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64/FaceTecSDK.framework/RetryScreenGuidanceContentLayout.nib +0 -0
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64/FaceTecSDK.framework/SharedGuidanceLayout.nib +0 -0
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64/FaceTecSDK.framework/Storyboard.storyboardc/9Uo-4b-JiE-view-Ae0-rb-UqS.nib +0 -0
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64/FaceTecSDK.framework/Storyboard.storyboardc/CJ6-MX-bJp-view-8JL-Rc-0g1.nib +0 -0
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64/FaceTecSDK.framework/Storyboard.storyboardc/FaceScanViewController.nib +0 -0
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64/FaceTecSDK.framework/Storyboard.storyboardc/FaceTecAdditionalReviewViewController.nib +0 -0
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64/FaceTecSDK.framework/Storyboard.storyboardc/FaceTecIDFeedbackViewController.nib +0 -0
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64/FaceTecSDK.framework/Storyboard.storyboardc/FaceTecOCRConfirmationViewController.nib +0 -0
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64/FaceTecSDK.framework/Storyboard.storyboardc/IDCaptureViewController.nib +0 -0
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64/FaceTecSDK.framework/Storyboard.storyboardc/IDSelectionViewController.nib +0 -0
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64/FaceTecSDK.framework/Storyboard.storyboardc/Info.plist +0 -0
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64/FaceTecSDK.framework/Storyboard.storyboardc/Pyw-6G-JSY-view-Zue-Eo-Q2U.nib +0 -0
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64/FaceTecSDK.framework/Storyboard.storyboardc/QWA-8Y-vUM-view-wJB-Z5-eD2.nib +0 -0
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64/FaceTecSDK.framework/Storyboard.storyboardc/alz-Ia-X3d-view-IKu-EI-Hug.nib +0 -0
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64/FaceTecSDK.framework/Storyboard.storyboardc/l2Q-cc-kD8-view-UUy-6c-meu.nib +0 -0
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64/FaceTecSDK.framework/_CodeSignature/CodeResources +0 -729
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64/FaceTecSDK.framework/af.lproj/FaceTec.strings +0 -0
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64/FaceTecSDK.framework/ar.lproj/FaceTec.strings +0 -0
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64/FaceTecSDK.framework/attributions.txt +0 -462
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64/FaceTecSDK.framework/cache_uyertuazlkxcjrlwkejr/39bb748b334003e3fa/1f5b84f51ce0fcfbb76e904b7bcaa7560f601e1394a0b29367a09385312287eb +0 -0
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64/FaceTecSDK.framework/cache_uyertuazlkxcjrlwkejr/39bb748b334003e3fa/2b075ac1a6132b5b8a4c9ef0ba6b0cd84db7838aca9a000e50d907f40770a4ab +0 -0
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64/FaceTecSDK.framework/cache_uyertuazlkxcjrlwkejr/39bb748b334003e3fa/59cc2a9af81aaca2376702c2490650f4da2775fa673274db98aad41b7ef101c0 +0 -0
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64/FaceTecSDK.framework/cache_uyertuazlkxcjrlwkejr/39bb748b334003e3fa/5b63e98b991aedabb60665503384f30bffd939decf9433883b30b78011ee501a +0 -0
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64/FaceTecSDK.framework/cache_uyertuazlkxcjrlwkejr/39bb748b334003e3fa/66388dc76dc16bc6b76b682edd218a575bf45b9b +0 -0
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64/FaceTecSDK.framework/cache_uyertuazlkxcjrlwkejr/39bb748b334003e3fa/6b3133f0f39ff89a2a169d61176ee17cafacc5e288f334e2b64ee82892d11ccd +0 -0
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64/FaceTecSDK.framework/cache_uyertuazlkxcjrlwkejr/39bb748b334003e3fa/9077d16225f9314163ef1e7db6fc7d4088bb903d134bd95f23d5591ca4dfbfca +0 -0
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64/FaceTecSDK.framework/cache_uyertuazlkxcjrlwkejr/39bb748b334003e3fa/a74f2afb9d20f2375ccbd14e67c094b85c89ceb608f7cf8ae04f3f646a6c5672 +0 -0
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64/FaceTecSDK.framework/cache_uyertuazlkxcjrlwkejr/39bb748b334003e3fa/b501893e75f62ee1707643e35b21109927b07ed5b202321c961b424cbc2e4695 +0 -0
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64/FaceTecSDK.framework/cache_uyertuazlkxcjrlwkejr/39bb748b334003e3fa/dbd7a353f0130bb983d6ba05917e9be991d70e8f028df4b74e30bc6497ef7f71 +0 -0
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64/FaceTecSDK.framework/cache_uyertuazlkxcjrlwkejr/39bb748b334003e3fa/f2.xml +0 -0
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64/FaceTecSDK.framework/cache_uyertuazlkxcjrlwkejr/39bb748b334003e3fa/fd6d368a5658496536e2bfae170d1b823a3629b242cafc09784bfba4e56d8c80 +0 -0
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64/FaceTecSDK.framework/cache_uyertuazlkxcjrlwkejr/39bb748b334003e3fa/marker +0 -0
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64/FaceTecSDK.framework/cache_uyertuazlkxcjrlwkejr/39bb748b334003e3fa/vu0ilin6we3lrzo5f83f7qs2jul4aq7v4aoynrmch8zfvpi8ezrfyafa4t0fx87l +0 -0
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64/FaceTecSDK.framework/de.lproj/FaceTec.strings +0 -0
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64/FaceTecSDK.framework/el.lproj/FaceTec.strings +0 -0
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64/FaceTecSDK.framework/en.lproj/FaceTec.strings +0 -0
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64/FaceTecSDK.framework/es.lproj/FaceTec.strings +0 -0
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64/FaceTecSDK.framework/fr.lproj/FaceTec.strings +0 -0
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64/FaceTecSDK.framework/kk.lproj/FaceTec.strings +0 -0
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64/FaceTecSDK.framework/nb.lproj/FaceTec.strings +0 -0
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64/FaceTecSDK.framework/pt-BR.lproj/FaceTec.strings +0 -0
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64/FaceTecSDK.framework/ru.lproj/FaceTec.strings +0 -0
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64/FaceTecSDK.framework/strip-unused-architectures-from-target.sh +0 -62
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64_x86_64-simulator/FaceTecSDK.framework/FaceTecSDK +0 -0
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64_x86_64-simulator/FaceTecSDK.framework/Headers/FaceTecPublicApi.h +0 -1935
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64_x86_64-simulator/FaceTecSDK.framework/Headers/FaceTecPublicStringKeys.h +0 -109
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64_x86_64-simulator/FaceTecSDK.framework/Headers/FaceTecSDK.h +0 -16
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64_x86_64-simulator/FaceTecSDK.framework/Info.plist +0 -0
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64_x86_64-simulator/FaceTecSDK.framework/Modules/module.modulemap +0 -6
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64_x86_64-simulator/FaceTecSDK.framework/_CodeSignature/CodeResources +0 -146
- package/ios/IOSFacetecSdk.m +0 -22
- package/ios/IOSFacetecSdk.swift +0 -221
- package/ios/ProcessorProtocol.swift +0 -6
- package/ios/SoyioIDOnlyProcessor.swift +0 -170
- package/ios/SoyioPhotoIDMatchProcessor.swift +0 -264
- package/package/package.json +0 -68
- package/react-native.config.js +0 -12
- package/scripts/prepare-facetec-xcframework.sh +0 -38
- package/soyio_rn_sdk.podspec +0 -52
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
package com.soyio.soyiorndk
|
|
2
|
-
|
|
3
|
-
import android.app.Activity
|
|
4
|
-
import android.app.Application
|
|
5
|
-
import android.os.Bundle
|
|
6
|
-
import android.os.Handler
|
|
7
|
-
import android.os.Looper
|
|
8
|
-
import com.facebook.react.bridge.Arguments
|
|
9
|
-
import com.facebook.react.bridge.Promise
|
|
10
|
-
import com.facetec.sdk.FaceTecSessionActivity
|
|
11
|
-
|
|
12
|
-
abstract class BaseFaceTecProcessor(
|
|
13
|
-
private val promise: Promise,
|
|
14
|
-
private val errorCode: String,
|
|
15
|
-
activity: Activity,
|
|
16
|
-
) {
|
|
17
|
-
private val mainHandler = Handler(Looper.getMainLooper())
|
|
18
|
-
private val application = activity.application
|
|
19
|
-
private var promiseResolved = false
|
|
20
|
-
protected val defaultError = "unknown_error"
|
|
21
|
-
protected val flowCancelledError = "FLOW_CANCELLED"
|
|
22
|
-
|
|
23
|
-
@Volatile private var isSuccess = false
|
|
24
|
-
@Volatile private var failureMessage: String? = null
|
|
25
|
-
|
|
26
|
-
private val lifecycleCallbacks = object : Application.ActivityLifecycleCallbacks {
|
|
27
|
-
override fun onActivityDestroyed(a: Activity) {
|
|
28
|
-
if (a is FaceTecSessionActivity) {
|
|
29
|
-
resolveFromTrackedState()
|
|
30
|
-
application.unregisterActivityLifecycleCallbacks(this)
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
override fun onActivityCreated(a: Activity, b: Bundle?) {}
|
|
34
|
-
override fun onActivityStarted(a: Activity) {}
|
|
35
|
-
override fun onActivityResumed(a: Activity) {}
|
|
36
|
-
override fun onActivityPaused(a: Activity) {}
|
|
37
|
-
override fun onActivityStopped(a: Activity) {}
|
|
38
|
-
override fun onActivitySaveInstanceState(a: Activity, b: Bundle) {}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
init {
|
|
42
|
-
application.registerActivityLifecycleCallbacks(lifecycleCallbacks)
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
protected fun markSuccess() {
|
|
46
|
-
isSuccess = true
|
|
47
|
-
failureMessage = null
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
protected fun markFailure(message: String = defaultError) {
|
|
51
|
-
isSuccess = false
|
|
52
|
-
failureMessage = message
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
@Synchronized
|
|
56
|
-
private fun resolveFromTrackedState() {
|
|
57
|
-
if (promiseResolved) return
|
|
58
|
-
promiseResolved = true
|
|
59
|
-
mainHandler.post {
|
|
60
|
-
val result = Arguments.createMap().apply {
|
|
61
|
-
putBoolean("success", isSuccess)
|
|
62
|
-
if (!isSuccess) putString("error", failureMessage ?: defaultError)
|
|
63
|
-
}
|
|
64
|
-
promise.resolve(result)
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
@Synchronized
|
|
69
|
-
protected fun reject(message: String) {
|
|
70
|
-
if (promiseResolved) return
|
|
71
|
-
promiseResolved = true
|
|
72
|
-
application.unregisterActivityLifecycleCallbacks(lifecycleCallbacks)
|
|
73
|
-
mainHandler.post { promise.reject(errorCode, message) }
|
|
74
|
-
}
|
|
75
|
-
}
|
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
package com.soyio.soyiorndk
|
|
2
|
-
|
|
3
|
-
import com.facetec.sdk.FaceTecSDK
|
|
4
|
-
import okhttp3.Call
|
|
5
|
-
import okhttp3.Callback
|
|
6
|
-
import okhttp3.MediaType.Companion.toMediaTypeOrNull
|
|
7
|
-
import okhttp3.OkHttpClient
|
|
8
|
-
import okhttp3.Request
|
|
9
|
-
import okhttp3.RequestBody
|
|
10
|
-
import okhttp3.RequestBody.Companion.toRequestBody
|
|
11
|
-
import okhttp3.Response
|
|
12
|
-
import okio.Buffer
|
|
13
|
-
import okio.ForwardingSink
|
|
14
|
-
import okio.buffer
|
|
15
|
-
import org.json.JSONObject
|
|
16
|
-
import java.io.IOException
|
|
17
|
-
import java.util.concurrent.TimeUnit
|
|
18
|
-
|
|
19
|
-
internal class FaceTecRequestService(
|
|
20
|
-
baseUrl: String,
|
|
21
|
-
private val resourcePath: String,
|
|
22
|
-
private val requestableToken: String,
|
|
23
|
-
private val authToken: String,
|
|
24
|
-
) {
|
|
25
|
-
private val normalizedBaseUrl = if (baseUrl.endsWith('/')) baseUrl.dropLast(1) else baseUrl
|
|
26
|
-
|
|
27
|
-
fun post(
|
|
28
|
-
endpoint: String,
|
|
29
|
-
payload: JSONObject,
|
|
30
|
-
sessionId: String?,
|
|
31
|
-
progress: ((Float) -> Unit)? = null,
|
|
32
|
-
networkErrorMessage: String = DEFAULT_NETWORK_ERROR,
|
|
33
|
-
onSuccess: (JSONObject) -> Unit,
|
|
34
|
-
onFailure: (String) -> Unit,
|
|
35
|
-
) {
|
|
36
|
-
val mediaType = "application/json; charset=utf-8".toMediaTypeOrNull()
|
|
37
|
-
val requestBody = payload.toString().toRequestBody(mediaType)
|
|
38
|
-
val bodyWithProgress = progress?.let { createProgressBody(requestBody, it) } ?: requestBody
|
|
39
|
-
|
|
40
|
-
val request = Request.Builder()
|
|
41
|
-
.url(buildUrl(endpoint))
|
|
42
|
-
.header("Content-Type", "application/json")
|
|
43
|
-
.header("Authorization", authToken)
|
|
44
|
-
.header("X-Facetec-Session-Id", sessionId ?: "")
|
|
45
|
-
.header(
|
|
46
|
-
"X-Facetec-User-Agent",
|
|
47
|
-
FaceTecSDK.createFaceTecAPIUserAgentString(sessionId ?: ""),
|
|
48
|
-
)
|
|
49
|
-
.header("X-Api-Version", ApiDate.iso)
|
|
50
|
-
.post(bodyWithProgress)
|
|
51
|
-
.build()
|
|
52
|
-
|
|
53
|
-
client.newCall(request).enqueue(object : Callback {
|
|
54
|
-
override fun onFailure(call: Call, e: IOException) {
|
|
55
|
-
onFailure(e.message ?: networkErrorMessage)
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
override fun onResponse(call: Call, response: Response) {
|
|
59
|
-
response.use {
|
|
60
|
-
val responseBody = response.body?.string().orEmpty()
|
|
61
|
-
if (!response.isSuccessful) {
|
|
62
|
-
onFailure("FaceTec API error ${response.code}: $responseBody")
|
|
63
|
-
return
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
try {
|
|
67
|
-
val json = JSONObject(responseBody)
|
|
68
|
-
onSuccess(json)
|
|
69
|
-
} catch (exception: Exception) {
|
|
70
|
-
onFailure(exception.message ?: "Failed to parse FaceTec response.")
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
})
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
private fun buildUrl(endpoint: String): String {
|
|
78
|
-
return "$normalizedBaseUrl/api/internal/$resourcePath/$requestableToken/facetec/$endpoint"
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
private fun createProgressBody(originalBody: RequestBody, onProgress: (Float) -> Unit): RequestBody {
|
|
82
|
-
return object : RequestBody() {
|
|
83
|
-
override fun contentType() = originalBody.contentType()
|
|
84
|
-
override fun contentLength() = originalBody.contentLength()
|
|
85
|
-
|
|
86
|
-
override fun writeTo(sink: okio.BufferedSink) {
|
|
87
|
-
val countingSink = object : ForwardingSink(sink) {
|
|
88
|
-
var bytesWritten = 0L
|
|
89
|
-
val totalLength = contentLength()
|
|
90
|
-
override fun write(source: Buffer, byteCount: Long) {
|
|
91
|
-
super.write(source, byteCount)
|
|
92
|
-
bytesWritten += byteCount
|
|
93
|
-
if (totalLength > 0) {
|
|
94
|
-
onProgress(bytesWritten.toFloat() / totalLength.toFloat())
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
val bufferedSink = countingSink.buffer()
|
|
100
|
-
originalBody.writeTo(bufferedSink)
|
|
101
|
-
bufferedSink.flush()
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
companion object {
|
|
107
|
-
private val client = OkHttpClient.Builder()
|
|
108
|
-
.connectTimeout(60, TimeUnit.SECONDS)
|
|
109
|
-
.readTimeout(60, TimeUnit.SECONDS)
|
|
110
|
-
.writeTimeout(60, TimeUnit.SECONDS)
|
|
111
|
-
.build()
|
|
112
|
-
|
|
113
|
-
private const val DEFAULT_NETWORK_ERROR = "Network error while contacting FaceTec endpoint."
|
|
114
|
-
}
|
|
115
|
-
}
|
|
@@ -1,311 +0,0 @@
|
|
|
1
|
-
package com.soyio.soyiorndk
|
|
2
|
-
|
|
3
|
-
import android.graphics.Color
|
|
4
|
-
import android.graphics.Typeface
|
|
5
|
-
import com.facebook.react.bridge.ReadableMap
|
|
6
|
-
import com.facebook.react.bridge.ReactApplicationContext
|
|
7
|
-
import com.facetec.sdk.FaceTecCancelButtonCustomization
|
|
8
|
-
import com.facetec.sdk.FaceTecCustomization
|
|
9
|
-
import com.facetec.sdk.FaceTecSDK
|
|
10
|
-
import com.facetec.sdk.FaceTecSecurityWatermarkImage
|
|
11
|
-
|
|
12
|
-
internal object FacetecConfig {
|
|
13
|
-
fun apply(reactContext: ReactApplicationContext, theme: ReadableMap?) {
|
|
14
|
-
val colors = resolveThemeColors(theme)
|
|
15
|
-
val customization = FaceTecCustomization()
|
|
16
|
-
val regularFont = typeface(reactContext, Typeface.NORMAL)
|
|
17
|
-
val mediumFont = typeface(reactContext, Typeface.NORMAL, "sans-serif-medium")
|
|
18
|
-
val semiBoldFont = typeface(reactContext, Typeface.BOLD, "sans-serif-medium")
|
|
19
|
-
val boldFont = typeface(reactContext, Typeface.BOLD)
|
|
20
|
-
|
|
21
|
-
customization.frameCustomization.apply {
|
|
22
|
-
cornerRadius = 20
|
|
23
|
-
backgroundColor = colors.white
|
|
24
|
-
borderColor = colors.white
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
customization.overlayCustomization.apply {
|
|
28
|
-
showBrandingImage = false
|
|
29
|
-
backgroundColor = colors.white
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
customization.guidanceCustomization.apply {
|
|
33
|
-
backgroundColors = colors.white
|
|
34
|
-
foregroundColor = colors.black
|
|
35
|
-
buttonBackgroundNormalColor = colors.main
|
|
36
|
-
buttonBackgroundDisabledColor = colors.disabled
|
|
37
|
-
buttonBackgroundHighlightColor = colors.highlight
|
|
38
|
-
buttonCornerRadius = 8
|
|
39
|
-
buttonTextNormalColor = colors.white
|
|
40
|
-
buttonTextDisabledColor = colors.white
|
|
41
|
-
buttonTextHighlightColor = colors.white
|
|
42
|
-
retryScreenImageBorderColor = colors.white
|
|
43
|
-
retryScreenOvalStrokeColor = colors.white
|
|
44
|
-
headerFont = semiBoldFont
|
|
45
|
-
subtextFont = regularFont
|
|
46
|
-
buttonFont = boldFont
|
|
47
|
-
readyScreenHeaderFont = semiBoldFont
|
|
48
|
-
readyScreenSubtextFont = regularFont
|
|
49
|
-
retryScreenHeaderFont = semiBoldFont
|
|
50
|
-
retryScreenSubtextFont = regularFont
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
customization.ovalCustomization.apply {
|
|
54
|
-
strokeColor = colors.main
|
|
55
|
-
progressColor1 = colors.main
|
|
56
|
-
progressColor2 = colors.main
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
customization.feedbackCustomization.apply {
|
|
60
|
-
backgroundColors = colors.black
|
|
61
|
-
textColor = colors.white
|
|
62
|
-
textFont = mediumFont
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
customization.cancelButtonCustomization.apply {
|
|
66
|
-
location = FaceTecCancelButtonCustomization.ButtonLocation.TOP_LEFT
|
|
67
|
-
customImage = R.drawable.soyio_facetec_close
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
customization.resultScreenCustomization.apply {
|
|
71
|
-
backgroundColors = colors.white
|
|
72
|
-
foregroundColor = colors.black
|
|
73
|
-
activityIndicatorColor = colors.main
|
|
74
|
-
resultAnimationBackgroundColor = colors.main
|
|
75
|
-
resultAnimationForegroundColor = colors.white
|
|
76
|
-
uploadProgressFillColor = colors.main
|
|
77
|
-
messageFont = regularFont
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
customization.securityWatermarkImage = FaceTecSecurityWatermarkImage.FACETEC
|
|
81
|
-
|
|
82
|
-
customization.idScanCustomization.apply {
|
|
83
|
-
showSelectionScreenDocumentImage = true
|
|
84
|
-
selectionScreenDocumentImage = R.drawable.soyio_facetec_id_front
|
|
85
|
-
selectionScreenForegroundColor = colors.black
|
|
86
|
-
reviewScreenBackgroundColors = colors.white
|
|
87
|
-
reviewScreenForegroundColor = colors.white
|
|
88
|
-
reviewScreenTextBackgroundColor = colors.main
|
|
89
|
-
captureScreenForegroundColor = colors.white
|
|
90
|
-
captureScreenTextBackgroundColor = colors.black
|
|
91
|
-
buttonBackgroundNormalColor = colors.main
|
|
92
|
-
buttonBackgroundDisabledColor = colors.disabled
|
|
93
|
-
buttonBackgroundHighlightColor = colors.highlight
|
|
94
|
-
buttonTextNormalColor = colors.white
|
|
95
|
-
buttonTextDisabledColor = colors.white
|
|
96
|
-
buttonTextHighlightColor = colors.white
|
|
97
|
-
captureScreenBackgroundColor = colors.white
|
|
98
|
-
captureFrameStrokeColor = colors.white
|
|
99
|
-
buttonCornerRadius = 8
|
|
100
|
-
headerFont = semiBoldFont
|
|
101
|
-
subtextFont = regularFont
|
|
102
|
-
buttonFont = boldFont
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
customization.ocrConfirmationCustomization.apply {
|
|
106
|
-
mainHeaderFont = boldFont
|
|
107
|
-
sectionHeaderFont = semiBoldFont
|
|
108
|
-
fieldLabelFont = regularFont
|
|
109
|
-
fieldValueFont = regularFont
|
|
110
|
-
inputFieldFont = regularFont
|
|
111
|
-
inputFieldPlaceholderFont = regularFont
|
|
112
|
-
buttonFont = boldFont
|
|
113
|
-
}
|
|
114
|
-
customization.initialLoadingAnimationCustomization.messageFont = regularFont
|
|
115
|
-
|
|
116
|
-
FaceTecSDK.setCustomization(customization)
|
|
117
|
-
FaceTecSDK.setLowLightCustomization(customization)
|
|
118
|
-
FaceTecSDK.setDynamicDimmingCustomization(customization)
|
|
119
|
-
applySpanishLocalization(reactContext)
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
private fun resolveThemeColors(theme: ReadableMap?): ThemeColors {
|
|
123
|
-
val main = theme?.getOptionalColor("mainColor") ?: Color.parseColor(DEFAULT_MAIN_COLOR)
|
|
124
|
-
val highlight = theme?.getOptionalColor("highlightColor") ?: Color.parseColor(DEFAULT_HIGHLIGHT_COLOR)
|
|
125
|
-
val disabled = theme?.getOptionalColor("disabledColor") ?: Color.parseColor(DEFAULT_DISABLED_COLOR)
|
|
126
|
-
return ThemeColors(main = main, highlight = highlight, disabled = disabled)
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
private fun ReadableMap.getOptionalColor(key: String): Int? {
|
|
130
|
-
if (!hasKey(key) || isNull(key)) return null
|
|
131
|
-
val value = getString(key) ?: return null
|
|
132
|
-
return try {
|
|
133
|
-
Color.parseColor(value)
|
|
134
|
-
} catch (_: IllegalArgumentException) {
|
|
135
|
-
null
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
private fun typeface(reactContext: ReactApplicationContext, style: Int, fallbackFamily: String = "sans-serif"): Typeface {
|
|
140
|
-
val base = try {
|
|
141
|
-
Typeface.createFromAsset(reactContext.assets, ROBOTO_FLEX_PATH)
|
|
142
|
-
} catch (_: Exception) {
|
|
143
|
-
null
|
|
144
|
-
} ?: Typeface.create(fallbackFamily, Typeface.NORMAL)
|
|
145
|
-
|
|
146
|
-
return Typeface.create(base, style)
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
private fun applySpanishLocalization(reactContext: ReactApplicationContext) {
|
|
150
|
-
try {
|
|
151
|
-
val resources = reactContext.resources
|
|
152
|
-
// FaceTec resources merge into the host app package, so resolve ids from the host package.
|
|
153
|
-
val hostPackage = reactContext.packageName
|
|
154
|
-
val overrides = HashMap<Int, String>()
|
|
155
|
-
|
|
156
|
-
FACETEC_STRING_KEYS.forEach { keyName ->
|
|
157
|
-
val valueResId = resources.getIdentifier(
|
|
158
|
-
"soyio_facetec_${keyName.removePrefix("FaceTec_")}",
|
|
159
|
-
"string",
|
|
160
|
-
hostPackage,
|
|
161
|
-
)
|
|
162
|
-
val faceTecResId = resources.getIdentifier(keyName, "string", hostPackage)
|
|
163
|
-
if (valueResId != 0 && faceTecResId != 0) {
|
|
164
|
-
overrides[faceTecResId] = resources.getString(valueResId)
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
if (overrides.isNotEmpty()) {
|
|
169
|
-
FaceTecSDK.setDynamicStrings(overrides)
|
|
170
|
-
}
|
|
171
|
-
} catch (_: Exception) {
|
|
172
|
-
// Silently ignore; FaceTec will fall back to its bundled defaults.
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
private data class ThemeColors(
|
|
177
|
-
val main: Int,
|
|
178
|
-
val highlight: Int,
|
|
179
|
-
val disabled: Int,
|
|
180
|
-
val black: Int = Color.parseColor("#000000"),
|
|
181
|
-
val white: Int = Color.parseColor("#FFFFFF"),
|
|
182
|
-
)
|
|
183
|
-
|
|
184
|
-
private const val ROBOTO_FLEX_PATH = "fonts/RobotoFlex.ttf"
|
|
185
|
-
private const val DEFAULT_MAIN_COLOR = "#3340CF"
|
|
186
|
-
private const val DEFAULT_HIGHLIGHT_COLOR = "#2A35B0"
|
|
187
|
-
private const val DEFAULT_DISABLED_COLOR = "#9BA3D8"
|
|
188
|
-
private val FACETEC_STRING_KEYS = listOf(
|
|
189
|
-
// Actions
|
|
190
|
-
"FaceTec_action_ok",
|
|
191
|
-
"FaceTec_action_im_ready",
|
|
192
|
-
"FaceTec_action_try_again",
|
|
193
|
-
"FaceTec_action_continue",
|
|
194
|
-
"FaceTec_action_take_photo",
|
|
195
|
-
"FaceTec_action_accept_photo",
|
|
196
|
-
"FaceTec_action_retake_photo",
|
|
197
|
-
"FaceTec_action_confirm",
|
|
198
|
-
"FaceTec_action_scan_nfc",
|
|
199
|
-
"FaceTec_action_scan_nfc_card",
|
|
200
|
-
"FaceTec_action_skip_nfc",
|
|
201
|
-
// Accessibility
|
|
202
|
-
"FaceTec_accessibility_cancel_button",
|
|
203
|
-
"FaceTec_accessibility_torch_button",
|
|
204
|
-
"FaceTec_accessibility_tap_guidance",
|
|
205
|
-
"FaceTec_accessibility_feedback_move_phone_away",
|
|
206
|
-
"FaceTec_accessibility_feedback_move_phone_closer",
|
|
207
|
-
"FaceTec_accessibility_feedback_face_too_far_left",
|
|
208
|
-
"FaceTec_accessibility_feedback_face_too_far_right",
|
|
209
|
-
"FaceTec_accessibility_feedback_face_too_low",
|
|
210
|
-
"FaceTec_accessibility_feedback_face_too_high",
|
|
211
|
-
"FaceTec_accessibility_feedback_face_rotated_too_far_left",
|
|
212
|
-
"FaceTec_accessibility_feedback_face_rotated_too_far_right",
|
|
213
|
-
"FaceTec_accessibility_feedback_face_pointing_too_far_left",
|
|
214
|
-
"FaceTec_accessibility_feedback_face_pointing_too_far_right",
|
|
215
|
-
"FaceTec_accessibility_feedback_face_not_on_camera",
|
|
216
|
-
"FaceTec_accessibility_feedback_hold_device_to_eye_level",
|
|
217
|
-
// Presession
|
|
218
|
-
"FaceTec_presession_frame_your_face",
|
|
219
|
-
"FaceTec_presession_position_face_straight_in_oval",
|
|
220
|
-
"FaceTec_presession_hold_steady_3",
|
|
221
|
-
"FaceTec_presession_hold_steady_2",
|
|
222
|
-
"FaceTec_presession_hold_steady_1",
|
|
223
|
-
"FaceTec_presession_remove_dark_glasses",
|
|
224
|
-
"FaceTec_presession_neutral_expression",
|
|
225
|
-
"FaceTec_presession_conditions_too_bright",
|
|
226
|
-
"FaceTec_presession_brighten_your_environment",
|
|
227
|
-
// Feedback
|
|
228
|
-
"FaceTec_feedback_center_face",
|
|
229
|
-
"FaceTec_feedback_face_not_found",
|
|
230
|
-
"FaceTec_feedback_move_phone_away",
|
|
231
|
-
"FaceTec_feedback_move_phone_closer",
|
|
232
|
-
"FaceTec_feedback_move_phone_to_eye_level",
|
|
233
|
-
"FaceTec_feedback_face_not_looking_straight_ahead",
|
|
234
|
-
"FaceTec_feedback_face_not_upright",
|
|
235
|
-
"FaceTec_feedback_hold_steady",
|
|
236
|
-
"FaceTec_feedback_use_even_lighting",
|
|
237
|
-
// Instructions
|
|
238
|
-
"FaceTec_instructions_header_ready_1",
|
|
239
|
-
"FaceTec_instructions_header_ready_2",
|
|
240
|
-
"FaceTec_instructions_message_ready_1",
|
|
241
|
-
"FaceTec_instructions_message_ready_2",
|
|
242
|
-
// Retry
|
|
243
|
-
"FaceTec_retry_header",
|
|
244
|
-
"FaceTec_retry_subheader_message",
|
|
245
|
-
"FaceTec_retry_your_image_label",
|
|
246
|
-
"FaceTec_retry_ideal_image_label",
|
|
247
|
-
"FaceTec_retry_instruction_message_1",
|
|
248
|
-
"FaceTec_retry_instruction_message_2",
|
|
249
|
-
"FaceTec_retry_instruction_message_3",
|
|
250
|
-
// Camera Permission
|
|
251
|
-
"FaceTec_camera_permission_header",
|
|
252
|
-
"FaceTec_camera_permission_message_enroll",
|
|
253
|
-
"FaceTec_camera_permission_message_auth",
|
|
254
|
-
"FaceTec_camera_permission_enable_camera",
|
|
255
|
-
"FaceTec_camera_permission_launch_settings",
|
|
256
|
-
// Initializing
|
|
257
|
-
"FaceTec_initializing_camera",
|
|
258
|
-
// ID Scan
|
|
259
|
-
"FaceTec_idscan_type_selection_header",
|
|
260
|
-
"FaceTec_idscan_capture_id_front_instruction_message",
|
|
261
|
-
"FaceTec_idscan_capture_id_back_instruction_message",
|
|
262
|
-
"FaceTec_idscan_review_id_front_instruction_message",
|
|
263
|
-
"FaceTec_idscan_review_id_back_instruction_message",
|
|
264
|
-
"FaceTec_idscan_additional_review_message",
|
|
265
|
-
"FaceTec_idscan_ocr_confirmation_main_header",
|
|
266
|
-
"FaceTec_idscan_ocr_confirmation_scroll_message",
|
|
267
|
-
"FaceTec_idscan_feedback_flip_id_to_back_message",
|
|
268
|
-
"FaceTec_idscan_capture_screen_focus_message",
|
|
269
|
-
"FaceTec_idscan_capture_tap_to_focus_message",
|
|
270
|
-
"FaceTec_idscan_capture_hold_steady_message",
|
|
271
|
-
// ID Scan - NFC
|
|
272
|
-
"FaceTec_idscan_nfc_status_disabled_message",
|
|
273
|
-
"FaceTec_idscan_nfc_status_ready_message",
|
|
274
|
-
"FaceTec_idscan_nfc_card_status_ready_message",
|
|
275
|
-
"FaceTec_idscan_nfc_status_starting_message",
|
|
276
|
-
"FaceTec_idscan_nfc_card_status_starting_message",
|
|
277
|
-
"FaceTec_idscan_nfc_status_scanning_message",
|
|
278
|
-
"FaceTec_idscan_nfc_status_weak_connection_message",
|
|
279
|
-
"FaceTec_idscan_nfc_status_finished_with_success_message",
|
|
280
|
-
"FaceTec_idscan_nfc_status_finished_with_error_message",
|
|
281
|
-
"FaceTec_idscan_nfc_card_status_finished_with_error_message",
|
|
282
|
-
"FaceTec_idscan_nfc_status_skipped_message",
|
|
283
|
-
// Result Messages
|
|
284
|
-
"FaceTec_result_success_message",
|
|
285
|
-
"FaceTec_result_facescan_upload_message",
|
|
286
|
-
"FaceTec_result_idscan_upload_message",
|
|
287
|
-
"FaceTec_result_nfc_upload_message",
|
|
288
|
-
"FaceTec_result_idscan_unsuccess_message",
|
|
289
|
-
"FaceTec_result_idscan_success_front_side_message",
|
|
290
|
-
"FaceTec_result_idscan_success_front_side_back_next_message",
|
|
291
|
-
"FaceTec_result_idscan_success_front_side_nfc_next_message",
|
|
292
|
-
"FaceTec_result_idscan_success_back_side_message",
|
|
293
|
-
"FaceTec_result_idscan_success_back_side_nfc_next_message",
|
|
294
|
-
"FaceTec_result_idscan_success_passport_message",
|
|
295
|
-
"FaceTec_result_idscan_success_passport_nfc_next_message",
|
|
296
|
-
"FaceTec_result_idscan_success_user_confirmation_message",
|
|
297
|
-
"FaceTec_result_idscan_success_nfc_message",
|
|
298
|
-
"FaceTec_result_idscan_success_additional_review_message",
|
|
299
|
-
"FaceTec_result_idscan_skip_or_error_nfc_message",
|
|
300
|
-
"FaceTec_result_idscan_retry_face_did_not_match_message",
|
|
301
|
-
"FaceTec_result_idscan_retry_id_not_fully_visible_message",
|
|
302
|
-
"FaceTec_result_idscan_retry_ocr_results_not_good_enough_message",
|
|
303
|
-
"FaceTec_result_idscan_retry_id_type_not_supported_message",
|
|
304
|
-
"FaceTec_result_idscan_retry_barcode_not_read_message",
|
|
305
|
-
// Retry - Official ID Photo
|
|
306
|
-
"FaceTec_retry_official_id_photo_subheader_message",
|
|
307
|
-
"FaceTec_retry_official_id_photo_instruction_message",
|
|
308
|
-
"FaceTec_retry_official_id_photo_your_image_label",
|
|
309
|
-
"FaceTec_retry_official_id_photo_ideal_image_label",
|
|
310
|
-
)
|
|
311
|
-
}
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
package com.soyio.soyiorndk
|
|
2
|
-
|
|
3
|
-
import android.app.Activity
|
|
4
|
-
import com.facebook.react.bridge.Promise
|
|
5
|
-
import com.facetec.sdk.FaceTecIDScanProcessor
|
|
6
|
-
import com.facetec.sdk.FaceTecIDScanResult
|
|
7
|
-
import com.facetec.sdk.FaceTecIDScanResultCallback
|
|
8
|
-
import com.facetec.sdk.FaceTecIDScanStatus
|
|
9
|
-
import com.facetec.sdk.FaceTecSessionActivity
|
|
10
|
-
import org.json.JSONObject
|
|
11
|
-
|
|
12
|
-
class SoyioIdOnlyProcessor(
|
|
13
|
-
activity: Activity,
|
|
14
|
-
sessionToken: String,
|
|
15
|
-
baseUrl: String,
|
|
16
|
-
resourcePath: String,
|
|
17
|
-
requestableToken: String,
|
|
18
|
-
authToken: String,
|
|
19
|
-
promise: Promise,
|
|
20
|
-
) : BaseFaceTecProcessor(promise, FACETEC_ID_ERROR, activity), FaceTecIDScanProcessor {
|
|
21
|
-
|
|
22
|
-
private val requestService = FaceTecRequestService(
|
|
23
|
-
baseUrl = baseUrl,
|
|
24
|
-
resourcePath = resourcePath,
|
|
25
|
-
requestableToken = requestableToken,
|
|
26
|
-
authToken = authToken,
|
|
27
|
-
)
|
|
28
|
-
|
|
29
|
-
init {
|
|
30
|
-
FaceTecSessionActivity.createAndLaunchSession(activity, this, sessionToken)
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
override fun processIDScanWhileFaceTecSDKWaits(
|
|
34
|
-
idScanResult: FaceTecIDScanResult,
|
|
35
|
-
idScanResultCallback: FaceTecIDScanResultCallback,
|
|
36
|
-
) {
|
|
37
|
-
if (idScanResult.status != FaceTecIDScanStatus.SUCCESS) {
|
|
38
|
-
idScanResultCallback.cancel()
|
|
39
|
-
markFailure(flowCancelledError)
|
|
40
|
-
return
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
val payload = JSONObject().apply {
|
|
44
|
-
put("id_scan", idScanResult.idScanBase64)
|
|
45
|
-
put("session_id", idScanResult.sessionId ?: "")
|
|
46
|
-
put("id_scan_front_image", idScanResult.frontImagesCompressedBase64?.getOrNull(0) ?: "")
|
|
47
|
-
put("id_scan_back_image", idScanResult.backImagesCompressedBase64?.getOrNull(0) ?: "")
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
requestService.post(
|
|
51
|
-
endpoint = "id_check",
|
|
52
|
-
payload = payload,
|
|
53
|
-
sessionId = idScanResult.sessionId,
|
|
54
|
-
progress = { progress -> idScanResultCallback.uploadProgress(progress) },
|
|
55
|
-
networkErrorMessage = "Network error while uploading FaceTec ID scan.",
|
|
56
|
-
onSuccess = { json ->
|
|
57
|
-
val error = json.optBoolean("error")
|
|
58
|
-
val wasProcessed = json.optBoolean("wasProcessed")
|
|
59
|
-
val scanResultBlob = json.optString("scanResultBlob")
|
|
60
|
-
val errorMessage = json.optString("errorMessage")
|
|
61
|
-
|
|
62
|
-
if (error || !wasProcessed || scanResultBlob.isNullOrBlank()) {
|
|
63
|
-
idScanResultCallback.cancel()
|
|
64
|
-
markFailure(errorMessage.takeIf { it.isNotBlank() } ?: defaultError)
|
|
65
|
-
return@post
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
idScanResultCallback.proceedToNextStep(scanResultBlob)
|
|
69
|
-
markSuccess()
|
|
70
|
-
},
|
|
71
|
-
onFailure = {
|
|
72
|
-
idScanResultCallback.cancel()
|
|
73
|
-
markFailure(it.ifBlank { defaultError })
|
|
74
|
-
},
|
|
75
|
-
)
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
companion object {
|
|
79
|
-
private const val FACETEC_ID_ERROR = "FACETEC_ID_ERROR"
|
|
80
|
-
}
|
|
81
|
-
}
|