@oiti/rn-liveness3d 1.1.2 → 2.1.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 +33 -237
- package/android/build.gradle +4 -18
- package/android/settings.gradle +2 -2
- package/android/src/main/AndroidManifest.xml +3 -0
- package/android/src/main/java/br/com/oiti/rnliveness3d/RnLiveness3dModule.kt +198 -132
- package/android/src/main/java/br/com/oiti/rnliveness3d/theme/Liveness3DFonts.kt +44 -0
- package/android/src/main/java/br/com/oiti/rnliveness3d/theme/Liveness3DText.kt +68 -0
- package/android/src/main/java/br/com/oiti/rnliveness3d/theme/Liveness3DTheme.kt +147 -0
- package/ios/Podfile +2 -1
- package/ios/Pods/Manifest.lock +23 -19
- package/ios/RnLiveness3d.m +8 -3
- package/ios/RnLiveness3d.swift +198 -114
- package/lib/commonjs/@types/ArgsType.js +4 -0
- package/lib/commonjs/@types/FontsType.js +2 -0
- package/lib/commonjs/@types/FontsType.js.map +1 -0
- package/lib/commonjs/@types/ResultType.js +2 -0
- package/lib/commonjs/@types/ResultType.js.map +1 -0
- package/lib/commonjs/@types/ResultTypes.js +6 -0
- package/lib/commonjs/@types/ResultTypes.js.map +1 -0
- package/lib/commonjs/@types/TextsType.js +2 -0
- package/lib/commonjs/@types/TextsType.js.map +1 -0
- package/lib/commonjs/@types/ThemeType.js +2 -0
- package/lib/commonjs/@types/ThemeType.js.map +1 -0
- package/lib/commonjs/actions/BackButton.js +35 -0
- package/lib/commonjs/actions/BackButton.js.map +1 -0
- package/lib/commonjs/actions/ContinueButton.js +43 -0
- package/lib/commonjs/actions/ContinueButton.js.map +1 -0
- package/lib/commonjs/actions/PermissionButton.js +35 -0
- package/lib/commonjs/actions/PermissionButton.js.map +1 -0
- package/lib/commonjs/context/Liveness3DContext.js +104 -0
- package/lib/commonjs/context/Liveness3DContext.js.map +1 -0
- package/lib/commonjs/helpers/Liveness3DHelper.js +34 -0
- package/lib/commonjs/helpers/Liveness3DHelper.js.map +1 -0
- package/lib/commonjs/index.js +121 -78
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/interfaces/Liveness3DHelper.js +6 -0
- package/lib/commonjs/interfaces/Liveness3DHelper.js.map +1 -0
- package/lib/commonjs/interfaces/OitiBackButtonInterface.js +6 -0
- package/lib/commonjs/interfaces/OitiBackButtonInterface.js.map +1 -0
- package/lib/commonjs/interfaces/OitiContinueButton.js +6 -0
- package/lib/commonjs/interfaces/OitiContinueButton.js.map +1 -0
- package/lib/commonjs/interfaces/OitiPermissionButtonInterface.js +6 -0
- package/lib/commonjs/interfaces/OitiPermissionButtonInterface.js.map +1 -0
- package/lib/commonjs/screens/Liveness3D/InstructionsView.js +4 -4
- package/lib/commonjs/screens/Liveness3D/InstructionsView.js.map +1 -1
- package/lib/commonjs/utils/continueButton.js +17 -0
- package/lib/commonjs/utils/continueButton.js.map +1 -0
- package/lib/commonjs/utils/permissions.js +30 -0
- package/lib/commonjs/utils/permissions.js.map +1 -0
- package/lib/commonjs/utils/screenStore.js +12 -0
- package/lib/commonjs/utils/screenStore.js.map +1 -0
- package/lib/module/@types/ArgsType.js +1 -1
- package/lib/module/@types/FontsType.js +2 -0
- package/lib/module/@types/FontsType.js.map +1 -0
- package/lib/module/@types/ResultType.js +2 -0
- package/lib/module/@types/ResultType.js.map +1 -0
- package/lib/module/@types/ResultTypes.js +2 -0
- package/lib/module/@types/ResultTypes.js.map +1 -0
- package/lib/module/@types/TextsType.js +2 -0
- package/lib/module/@types/TextsType.js.map +1 -0
- package/lib/module/@types/ThemeType.js +2 -0
- package/lib/module/@types/ThemeType.js.map +1 -0
- package/lib/module/actions/BackButton.js +26 -0
- package/lib/module/actions/BackButton.js.map +1 -0
- package/lib/module/actions/ContinueButton.js +34 -0
- package/lib/module/actions/ContinueButton.js.map +1 -0
- package/lib/module/actions/PermissionButton.js +26 -0
- package/lib/module/actions/PermissionButton.js.map +1 -0
- package/lib/module/context/Liveness3DContext.js +92 -0
- package/lib/module/context/Liveness3DContext.js.map +1 -0
- package/lib/module/helpers/Liveness3DHelper.js +25 -0
- package/lib/module/helpers/Liveness3DHelper.js.map +1 -0
- package/lib/module/index.js +97 -75
- package/lib/module/index.js.map +1 -1
- package/lib/module/interfaces/Liveness3DHelper.js +2 -0
- package/lib/module/interfaces/Liveness3DHelper.js.map +1 -0
- package/lib/module/interfaces/OitiBackButtonInterface.js +2 -0
- package/lib/module/interfaces/OitiBackButtonInterface.js.map +1 -0
- package/lib/module/interfaces/OitiContinueButton.js +2 -0
- package/lib/module/interfaces/OitiContinueButton.js.map +1 -0
- package/lib/module/interfaces/OitiPermissionButtonInterface.js +2 -0
- package/lib/module/interfaces/OitiPermissionButtonInterface.js.map +1 -0
- package/lib/module/screens/Liveness3D/InstructionsView.js +4 -4
- package/lib/module/screens/Liveness3D/InstructionsView.js.map +1 -1
- package/lib/module/utils/continueButton.js +10 -0
- package/lib/module/utils/continueButton.js.map +1 -0
- package/lib/module/utils/permissions.js +21 -0
- package/lib/module/utils/permissions.js.map +1 -0
- package/lib/module/utils/screenStore.js +5 -0
- package/lib/module/utils/screenStore.js.map +1 -0
- package/lib/typescript/@types/ArgsType.d.ts +9 -9
- package/lib/typescript/@types/ArgsType.d.ts.map +1 -1
- package/lib/typescript/@types/FontsType.d.ts +12 -0
- package/lib/typescript/@types/FontsType.d.ts.map +1 -0
- package/lib/typescript/@types/ResultType.d.ts +13 -0
- package/lib/typescript/@types/ResultType.d.ts.map +1 -0
- package/lib/typescript/@types/ResultTypes.d.ts +6 -0
- package/lib/typescript/@types/ResultTypes.d.ts.map +1 -0
- package/lib/typescript/@types/TextsType.d.ts +36 -0
- package/lib/typescript/@types/TextsType.d.ts.map +1 -0
- package/lib/typescript/@types/ThemeType.d.ts +48 -0
- package/lib/typescript/@types/ThemeType.d.ts.map +1 -0
- package/lib/typescript/actions/BackButton.d.ts +4 -0
- package/lib/typescript/actions/BackButton.d.ts.map +1 -0
- package/lib/typescript/actions/ContinueButton.d.ts +4 -0
- package/lib/typescript/actions/ContinueButton.d.ts.map +1 -0
- package/lib/typescript/actions/PermissionButton.d.ts +4 -0
- package/lib/typescript/actions/PermissionButton.d.ts.map +1 -0
- package/lib/typescript/context/Liveness3DContext.d.ts +28 -0
- package/lib/typescript/context/Liveness3DContext.d.ts.map +1 -0
- package/lib/typescript/helpers/Liveness3DHelper.d.ts +4 -0
- package/lib/typescript/helpers/Liveness3DHelper.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +21 -8
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/interfaces/Liveness3DHelper.d.ts +7 -0
- package/lib/typescript/interfaces/Liveness3DHelper.d.ts.map +1 -0
- package/lib/typescript/interfaces/OitiBackButtonInterface.d.ts +6 -0
- package/lib/typescript/interfaces/OitiBackButtonInterface.d.ts.map +1 -0
- package/lib/typescript/interfaces/OitiContinueButton.d.ts +6 -0
- package/lib/typescript/interfaces/OitiContinueButton.d.ts.map +1 -0
- package/lib/typescript/interfaces/OitiPermissionButtonInterface.d.ts +6 -0
- package/lib/typescript/interfaces/OitiPermissionButtonInterface.d.ts.map +1 -0
- package/lib/typescript/screens/Liveness3D/InstructionsView.d.ts +1 -0
- package/lib/typescript/screens/Liveness3D/InstructionsView.d.ts.map +1 -1
- package/lib/typescript/screens/PermissionView.d.ts +1 -0
- package/lib/typescript/screens/PermissionView.d.ts.map +1 -1
- package/lib/typescript/utils/continueButton.d.ts +2 -0
- package/lib/typescript/utils/continueButton.d.ts.map +1 -0
- package/lib/typescript/utils/permissions.d.ts +4 -0
- package/lib/typescript/utils/permissions.d.ts.map +1 -0
- package/lib/typescript/utils/screenStore.d.ts +5 -0
- package/lib/typescript/utils/screenStore.d.ts.map +1 -0
- package/oiti-rn-liveness3d.podspec +2 -1
- package/package.json +3 -6
- package/src/@types/ArgsType.ts +10 -10
- package/src/@types/FontsType.ts +22 -0
- package/src/@types/ResultType.ts +13 -0
- package/src/@types/ResultTypes.ts +6 -0
- package/src/@types/TextsType.ts +41 -0
- package/src/@types/ThemeType.ts +64 -0
- package/src/actions/BackButton.tsx +27 -0
- package/src/actions/ContinueButton.tsx +35 -0
- package/src/actions/PermissionButton.tsx +27 -0
- package/src/context/Liveness3DContext.tsx +122 -0
- package/src/helpers/Liveness3DHelper.tsx +24 -0
- package/src/index.tsx +120 -87
- package/src/interfaces/Liveness3DHelper.tsx +7 -0
- package/src/interfaces/OitiBackButtonInterface.tsx +6 -0
- package/src/interfaces/OitiContinueButton.tsx +6 -0
- package/src/interfaces/OitiPermissionButtonInterface.tsx +6 -0
- package/src/screens/Liveness3D/InstructionsView.tsx +8 -8
- package/src/utils/continueButton.tsx +12 -0
- package/src/utils/permissions.tsx +30 -0
- package/src/utils/screenStore.tsx +4 -0
|
@@ -1,152 +1,218 @@
|
|
|
1
|
-
package br.com.oiti.rnliveness3d
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import android.
|
|
6
|
-
import android.content.
|
|
7
|
-
import android.
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import androidx.
|
|
11
|
-
|
|
12
|
-
import
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
import br.com.oiti.liveness3d.data.model
|
|
16
|
-
import br.com.oiti.
|
|
17
|
-
|
|
18
|
-
import
|
|
19
|
-
import
|
|
20
|
-
import com.facebook.react.bridge
|
|
21
|
-
import com.facebook.react.bridge.
|
|
22
|
-
import com.facebook.react.bridge.
|
|
23
|
-
import com.facebook.react.
|
|
24
|
-
import
|
|
25
|
-
|
|
26
|
-
class RnLiveness3dModule(reactContext: ReactApplicationContext) :
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
object : BaseActivityEventListener() {
|
|
39
|
-
override fun onActivityResult(
|
|
40
|
-
activity: Activity,
|
|
41
|
-
requestCode: Int,
|
|
42
|
-
resultCode: Int,
|
|
43
|
-
data: Intent?
|
|
44
|
-
) {
|
|
45
|
-
if (requestCode == LIVENESS3D_REQUEST) {
|
|
46
|
-
if (mLiveness3dPromisse != null) {
|
|
47
|
-
if (resultCode == Activity.RESULT_CANCELED) {
|
|
48
|
-
mLiveness3dPromisse!!.reject(E_FAILED_TO_SHOW_PICKER,"RESULT_CANCELED")
|
|
49
|
-
} else if (resultCode == Activity.RESULT_OK) {
|
|
50
|
-
mLiveness3dPromisse!!.resolve("RESULT_OK")
|
|
1
|
+
package br.com.oiti.rnliveness3d
|
|
2
|
+
|
|
3
|
+
import android.Manifest
|
|
4
|
+
import android.app.Activity
|
|
5
|
+
import android.content.Intent
|
|
6
|
+
import android.content.pm.PackageManager
|
|
7
|
+
import android.util.Log
|
|
8
|
+
import androidx.annotation.NonNull
|
|
9
|
+
import androidx.core.app.ActivityCompat
|
|
10
|
+
import androidx.core.content.*
|
|
11
|
+
|
|
12
|
+
import br.com.oiti.liveness3d.app.ui.HybridLiveness3DActivity
|
|
13
|
+
import br.com.oiti.rnliveness3d.theme.Liveness3DTheme
|
|
14
|
+
|
|
15
|
+
import br.com.oiti.liveness3d.data.model.*
|
|
16
|
+
import br.com.oiti.rnliveness3d.theme.Liveness3DText
|
|
17
|
+
|
|
18
|
+
import com.facebook.react.bridge.*
|
|
19
|
+
import com.facebook.react.bridge.Promise
|
|
20
|
+
import com.facebook.react.bridge.ReactApplicationContext
|
|
21
|
+
import com.facebook.react.bridge.ReactContextBaseJavaModule
|
|
22
|
+
import com.facebook.react.bridge.ReactMethod
|
|
23
|
+
import com.facebook.react.modules.core.PermissionAwareActivity
|
|
24
|
+
import org.json.JSONObject
|
|
25
|
+
|
|
26
|
+
class RnLiveness3dModule(reactContext: ReactApplicationContext) :
|
|
27
|
+
ReactContextBaseJavaModule(reactContext) {
|
|
28
|
+
|
|
29
|
+
private var mLiveness3dPromisse: Promise? = null
|
|
30
|
+
|
|
31
|
+
init {
|
|
32
|
+
reactContext.addActivityEventListener(object : BaseActivityEventListener() {
|
|
33
|
+
override fun onActivityResult(activity: Activity, requestCode: Int, resultCode: Int, data: Intent?) {
|
|
34
|
+
if (requestCode == LIVENESS3D_REQUEST && mLiveness3dPromisse != null) {
|
|
35
|
+
when (resultCode) {
|
|
36
|
+
Activity.RESULT_CANCELED -> mLiveness3dPromisse!!.reject(RESULT_CANCELED,onLiveness3DResultCancelled(data))
|
|
37
|
+
Activity.RESULT_OK -> mLiveness3dPromisse!!.resolve(onLiveness3DResultSuccess(data))
|
|
51
38
|
}
|
|
52
39
|
mLiveness3dPromisse = null
|
|
53
40
|
}
|
|
54
41
|
}
|
|
55
|
-
}
|
|
42
|
+
})
|
|
56
43
|
}
|
|
57
44
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
@ReactMethod
|
|
63
|
-
fun logevent(name: String, appKey: String) {
|
|
64
|
-
FirebaseEvents(name.toString(), appKey).apply()
|
|
65
|
-
}
|
|
45
|
+
fun onLiveness3DResultSuccess(data: Intent?): String {
|
|
46
|
+
val resultMap = mutableMapOf<String, Any?>()
|
|
66
47
|
|
|
48
|
+
resultMap["valid"] = data?.getBooleanExtra(HybridLiveness3DActivity.PARAM_RESULT_VALID, false)
|
|
49
|
+
resultMap["cause"] = data?.getStringExtra(HybridLiveness3DActivity.PARAM_RESULT_CAUSE)
|
|
50
|
+
resultMap["codId"] = data?.getStringExtra(HybridLiveness3DActivity.PARAM_RESULT_COD_ID)
|
|
51
|
+
resultMap["protocol"] = data?.getStringExtra(HybridLiveness3DActivity.PARAM_RESULT_PROTOCOL)
|
|
52
|
+
resultMap["blob"] = data?.getStringExtra(HybridLiveness3DActivity.PARAM_RESULT_SCAN)
|
|
67
53
|
|
|
54
|
+
return JSONObject(resultMap).toString()
|
|
55
|
+
}
|
|
68
56
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
Log.d("LOADING RN SIZE", size.toString())
|
|
75
|
-
Log.d("LOADING RN BG", backgroundColor)
|
|
76
|
-
Log.d("LOADING RN LC", loadingColor)
|
|
77
|
-
|
|
78
|
-
val texts = hashMapOf<Liveness3DTextKey, String>(
|
|
79
|
-
Liveness3DTextKey.READY_HEADER_1 to "Prepare-se para seu",
|
|
80
|
-
Liveness3DTextKey.READY_HEADER_2 to "reconhecimento facial.",
|
|
81
|
-
Liveness3DTextKey.READY_MESSAGE_1 to "Posicione o seu rosto na moldura, aproxime-se",
|
|
82
|
-
Liveness3DTextKey.READY_MESSAGE_2 to "e toque em começar.",
|
|
83
|
-
Liveness3DTextKey.READY_BUTTON to "Começar",
|
|
84
|
-
|
|
85
|
-
Liveness3DTextKey.RETRY_HEADER to "Vamos tentar novamente?",
|
|
86
|
-
Liveness3DTextKey.RETRY_SUBHEADER to "Siga o exemplo de foto ideal abaixo:",
|
|
87
|
-
Liveness3DTextKey.RETRY_MESSAGE_SMILE to "Expressão Neutra, Sem Sorrir",
|
|
88
|
-
Liveness3DTextKey.RETRY_MESSAGE_LIGHTING to "Evite reflexos e iluminação extrema.",
|
|
89
|
-
Liveness3DTextKey.RETRY_MESSAGE_CONTRAST to "Limpe Sua Câmera",
|
|
90
|
-
Liveness3DTextKey.RETRY_YOUR_PICTURE to "Sua foto",
|
|
91
|
-
Liveness3DTextKey.RETRY_IDEAL_PICTURE to "Foto ideal",
|
|
92
|
-
Liveness3DTextKey.RETRY_BUTTON to "Tentar novamente",
|
|
93
|
-
|
|
94
|
-
Liveness3DTextKey.RESULT_UPLOAD_MESSAGE to "Enviando...",
|
|
95
|
-
Liveness3DTextKey.RESULT_SUCCESS_MESSAGE to "Sucesso",
|
|
96
|
-
|
|
97
|
-
Liveness3DTextKey.FEEDBACK_CENTER_FACE to "Centralize Seu Rosto",
|
|
98
|
-
Liveness3DTextKey.FEEDBACK_FACE_NOT_FOUND to "Enquadre o Seu Rosto",
|
|
99
|
-
Liveness3DTextKey.FEEDBACK_FACE_NOT_LOOKING_STRAIGHT_AHEAD to "Olhe Para Frente",
|
|
100
|
-
Liveness3DTextKey.FEEDBACK_FACE_NOT_UPRIGHT to "Mantenha a Cabeça Reta",
|
|
101
|
-
Liveness3DTextKey.FEEDBACK_HOLD_STEADY to "Segure Firme",
|
|
102
|
-
Liveness3DTextKey.FEEDBACK_MOVE_PHONE_AWAY to "Afaste-se",
|
|
103
|
-
Liveness3DTextKey.FEEDBACK_MOVE_PHONE_CLOSER to "Aproxime-se",
|
|
104
|
-
Liveness3DTextKey.FEEDBACK_MOVE_PHONE_TO_EYE_LEVEL to "Telefone ao Nível dos Olhos",
|
|
105
|
-
Liveness3DTextKey.FEEDBACK_USE_EVEN_LIGHTING to "Ilumine Seu Rosto Uniformemente",
|
|
106
|
-
|
|
107
|
-
Liveness3DTextKey.FEEDBACK_FRAME_YOUR_FACE to "Encaixe Seu Rosto no Espaço Oval",
|
|
108
|
-
Liveness3DTextKey.FEEDBACK_HOLD_STEADY_1 to "Aguente Firme: 1",
|
|
109
|
-
Liveness3DTextKey.FEEDBACK_HOLD_STEADY_2 to "Aguente Firme: 2",
|
|
110
|
-
Liveness3DTextKey.FEEDBACK_HOLD_STEADY_3 to "Aguente Firme: 3",
|
|
111
|
-
Liveness3DTextKey.FEEDBACK_REMOVE_DARK_GLASSES to "Tire Seus Óculos de Sol",
|
|
112
|
-
Liveness3DTextKey.FEEDBACK_NEUTRAL_EXPRESSION to "Fique Neutro, Não Sorria",
|
|
113
|
-
Liveness3DTextKey.FEEDBACK_CONDITIONS_TOO_BRIGHT to "Ambiente Muito Iluminado",
|
|
114
|
-
Liveness3DTextKey.FEEDBACK_BRIGHTEN_YOUR_ENVIRONMENT to "Ambiente Muito Escuro",
|
|
115
|
-
)
|
|
116
|
-
|
|
117
|
-
if (currentActivity == null) {
|
|
118
|
-
promise.reject(E_ACTIVITY_DOES_NOT_EXIST, "Activity doesn't exist")
|
|
119
|
-
return;
|
|
57
|
+
fun onLiveness3DResultCancelled(data: Intent?): String {
|
|
58
|
+
return data?.getStringExtra(HybridLiveness3DActivity.PARAM_RESULT_ERROR) ?: ""
|
|
59
|
+
}
|
|
60
|
+
override fun getName(): String {
|
|
61
|
+
return NAME
|
|
120
62
|
}
|
|
63
|
+
@NonNull
|
|
64
|
+
@ReactMethod
|
|
65
|
+
fun startliveness3d(
|
|
66
|
+
appKey: String,
|
|
67
|
+
ticket: String,
|
|
68
|
+
type: String,
|
|
69
|
+
size: Int,
|
|
70
|
+
backgroundColor: String,
|
|
71
|
+
loadingColor: String,
|
|
72
|
+
themeJson: ReadableMap?,
|
|
73
|
+
fontsJson: ReadableMap?,
|
|
74
|
+
textsJson: ReadableMap?,
|
|
75
|
+
promise: Promise
|
|
76
|
+
) {
|
|
77
|
+
mLiveness3dPromisse = promise
|
|
78
|
+
val currentActivity = currentActivity
|
|
79
|
+
|
|
80
|
+
val themeBuilder = themeJson?.let { Liveness3DTheme(readableMapToMap(themeJson)).apply() }
|
|
81
|
+
val fonts = fontsJson?.let { getFonts(readableMapToMap(fontsJson)) }
|
|
82
|
+
val texts = textsJson?.let { Liveness3DText().getTexts(readableMapToMap(textsJson)) }
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
if (currentActivity == null) {
|
|
86
|
+
promise.reject(E_ACTIVITY_DOES_NOT_EXIST, "Activity doesn't exist")
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
try {
|
|
90
|
+
val liveness3DUser = Liveness3DUser(appKey = appKey, ENVIRONMENT3D.HML, themeBuilder)
|
|
121
91
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
92
|
+
val intent = Intent(currentActivity, HybridLiveness3DActivity::class.java).apply {
|
|
93
|
+
putExtra(HybridLiveness3DActivity.PARAM_LIVENESS3D_USER, liveness3DUser)
|
|
94
|
+
if (ticket.isNotEmpty()) {
|
|
95
|
+
putExtra(HybridLiveness3DActivity.PARAM_TICKET, ticket)
|
|
96
|
+
}
|
|
97
|
+
putExtra(HybridLiveness3DActivity.PARAM_TEXTS, texts)
|
|
98
|
+
putExtra(HybridLiveness3DActivity.PARAM_FONTS, fonts)
|
|
99
|
+
putExtra(HybridLiveness3DActivity.PARAM_CUSTOM_LOADING_BACKGROUND, backgroundColor)
|
|
100
|
+
putExtra(HybridLiveness3DActivity.PARAM_CUSTOM_LOADING_SPINNER_COLOR, loadingColor)
|
|
101
|
+
putExtra(HybridLiveness3DActivity.PARAM_CUSTOM_LOADING_SIZE, size)
|
|
102
|
+
if(type == "default"){
|
|
103
|
+
putExtra(HybridLiveness3DActivity.PARAM_CUSTOM_LOADING_TYPE, LoadingType3D.ACTIVITY_INDICATOR)
|
|
104
|
+
}else{
|
|
105
|
+
putExtra(HybridLiveness3DActivity.PARAM_CUSTOM_LOADING_TYPE, LoadingType3D.SPINNER)
|
|
106
|
+
}
|
|
136
107
|
}
|
|
108
|
+
|
|
109
|
+
currentActivity.startActivityForResult(intent, LIVENESS3D_REQUEST)
|
|
110
|
+
|
|
111
|
+
} catch (e: Exception) {
|
|
112
|
+
Log.d("APPKEY_FAILED", appKey)
|
|
113
|
+
mLiveness3dPromisse?.reject(E_FAILED_TO_SHOW_PICKER, e)
|
|
114
|
+
mLiveness3dPromisse = null
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
fun readableMapToMap(readableMap: ReadableMap?): Map<String, String?> {
|
|
119
|
+
val map = mutableMapOf<String, String?>()
|
|
120
|
+
readableMap?.let {
|
|
121
|
+
val iterator = it.keySetIterator()
|
|
122
|
+
while (iterator.hasNextKey()) {
|
|
123
|
+
val key = iterator.nextKey()
|
|
124
|
+
val value = it.getString(key)
|
|
125
|
+
map[key] = value
|
|
137
126
|
}
|
|
138
|
-
getCurrentActivity()?.startActivityForResult(intent, LIVENESS3D_REQUEST)
|
|
139
|
-
} catch (e: Exception) {
|
|
140
|
-
mLiveness3dPromisse?.reject(E_FAILED_TO_SHOW_PICKER, e)
|
|
141
|
-
mLiveness3dPromisse = null
|
|
142
127
|
}
|
|
128
|
+
return map
|
|
129
|
+
}
|
|
143
130
|
|
|
131
|
+
private fun getFonts(fontsBuilder: Map<String, String?>?): HashMap<Liveness3DFontsKey?, String?> {
|
|
132
|
+
val hashMap = HashMap<Liveness3DFontsKey?, String?>()
|
|
133
|
+
if (fontsBuilder != null) {
|
|
134
|
+
val fontsMap = fontsBuilder
|
|
135
|
+
.mapNotNull {
|
|
136
|
+
val key = getFontKey(it.key)
|
|
137
|
+
val value = it.value
|
|
138
|
+
if (value?.isEmpty() == true) {
|
|
139
|
+
null
|
|
140
|
+
} else { Pair(key, "fonts/$value.ttf".lowercase()) }
|
|
141
|
+
}
|
|
142
|
+
.toMap()
|
|
143
|
+
hashMap.putAll(fontsMap)
|
|
144
|
+
}
|
|
145
|
+
return hashMap
|
|
146
|
+
}
|
|
144
147
|
|
|
145
|
-
|
|
148
|
+
private fun getFontKey(identifier: String): Liveness3DFontsKey? {
|
|
149
|
+
return when(identifier) {
|
|
150
|
+
/* Guidance */
|
|
151
|
+
"guidanceCustomizationHeaderFont" -> Liveness3DFontsKey.GUIDANCE_CUSTOMIZATION_HEADER_FONT
|
|
152
|
+
"guidanceCustomizationSubtextFont" -> Liveness3DFontsKey.GUIDANCE_CUSTOMIZATION_SUBTEXT_FONT
|
|
153
|
+
/* Button */
|
|
154
|
+
"guidanceCustomizationButtonFont" -> Liveness3DFontsKey.GUIDANCE_CUSTOMIZATION_BUTTON_FONT
|
|
155
|
+
|
|
156
|
+
/* Ready Screen */
|
|
157
|
+
"readyScreenCustomizationHeaderFont" -> Liveness3DFontsKey.GUIDANCE_CUSTOMIZATION_READY_SCREEN_HEADER_FONT
|
|
158
|
+
"readyScreenCustomizationSubtextFont" -> Liveness3DFontsKey.GUIDANCE_CUSTOMIZATION_READY_SCREEN_SUBTEXT_FONT
|
|
159
|
+
/* Retry Screen */
|
|
160
|
+
"retryScreenCustomizationHeaderFont" -> Liveness3DFontsKey.GUIDANCE_CUSTOMIZATION_RETRY_SCREEN_HEADER_FONT
|
|
161
|
+
"retryScreenCustomizationSubtextFont" -> Liveness3DFontsKey.GUIDANCE_CUSTOMIZATION_RETRY_SCREEN_SUBTEXT_FONT
|
|
162
|
+
/* Result Screen */
|
|
163
|
+
"resultScreenCustomizationMessageFont" -> Liveness3DFontsKey.RESULT_SCREEN_CUSTOMIZATION_MESSAGE_FONT
|
|
164
|
+
/* Feedback */
|
|
165
|
+
"feedbackCustomizationTextFont" -> Liveness3DFontsKey.FEEDBACK_CUSTOMIZATION_TEXT_FONT
|
|
166
|
+
else -> null
|
|
167
|
+
}
|
|
168
|
+
}
|
|
146
169
|
|
|
170
|
+
@ReactMethod
|
|
171
|
+
fun checkcamerapermission(promise: Promise) {
|
|
172
|
+
val currentActivity = currentActivity
|
|
173
|
+
if (currentActivity != null) {
|
|
174
|
+
if (ContextCompat.checkSelfPermission(currentActivity, Manifest.permission.CAMERA) == PackageManager.PERMISSION_GRANTED) {
|
|
175
|
+
promise.resolve(true)
|
|
176
|
+
} else {
|
|
177
|
+
promise.resolve(false)
|
|
178
|
+
}
|
|
179
|
+
} else {
|
|
180
|
+
promise.reject("UNAVAILABLE", "Could not get current activity.")
|
|
181
|
+
}
|
|
182
|
+
}
|
|
147
183
|
|
|
184
|
+
@ReactMethod
|
|
185
|
+
fun askcamerapermission(promise: Promise) {
|
|
186
|
+
val currentActivity = currentActivity
|
|
187
|
+
|
|
188
|
+
if (currentActivity != null) {
|
|
189
|
+
if (ContextCompat.checkSelfPermission(currentActivity, Manifest.permission.CAMERA)
|
|
190
|
+
== PackageManager.PERMISSION_GRANTED
|
|
191
|
+
) {
|
|
192
|
+
promise.resolve(true)
|
|
193
|
+
} else {
|
|
194
|
+
if (currentActivity is PermissionAwareActivity) {
|
|
195
|
+
ActivityCompat.requestPermissions(
|
|
196
|
+
currentActivity,
|
|
197
|
+
arrayOf(Manifest.permission.CAMERA),
|
|
198
|
+
CAMERA_PERMISSION_REQUEST_CODE
|
|
199
|
+
)
|
|
200
|
+
} else {
|
|
201
|
+
promise.resolve(false)
|
|
202
|
+
}
|
|
203
|
+
promise.resolve(false)
|
|
204
|
+
}
|
|
205
|
+
} else {
|
|
206
|
+
promise.resolve(true)
|
|
207
|
+
}
|
|
208
|
+
}
|
|
148
209
|
|
|
149
|
-
|
|
150
|
-
|
|
210
|
+
companion object {
|
|
211
|
+
const val NAME = "RnLiveness3d"
|
|
212
|
+
const val CAMERA_PERMISSION_REQUEST_CODE = 1111
|
|
213
|
+
private const val LIVENESS3D_REQUEST = 1
|
|
214
|
+
private const val E_ACTIVITY_DOES_NOT_EXIST = "E_ACTIVITY_DOES_NOT_EXIST"
|
|
215
|
+
private const val E_FAILED_TO_SHOW_PICKER = "E_FAILED_TO_SHOW_PICKER"
|
|
216
|
+
private val RESULT_CANCELED = "RESULT_CANCELED"
|
|
217
|
+
}
|
|
151
218
|
}
|
|
152
|
-
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
package br.com.oiti.rnliveness3d.theme
|
|
2
|
+
|
|
3
|
+
import br.com.oiti.liveness3d.data.model.Liveness3DFontsKey
|
|
4
|
+
|
|
5
|
+
class Liveness3DFonts(private val fontsBuilder: Map<String,String?>?) {
|
|
6
|
+
private val guidanceCustomizationHeaderFont: String = fontsBuilder?.get("guidanceCustomizationHeaderFont")?.lowercase() + ".ttf"
|
|
7
|
+
private val guidanceCustomizationSubtextFont: String =
|
|
8
|
+
("fonts/" + fontsBuilder?.get("guidanceCustomizationSubtextFont")?.lowercase() + ".ttf")
|
|
9
|
+
?: ""
|
|
10
|
+
private val readyScreenCustomizationHeaderFont: String =
|
|
11
|
+
("fonts/" + fontsBuilder?.get("readyScreenCustomizationHeaderFont")?.lowercase() + ".ttf")
|
|
12
|
+
?: ""
|
|
13
|
+
private val readyScreenCustomizationSubtextFont: String =
|
|
14
|
+
("fonts/" + fontsBuilder?.get("readyScreenCustomizationSubtextFont")?.lowercase() + ".ttf")
|
|
15
|
+
?: ""
|
|
16
|
+
private val retryScreenCustomizationHeaderFont: String =
|
|
17
|
+
("fonts/" + fontsBuilder?.get("retryScreenCustomizationHeaderFont")?.lowercase() + ".ttf")
|
|
18
|
+
?: ""
|
|
19
|
+
private val retryScreenCustomizationSubtextFont: String =
|
|
20
|
+
("fonts/" + fontsBuilder?.get("retryScreenCustomizationSubtextFont")?.lowercase() + ".ttf")
|
|
21
|
+
?: ""
|
|
22
|
+
private val resultScreenCustomizationMessageFont: String =
|
|
23
|
+
("fonts/" + fontsBuilder?.get("resultScreenCustomizationMessageFont")?.lowercase() + ".ttf")
|
|
24
|
+
?: ""
|
|
25
|
+
private val guidanceCustomizationButtonFont: String =
|
|
26
|
+
("fonts/" + fontsBuilder?.get("guidanceCustomizationButtonFont")?.lowercase() + ".ttf")
|
|
27
|
+
?: ""
|
|
28
|
+
private val feedbackCustomizationTextFont: String =
|
|
29
|
+
("fonts/" + fontsBuilder?.get("feedbackCustomizationTextFont")?.lowercase() + ".ttf") ?: ""
|
|
30
|
+
|
|
31
|
+
fun apply(): HashMap<Liveness3DFontsKey, String> {
|
|
32
|
+
return hashMapOf(
|
|
33
|
+
Liveness3DFontsKey.GUIDANCE_CUSTOMIZATION_HEADER_FONT to guidanceCustomizationHeaderFont,
|
|
34
|
+
Liveness3DFontsKey.GUIDANCE_CUSTOMIZATION_SUBTEXT_FONT to guidanceCustomizationSubtextFont,
|
|
35
|
+
Liveness3DFontsKey.GUIDANCE_CUSTOMIZATION_READY_SCREEN_HEADER_FONT to readyScreenCustomizationHeaderFont,
|
|
36
|
+
Liveness3DFontsKey.GUIDANCE_CUSTOMIZATION_READY_SCREEN_SUBTEXT_FONT to readyScreenCustomizationSubtextFont,
|
|
37
|
+
Liveness3DFontsKey.GUIDANCE_CUSTOMIZATION_RETRY_SCREEN_HEADER_FONT to retryScreenCustomizationHeaderFont,
|
|
38
|
+
Liveness3DFontsKey.GUIDANCE_CUSTOMIZATION_RETRY_SCREEN_SUBTEXT_FONT to retryScreenCustomizationSubtextFont,
|
|
39
|
+
Liveness3DFontsKey.RESULT_SCREEN_CUSTOMIZATION_MESSAGE_FONT to resultScreenCustomizationMessageFont,
|
|
40
|
+
Liveness3DFontsKey.GUIDANCE_CUSTOMIZATION_BUTTON_FONT to guidanceCustomizationButtonFont,
|
|
41
|
+
Liveness3DFontsKey.FEEDBACK_CUSTOMIZATION_TEXT_FONT to feedbackCustomizationTextFont,
|
|
42
|
+
)
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
package br.com.oiti.rnliveness3d.theme
|
|
2
|
+
|
|
3
|
+
import android.util.Log
|
|
4
|
+
import br.com.oiti.liveness3d.data.model.Liveness3DTextKey
|
|
5
|
+
|
|
6
|
+
class Liveness3DText {
|
|
7
|
+
fun getTextKey(identifier: String): Liveness3DTextKey? {
|
|
8
|
+
return when(identifier) {
|
|
9
|
+
/* Ready */
|
|
10
|
+
"READY_HEADER_1" -> Liveness3DTextKey.READY_HEADER_1
|
|
11
|
+
"READY_HEADER_2" -> Liveness3DTextKey.READY_HEADER_2
|
|
12
|
+
"READY_MESSAGE_1" -> Liveness3DTextKey.READY_MESSAGE_1
|
|
13
|
+
"READY_MESSAGE_2" -> Liveness3DTextKey.READY_MESSAGE_2
|
|
14
|
+
"READY_BUTTON" -> Liveness3DTextKey.READY_BUTTON
|
|
15
|
+
|
|
16
|
+
/* Retry */
|
|
17
|
+
"RETRY_HEADER" -> Liveness3DTextKey.RETRY_HEADER
|
|
18
|
+
"RETRY_SUBHEADER" -> Liveness3DTextKey.RETRY_SUBHEADER
|
|
19
|
+
"RETRY_MESSAGE_SMILE" -> Liveness3DTextKey.RETRY_MESSAGE_SMILE
|
|
20
|
+
"RETRY_MESSAGE_LIGHTING" -> Liveness3DTextKey.RETRY_MESSAGE_LIGHTING
|
|
21
|
+
"RETRY_MESSAGE_CONTRAST" -> Liveness3DTextKey.RETRY_MESSAGE_CONTRAST
|
|
22
|
+
"RETRY_YOUR_PICTURE" -> Liveness3DTextKey.RETRY_YOUR_PICTURE
|
|
23
|
+
"RETRY_IDEAL_PICTURE" -> Liveness3DTextKey.RETRY_IDEAL_PICTURE
|
|
24
|
+
"RETRY_BUTTON" -> Liveness3DTextKey.RETRY_BUTTON
|
|
25
|
+
|
|
26
|
+
/* Result */
|
|
27
|
+
"RESULT_UPLOAD_MESSAGE" -> Liveness3DTextKey.RESULT_UPLOAD_MESSAGE
|
|
28
|
+
"RESULT_SUCCESS_MESSAGE" -> Liveness3DTextKey.RESULT_SUCCESS_MESSAGE
|
|
29
|
+
|
|
30
|
+
/* Feedback */
|
|
31
|
+
"FEEDBACK_POSITION_FACE_STRAIGHT_IN_OVAL" -> Liveness3DTextKey.FEEDBACK_LOOK_STRAIGHT_IN_OVAL
|
|
32
|
+
"FEEDBACK_CENTER_FACE" -> Liveness3DTextKey.FEEDBACK_CENTER_FACE
|
|
33
|
+
"FEEDBACK_FACE_NOT_FOUND" -> Liveness3DTextKey.FEEDBACK_FACE_NOT_FOUND
|
|
34
|
+
"FEEDBACK_FACE_NOT_LOOKING_STRAIGHT_AHEAD" -> Liveness3DTextKey.FEEDBACK_FACE_NOT_LOOKING_STRAIGHT_AHEAD
|
|
35
|
+
"FEEDBACK_FACE_NOT_UPRIGHT" -> Liveness3DTextKey.FEEDBACK_FACE_NOT_UPRIGHT
|
|
36
|
+
"FEEDBACK_MOVE_PHONE_AWAY" -> Liveness3DTextKey.FEEDBACK_MOVE_PHONE_AWAY
|
|
37
|
+
"FEEDBACK_MOVE_PHONE_CLOSER" -> Liveness3DTextKey.FEEDBACK_MOVE_PHONE_CLOSER
|
|
38
|
+
"FEEDBACK_MOVE_PHONE_TO_EYE_LEVEL" -> Liveness3DTextKey.FEEDBACK_MOVE_PHONE_TO_EYE_LEVEL
|
|
39
|
+
"FEEDBACK_USE_EVEN_LIGHTING" -> Liveness3DTextKey.FEEDBACK_USE_EVEN_LIGHTING
|
|
40
|
+
"FEEDBACK_FRAME_YOUR_FACE" -> Liveness3DTextKey.FEEDBACK_FRAME_YOUR_FACE
|
|
41
|
+
"FEEDBACK_HOLD_STEADY" -> Liveness3DTextKey.FEEDBACK_HOLD_STEADY
|
|
42
|
+
"FEEDBACK_HOLD_STEADY_1" -> Liveness3DTextKey.FEEDBACK_HOLD_STEADY_1
|
|
43
|
+
"FEEDBACK_HOLD_STEADY_2" -> Liveness3DTextKey.FEEDBACK_HOLD_STEADY_2
|
|
44
|
+
"FEEDBACK_HOLD_STEADY_3" -> Liveness3DTextKey.FEEDBACK_HOLD_STEADY_3
|
|
45
|
+
"FEEDBACK_REMOVE_DARK_GLASSES" -> Liveness3DTextKey.FEEDBACK_REMOVE_DARK_GLASSES
|
|
46
|
+
"FEEDBACK_NEUTRAL_EXPRESSION" -> Liveness3DTextKey.FEEDBACK_NEUTRAL_EXPRESSION
|
|
47
|
+
"FEEDBACK_CONDITIONS_TOO_BRIGHT" -> Liveness3DTextKey.FEEDBACK_CONDITIONS_TOO_BRIGHT
|
|
48
|
+
"FEEDBACK_BRIGHTEN_YOUR_ENVIRONMENT" -> Liveness3DTextKey.FEEDBACK_BRIGHTEN_YOUR_ENVIRONMENT
|
|
49
|
+
else -> null
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
fun getTexts(textsBuilder: Map<String, String?>?): HashMap<Liveness3DTextKey, String> {
|
|
53
|
+
val hashMap = HashMap<Liveness3DTextKey, String>()
|
|
54
|
+
if (textsBuilder != null) {
|
|
55
|
+
val textsMap = textsBuilder
|
|
56
|
+
.mapNotNull {
|
|
57
|
+
val key = getTextKey(it.key)
|
|
58
|
+
val value = it.value
|
|
59
|
+
if (key != null && value != null) {
|
|
60
|
+
Pair(key, value)
|
|
61
|
+
} else { null }
|
|
62
|
+
}
|
|
63
|
+
.toMap()
|
|
64
|
+
hashMap.putAll(textsMap)
|
|
65
|
+
}
|
|
66
|
+
return hashMap
|
|
67
|
+
}
|
|
68
|
+
}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
package br.com.oiti.rnliveness3d.theme
|
|
2
|
+
|
|
3
|
+
import android.content.Context
|
|
4
|
+
import androidx.annotation.DrawableRes
|
|
5
|
+
import br.com.oiti.liveness3d.theme.Liveness3DTheme
|
|
6
|
+
|
|
7
|
+
class Liveness3DTheme(
|
|
8
|
+
private var themeBuilder: Map<String, String?>?,
|
|
9
|
+
) {
|
|
10
|
+
//Guidance customization
|
|
11
|
+
private val guidanceCustomizationBackgroundColors: String? = themeBuilder?.get("guidanceCustomizationBackgroundColors") ?: "#FFFFFF"
|
|
12
|
+
private val guidanceCustomizationForegroundColor: String? = themeBuilder?.get("guidanceCustomizationForegroundColor") ?: "#FFFFFF"
|
|
13
|
+
|
|
14
|
+
//Buttons
|
|
15
|
+
private val guidanceCustomizationButtonTextNormalColor: String? = themeBuilder?.get("guidanceCustomizationForegroundColor") ?: "#000000"
|
|
16
|
+
private val guidanceCustomizationButtonBackgroundNormalColor: String? = themeBuilder?.get("guidanceCustomizationButtonBackgroundNormalColor") ?: "#4bb75f"
|
|
17
|
+
|
|
18
|
+
private val guidanceCustomizationButtonTextHighlightColor: String? = themeBuilder?.get("guidanceCustomizationButtonTextHighlightColor") ?: "#000000"
|
|
19
|
+
private val guidanceCustomizationButtonBackgroundHighlightColor: String? = themeBuilder?.get("guidanceCustomizationButtonBackgroundHighlightColor") ?: "#000000"
|
|
20
|
+
private val guidanceCustomizationButtonTextDisabledColor: String? = themeBuilder?.get("guidanceCustomizationButtonTextDisabledColor") ?: "#333333"
|
|
21
|
+
private val guidanceCustomizationButtonBackgroundDisabledColor: String? = themeBuilder?.get("guidanceCustomizationButtonBackgroundDisabledColor") ?: "#333333"
|
|
22
|
+
private val guidanceCustomizationButtonBorderColor: String? = themeBuilder?.get("guidanceCustomizationButtonBorderColor") ?: "#000000"
|
|
23
|
+
private val guidanceCustomizationButtonBorderWidth: Int? = themeBuilder?.get("guidanceCustomizationButtonBorderWidth")?.toInt() ?: 0
|
|
24
|
+
private val guidanceCustomizationButtonCornerRadius: Int? = themeBuilder?.get("guidanceCustomizationButtonCornerRadius")?.toInt() ?: 25
|
|
25
|
+
|
|
26
|
+
//Ready Screen
|
|
27
|
+
private val guidanceCustomizationReadyScreenHeaderTextColor: String? = themeBuilder?.get("guidanceCustomizationReadyScreenHeaderTextColor") ?: "#000000"
|
|
28
|
+
private val guidanceCustomizationReadyScreenSubtextTextColor: String? = themeBuilder?.get("guidanceCustomizationReadyScreenSubtextTextColor") ?: "#333333"
|
|
29
|
+
|
|
30
|
+
//Retry Screen
|
|
31
|
+
private val guidanceCustomizationRetryScreenHeaderTextColor: String? = themeBuilder?.get("guidanceCustomizationRetryScreenHeaderTextColor") ?: "#000000"
|
|
32
|
+
private val guidanceCustomizationRetryScreenSubtextTextColor: String? = themeBuilder?.get("guidanceCustomizationRetryScreenSubtextTextColor") ?: "#333333"
|
|
33
|
+
private val guidanceCustomizationReadyScreenOvalFillColor: String? = themeBuilder?.get("guidanceCustomizationReadyScreenOvalFillColor") ?: "#000000"
|
|
34
|
+
private val guidanceCustomizationReadyScreenTextBackgroundColor: String? = themeBuilder?.get("guidanceCustomizationReadyScreenTextBackgroundColor") ?: "#4bb75f"
|
|
35
|
+
private val guidanceCustomizationReadyScreenTextBackgroundCornerRadius: Int? = themeBuilder?.get("guidanceCustomizationReadyScreenTextBackgroundCornerRadius")?.toInt() ?: 0
|
|
36
|
+
private val guidanceCustomizationRetryScreenImageBorderColor: String? = themeBuilder?.get("guidanceCustomizationRetryScreenImageBorderColor") ?: "#4bb75f"
|
|
37
|
+
private val guidanceCustomizationRetryScreenImageBorderWidth: Int? = themeBuilder?.get("guidanceCustomizationRetryScreenImageBorderWidth")?.toInt() ?: 0
|
|
38
|
+
private val guidanceCustomizationRetryScreenImageCornerRadius: Int? = themeBuilder?.get("guidanceCustomizationRetryScreenImageCornerRadius")?.toInt() ?: 3
|
|
39
|
+
private val guidanceCustomizationRetryScreenOvalStrokeColor: String? = themeBuilder?.get("guidanceCustomizationRetryScreenOvalStrokeColor") ?: "#4bb75f"
|
|
40
|
+
|
|
41
|
+
//Result Screen Customization
|
|
42
|
+
private val resultScreenCustomizationAnimationRelativeScale: Float = 1.0F
|
|
43
|
+
private val resultScreenCustomizationForegroundColor: String? = themeBuilder?.get("resultScreenCustomizationForegroundColor") ?: "#FFFFFF"
|
|
44
|
+
private val resultScreenCustomizationBackgroundColors: String? = themeBuilder?.get("resultScreenCustomizationBackgroundColors") ?: "#FFFFFF"
|
|
45
|
+
private val resultScreenCustomizationActivityIndicatorColor: String? = themeBuilder?.get("resultScreenCustomizationActivityIndicatorColor") ?: "#FFFFFF"
|
|
46
|
+
@DrawableRes
|
|
47
|
+
private val resultScreenCustomizationCustomActivityIndicatorImage: Int? = null
|
|
48
|
+
private val resultScreenCustomizationCustomActivityIndicatorRotationInterval: Int = 1000
|
|
49
|
+
private val resultScreenCustomizationCustomActivityIndicatorAnimation: Int = 0
|
|
50
|
+
private val resultScreenCustomizationShowUploadProgressBar: Boolean = true
|
|
51
|
+
private val resultScreenCustomizationUploadProgressFillColor: String? = themeBuilder?.get("resultScreenCustomizationUploadProgressFillColor") ?: "#4bb75f"
|
|
52
|
+
private val resultScreenCustomizationUploadProgressTrackColor: String? = themeBuilder?.get("resultScreenCustomizationUploadProgressTrackColor") ?: "#333333"
|
|
53
|
+
private val resultScreenCustomizationResultAnimationBackgroundColor: String? = themeBuilder?.get("resultScreenCustomizationResultAnimationBackgroundColor") ?: "#05D758"
|
|
54
|
+
private val resultScreenCustomizationResultAnimationForegroundColor: String? = themeBuilder?.get("resultScreenCustomizationResultAnimationForegroundColor") ?: "#FFFFFF"
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
//Oval Customization
|
|
58
|
+
private val ovalCustomizationStrokeWidth: Int? = themeBuilder?.get("ovalCustomizationStrokeWidth")?.toInt() ?: 3
|
|
59
|
+
private val ovalCustomizationStrokeColor: String? = themeBuilder?.get("ovalCustomizationStrokeColor") ?: "#4bb75f"
|
|
60
|
+
private val ovalCustomizationProgressStrokeWidth: Int? = themeBuilder?.get("ovalCustomizationProgressStrokeWidth")?.toInt() ?: 2
|
|
61
|
+
private val ovalCustomizationProgressColor1: String? = themeBuilder?.get("ovalCustomizationProgressColor1") ?: "#4bb75f"
|
|
62
|
+
private val ovalCustomizationProgressColor2: String? = themeBuilder?.get("ovalCustomizationProgressColor2") ?: "#4bb75f"
|
|
63
|
+
private val ovalCustomizationProgressRadialOffset: Int? = themeBuilder?.get("ovalCustomizationProgressRadialOffset")?.toInt() ?: 2
|
|
64
|
+
|
|
65
|
+
//Frame Customization
|
|
66
|
+
private val frameCustomizationBorderWidth: Int? = themeBuilder?.get("frameCustomizationBorderWidth")?.toInt() ?: 0
|
|
67
|
+
private val frameCustomizationCornerRadius: Int? = themeBuilder?.get("frameCustomizationCornerRadius")?.toInt() ?: 0
|
|
68
|
+
private val frameCustomizationBorderColor: String? = themeBuilder?.get("frameCustomizationBorderColor") ?: "#4bb75f"
|
|
69
|
+
private val frameCustomizationBackgroundColor: String? = themeBuilder?.get("frameCustomizationBackgroundColor") ?: "#FFFFFF"
|
|
70
|
+
private val frameCustomizationElevation: Int? = themeBuilder?.get("frameCustomizationElevation")?.toInt() ?: 0
|
|
71
|
+
|
|
72
|
+
//Overlay Customization
|
|
73
|
+
private val overlayCustomizationBackgroundColor: String? = themeBuilder?.get("overlayCustomizationBackgroundColor") ?: "#FFFFFF"
|
|
74
|
+
|
|
75
|
+
//Feedback Customization
|
|
76
|
+
private val feedbackCustomizationCornerRadius: Int? = themeBuilder?.get("feedbackCustomizationCornerRadius")?.toInt() ?: 2
|
|
77
|
+
private val feedbackCustomizationBackgroundColors: String? = themeBuilder?.get("overlayCustomizationBackgroundColor") ?: "#666666"
|
|
78
|
+
private val feedbackCustomizationTextColor: String? = themeBuilder?.get("feedbackCustomizationTextColor") ?: "#FFFFFF"
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
fun apply(): Liveness3DTheme {
|
|
82
|
+
return Liveness3DTheme.Builder()
|
|
83
|
+
.guidanceCustomizationBackgroundColors(guidanceCustomizationBackgroundColors)
|
|
84
|
+
.guidanceCustomizationForegroundColor(guidanceCustomizationForegroundColor)
|
|
85
|
+
//Botões
|
|
86
|
+
.guidanceCustomizationButtonTextNormalColor(guidanceCustomizationButtonTextNormalColor)
|
|
87
|
+
.guidanceCustomizationButtonBackgroundNormalColor(guidanceCustomizationButtonBackgroundNormalColor)
|
|
88
|
+
.guidanceCustomizationButtonTextHighlightColor(guidanceCustomizationButtonTextHighlightColor)
|
|
89
|
+
.guidanceCustomizationButtonBackgroundHighlightColor(guidanceCustomizationButtonBackgroundHighlightColor)
|
|
90
|
+
.guidanceCustomizationButtonTextDisabledColor(guidanceCustomizationButtonTextDisabledColor)
|
|
91
|
+
.guidanceCustomizationButtonBackgroundDisabledColor(guidanceCustomizationButtonBackgroundDisabledColor)
|
|
92
|
+
.guidanceCustomizationButtonBorderColor(guidanceCustomizationButtonBorderColor)
|
|
93
|
+
.guidanceCustomizationButtonBorderWidth(guidanceCustomizationButtonBorderWidth)
|
|
94
|
+
.guidanceCustomizationButtonCornerRadius(guidanceCustomizationButtonCornerRadius)
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
//Ready Screen
|
|
98
|
+
.guidanceCustomizationReadyScreenHeaderTextColor(guidanceCustomizationReadyScreenHeaderTextColor)
|
|
99
|
+
.guidanceCustomizationReadyScreenSubtextTextColor(guidanceCustomizationReadyScreenSubtextTextColor)
|
|
100
|
+
|
|
101
|
+
//Retry Screen
|
|
102
|
+
.guidanceCustomizationRetryScreenHeaderTextColor(guidanceCustomizationRetryScreenHeaderTextColor)
|
|
103
|
+
.guidanceCustomizationRetryScreenSubtextTextColor(guidanceCustomizationRetryScreenSubtextTextColor)
|
|
104
|
+
.guidanceCustomizationRetryScreenImageBorderColor(guidanceCustomizationRetryScreenImageBorderColor)
|
|
105
|
+
.guidanceCustomizationRetryScreenImageBorderWidth(guidanceCustomizationRetryScreenImageBorderWidth)
|
|
106
|
+
.guidanceCustomizationRetryScreenImageCornerRadius(guidanceCustomizationRetryScreenImageCornerRadius)
|
|
107
|
+
.guidanceCustomizationRetryScreenOvalStrokeColor(guidanceCustomizationRetryScreenOvalStrokeColor)
|
|
108
|
+
.guidanceCustomizationReadyScreenOvalFillColor(guidanceCustomizationReadyScreenOvalFillColor)
|
|
109
|
+
.guidanceCustomizationReadyScreenTextBackgroundColor(guidanceCustomizationReadyScreenTextBackgroundColor)
|
|
110
|
+
.guidanceCustomizationReadyScreenTextBackgroundCornerRadius(guidanceCustomizationReadyScreenTextBackgroundCornerRadius)
|
|
111
|
+
|
|
112
|
+
//Result Screen
|
|
113
|
+
.resultScreenCustomizationAnimationRelativeScale(resultScreenCustomizationAnimationRelativeScale)
|
|
114
|
+
.resultScreenCustomizationForegroundColor(resultScreenCustomizationForegroundColor)
|
|
115
|
+
.resultScreenCustomizationBackgroundColors(resultScreenCustomizationBackgroundColors)
|
|
116
|
+
.resultScreenCustomizationActivityIndicatorColor(resultScreenCustomizationActivityIndicatorColor)
|
|
117
|
+
.resultScreenCustomizationUploadProgressFillColor(resultScreenCustomizationUploadProgressFillColor)
|
|
118
|
+
.resultScreenCustomizationUploadProgressTrackColor(resultScreenCustomizationUploadProgressTrackColor)
|
|
119
|
+
.resultScreenCustomizationResultAnimationBackgroundColor(resultScreenCustomizationResultAnimationBackgroundColor)
|
|
120
|
+
.resultScreenCustomizationResultAnimationForegroundColor(resultScreenCustomizationResultAnimationForegroundColor)
|
|
121
|
+
|
|
122
|
+
//Oval
|
|
123
|
+
.ovalCustomizationStrokeWidth(ovalCustomizationStrokeWidth)
|
|
124
|
+
.ovalCustomizationStrokeColor(ovalCustomizationStrokeColor)
|
|
125
|
+
.ovalCustomizationProgressStrokeWidth(ovalCustomizationProgressStrokeWidth)
|
|
126
|
+
.ovalCustomizationProgressColor1(ovalCustomizationProgressColor1)
|
|
127
|
+
.ovalCustomizationProgressColor2(ovalCustomizationProgressColor2)
|
|
128
|
+
.ovalCustomizationProgressRadialOffset(ovalCustomizationProgressRadialOffset)
|
|
129
|
+
|
|
130
|
+
//Frame
|
|
131
|
+
.frameCustomizationBorderWidth(frameCustomizationBorderWidth)
|
|
132
|
+
.frameCustomizationCornerRadius(frameCustomizationCornerRadius)
|
|
133
|
+
.frameCustomizationBorderColor(frameCustomizationBorderColor)
|
|
134
|
+
.frameCustomizationBackgroundColor(frameCustomizationBackgroundColor)
|
|
135
|
+
.frameCustomizationElevation(frameCustomizationElevation)
|
|
136
|
+
|
|
137
|
+
//Overlay
|
|
138
|
+
.overlayCustomizationBackgroundColor(overlayCustomizationBackgroundColor)
|
|
139
|
+
|
|
140
|
+
//Feedback Screen
|
|
141
|
+
.feedbackCustomizationCornerRadius(feedbackCustomizationCornerRadius)
|
|
142
|
+
.feedbackCustomizationBackgroundColors(feedbackCustomizationBackgroundColors)
|
|
143
|
+
.feedbackCustomizationTextColor(feedbackCustomizationTextColor)
|
|
144
|
+
|
|
145
|
+
.build()
|
|
146
|
+
}
|
|
147
|
+
}
|