@oiti/rn-liveness3d 1.0.2 → 1.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 +23 -18
- package/android/build.gradle +5 -3
- package/android/src/main/java/br/com/oiti/rnliveness3d/RnLiveness3dModule.kt +18 -2
- package/ios/Podfile +4 -5
- package/ios/Podfile.lock +23 -9
- package/ios/Pods/Manifest.lock +23 -9
- package/ios/RnLiveness3d.swift +107 -118
- package/ios/RnLiveness3d.xcodeproj/project.pbxproj +2 -0
- package/ios/RnLiveness3d.xcodeproj/xcshareddata/xcschemes/RnLiveness3d.xcscheme +80 -0
- package/lib/commonjs/index.js +24 -15
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/index.js +24 -15
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/@types/ArgsType.d.ts +7 -0
- package/lib/typescript/@types/ArgsType.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +6 -4
- package/lib/typescript/index.d.ts.map +1 -1
- package/oiti-rn-liveness3d.podspec +2 -2
- package/package.json +1 -1
- package/src/@types/ArgsType.ts +8 -0
- package/src/index.tsx +32 -9
package/README.md
CHANGED
|
@@ -130,14 +130,10 @@ const options = {
|
|
|
130
130
|
appkey: appKey,
|
|
131
131
|
environment: '.HML',
|
|
132
132
|
baseUrl: 'https://comercial.certiface.com.br:8443/',
|
|
133
|
-
apparence: {
|
|
134
|
-
backgroundColor: '#025951',
|
|
135
|
-
loadingColor: '#0CF25D',
|
|
136
|
-
},
|
|
137
133
|
};
|
|
138
134
|
```
|
|
139
135
|
|
|
140
|
-
### 4.2.
|
|
136
|
+
### 4.2.3. JSON `texts`
|
|
141
137
|
|
|
142
138
|
```jsx
|
|
143
139
|
const texts = {
|
|
@@ -173,7 +169,6 @@ const texts = {
|
|
|
173
169
|
FEEDBACK_HOLD_STEADY_1: 'Aguente Firme: 1',
|
|
174
170
|
FEEDBACK_HOLD_STEADY_2: 'Aguente Firme: 2',
|
|
175
171
|
FEEDBACK_HOLD_STEADY_3: 'Aguente Firme: 3',
|
|
176
|
-
FEEDBACK_EYES_STRAIGHT_AHEAD: 'Olhe Para Frente',
|
|
177
172
|
FEEDBACK_REMOVE_DARK_GLASSES: 'Tire Seus Óculos de Sol',
|
|
178
173
|
FEEDBACK_NEUTRAL_EXPRESSION: 'Fique Neutro, Não Sorria',
|
|
179
174
|
FEEDBACK_CONDITIONS_TOO_BRIGHT: 'Ambiente Muito Iluminado',
|
|
@@ -181,21 +176,27 @@ const texts = {
|
|
|
181
176
|
};
|
|
182
177
|
```
|
|
183
178
|
|
|
184
|
-
### 4.2.3.
|
|
179
|
+
### 4.2.3. JSON `Loading`
|
|
180
|
+
|
|
181
|
+
```jsx
|
|
182
|
+
const loading = {
|
|
183
|
+
type: 'default' | 'spinner',
|
|
184
|
+
size: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10,
|
|
185
|
+
backgroundColor: string | undefined,
|
|
186
|
+
loadingColor: string | undefined,
|
|
187
|
+
};
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
### 4.2.4. Chaves do `options`
|
|
185
191
|
|
|
186
192
|
| View | Valores | Descrição |
|
|
187
193
|
| ----------- | ---------------------------------------- | --------------------------------------------------------------------------------------------------------------------- |
|
|
188
194
|
| appkey | appKey | App Key gerada no backend da aplicação e retornada para uso da biblioteca. |
|
|
189
195
|
| environment | '.HML', '.PRD' | Ambiente que deseja estar rodando a aplicação |
|
|
190
196
|
| baseUrl | https://comercial.certiface.com.br:8443/ | Endereço de endpoint da certiface, você pode usar uma string vazia caso deseje que a biblioteca defina um automático. |
|
|
191
|
-
|
|
|
192
|
-
|
|
193
|
-
backgroundColor: '#025951',
|
|
194
|
-
loadingColor: '#0CF25D',
|
|
197
|
+
| loading | Objeto de customização | Aplica as propriedades de customização do loading antes de começar o Liveness3d. |
|
|
195
198
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
### 4.2.4. Exemplo de uso (View Customizada)
|
|
199
|
+
### 4.2.5. Exemplo de uso (View Customizada)
|
|
199
200
|
|
|
200
201
|
Para utilizar uma view customizada você pode aplicar o seguinte código em sua biblioteca React Native.
|
|
201
202
|
|
|
@@ -210,10 +211,13 @@ export default function Documentscopy({ navigation }: { navigation: any }) {
|
|
|
210
211
|
appkey: appKey,
|
|
211
212
|
environment: '.HML',
|
|
212
213
|
baseUrl: 'https://comercial.certiface.com.br:8443/',
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
214
|
+
};
|
|
215
|
+
|
|
216
|
+
const loading = {
|
|
217
|
+
type: 'spinner',
|
|
218
|
+
size: 5,
|
|
219
|
+
backgroundColor: '#000000',
|
|
220
|
+
loadingColor: '#0CF25D',
|
|
217
221
|
};
|
|
218
222
|
|
|
219
223
|
const texts = {
|
|
@@ -229,6 +233,7 @@ export default function Documentscopy({ navigation }: { navigation: any }) {
|
|
|
229
233
|
options={options}
|
|
230
234
|
navigation={navigation}
|
|
231
235
|
texts={texts}
|
|
236
|
+
loading={loading}
|
|
232
237
|
callbackView="Home"
|
|
233
238
|
CustomInstructionView={CustomInstructionView}
|
|
234
239
|
CustomPermissionView={CustomPermissionView}
|
package/android/build.gradle
CHANGED
|
@@ -7,7 +7,7 @@ buildscript {
|
|
|
7
7
|
mavenCentral()
|
|
8
8
|
maven { url "https://raw.githubusercontent.com/oititec/android-oiti-versions-beta/master" }
|
|
9
9
|
maven {
|
|
10
|
-
url 'https://raw.githubusercontent.com/oititec/android-oiti-versions/master'
|
|
10
|
+
url 'https://raw.githubusercontent.com/oititec/android-oiti-versions-beta/master'
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
13
|
|
|
@@ -15,6 +15,7 @@ buildscript {
|
|
|
15
15
|
classpath 'com.android.tools.build:gradle:3.5.3'
|
|
16
16
|
// noinspection DifferentKotlinGradleVersion
|
|
17
17
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
|
18
|
+
classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version"
|
|
18
19
|
}
|
|
19
20
|
}
|
|
20
21
|
|
|
@@ -24,6 +25,7 @@ def isNewArchitectureEnabled() {
|
|
|
24
25
|
|
|
25
26
|
apply plugin: 'com.android.library'
|
|
26
27
|
apply plugin: 'kotlin-android'
|
|
28
|
+
apply plugin: 'kotlinx-serialization'
|
|
27
29
|
|
|
28
30
|
if (isNewArchitectureEnabled()) {
|
|
29
31
|
apply plugin: 'com.facebook.react'
|
|
@@ -147,13 +149,13 @@ dependencies {
|
|
|
147
149
|
implementation "com.squareup.okhttp3:logging-interceptor:4.9.3"
|
|
148
150
|
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.3.1'
|
|
149
151
|
implementation 'androidx.fragment:fragment-ktx:1.3.6'
|
|
150
|
-
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.0"
|
|
151
152
|
implementation group: 'com.google.code.gson', name: 'gson', version: '2.9.0'
|
|
152
153
|
implementation group: 'com.squareup.retrofit2', name: 'converter-gson', version: '2.9.0'
|
|
153
154
|
implementation "com.squareup.retrofit2:retrofit:2.9.0"
|
|
154
155
|
implementation 'androidx.databinding:databinding-runtime:4.2.2'
|
|
155
156
|
|
|
156
|
-
|
|
157
|
+
|
|
158
|
+
implementation 'br.com.oiti:liveness3d-sdk:7.1.2'
|
|
157
159
|
implementation 'br.com.oiti:security:1.2'
|
|
158
160
|
|
|
159
161
|
// From node_modules
|
|
@@ -6,13 +6,16 @@ import android.app.Activity
|
|
|
6
6
|
import android.content.Context
|
|
7
7
|
import android.content.Intent
|
|
8
8
|
import android.content.pm.PackageManager
|
|
9
|
+
import android.util.Log
|
|
9
10
|
import androidx.annotation.NonNull
|
|
10
11
|
import androidx.core.app.ActivityCompat
|
|
11
12
|
import androidx.core.content.*
|
|
13
|
+
|
|
12
14
|
import br.com.oiti.liveness3d.app.ui.HybridLiveness3DActivity
|
|
13
15
|
import br.com.oiti.liveness3d.data.model.ENVIRONMENT3D
|
|
14
16
|
import br.com.oiti.liveness3d.data.model.Liveness3DTextKey
|
|
15
17
|
import br.com.oiti.liveness3d.data.model.Liveness3DUser
|
|
18
|
+
import br.com.oiti.liveness3d.data.model.LoadingType3D
|
|
16
19
|
import br.com.oiti.security.observability.firebase.FirebaseEvents
|
|
17
20
|
import com.facebook.react.bridge.*
|
|
18
21
|
import com.facebook.react.bridge.Promise
|
|
@@ -61,10 +64,16 @@ class RnLiveness3dModule(reactContext: ReactApplicationContext) :
|
|
|
61
64
|
FirebaseEvents(name.toString(), appKey).apply()
|
|
62
65
|
}
|
|
63
66
|
|
|
67
|
+
|
|
68
|
+
|
|
64
69
|
@NonNull
|
|
65
70
|
@ReactMethod
|
|
66
|
-
fun startliveness3d(appKey: String, promise: Promise) {
|
|
71
|
+
fun startliveness3d(appKey: String, type: String, size: Int, backgroundColor: String, loadingColor: String, promise: Promise) {
|
|
67
72
|
val currentActivity = currentActivity
|
|
73
|
+
Log.d("LOADING RN TYPE", type)
|
|
74
|
+
Log.d("LOADING RN SIZE", size.toString())
|
|
75
|
+
Log.d("LOADING RN BG", backgroundColor)
|
|
76
|
+
Log.d("LOADING RN LC", loadingColor)
|
|
68
77
|
|
|
69
78
|
val texts = hashMapOf<Liveness3DTextKey, String>(
|
|
70
79
|
Liveness3DTextKey.READY_HEADER_1 to "Prepare-se para seu",
|
|
@@ -99,7 +108,6 @@ class RnLiveness3dModule(reactContext: ReactApplicationContext) :
|
|
|
99
108
|
Liveness3DTextKey.FEEDBACK_HOLD_STEADY_1 to "Aguente Firme: 1",
|
|
100
109
|
Liveness3DTextKey.FEEDBACK_HOLD_STEADY_2 to "Aguente Firme: 2",
|
|
101
110
|
Liveness3DTextKey.FEEDBACK_HOLD_STEADY_3 to "Aguente Firme: 3",
|
|
102
|
-
Liveness3DTextKey.FEEDBACK_EYES_STRAIGHT_AHEAD to "Olhe Para Frente",
|
|
103
111
|
Liveness3DTextKey.FEEDBACK_REMOVE_DARK_GLASSES to "Tire Seus Óculos de Sol",
|
|
104
112
|
Liveness3DTextKey.FEEDBACK_NEUTRAL_EXPRESSION to "Fique Neutro, Não Sorria",
|
|
105
113
|
Liveness3DTextKey.FEEDBACK_CONDITIONS_TOO_BRIGHT to "Ambiente Muito Iluminado",
|
|
@@ -118,6 +126,14 @@ class RnLiveness3dModule(reactContext: ReactApplicationContext) :
|
|
|
118
126
|
val intent = Intent(getCurrentActivity(), HybridLiveness3DActivity::class.java).apply {
|
|
119
127
|
putExtra(HybridLiveness3DActivity.PARAM_LIVENESS3D_USER, liveness3DUser)
|
|
120
128
|
putExtra(HybridLiveness3DActivity.PARAM_TEXTS, texts)
|
|
129
|
+
putExtra(HybridLiveness3DActivity.PARAM_CUSTOM_LOADING_BACKGROUND, backgroundColor)
|
|
130
|
+
putExtra(HybridLiveness3DActivity.PARAM_CUSTOM_LOADING_SPINNER_COLOR, loadingColor)
|
|
131
|
+
putExtra(HybridLiveness3DActivity.PARAM_CUSTOM_LOADING_SIZE, size)
|
|
132
|
+
if(type == "default"){
|
|
133
|
+
putExtra(HybridLiveness3DActivity.PARAM_CUSTOM_LOADING_TYPE, LoadingType3D.ACTIVITY_INDICATOR)
|
|
134
|
+
}else{
|
|
135
|
+
putExtra(HybridLiveness3DActivity.PARAM_CUSTOM_LOADING_TYPE, LoadingType3D.SPINNER)
|
|
136
|
+
}
|
|
121
137
|
}
|
|
122
138
|
getCurrentActivity()?.startActivityForResult(intent, LIVENESS3D_REQUEST)
|
|
123
139
|
} catch (e: Exception) {
|
package/ios/Podfile
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
platform :ios, '
|
|
2
|
-
|
|
3
|
-
source 'https://github.com/oititec/ios-artifactory.git'
|
|
1
|
+
platform :ios, '12.4'
|
|
2
|
+
|
|
3
|
+
source 'https://github.com/oititec/ios-artifactory-beta.git'
|
|
4
4
|
source 'https://github.com/CocoaPods/Specs.git'
|
|
5
5
|
|
|
6
6
|
|
|
@@ -9,7 +9,6 @@ target 'RnLiveness3d' do
|
|
|
9
9
|
use_frameworks!
|
|
10
10
|
|
|
11
11
|
# Pods for sampleUsageLivenessSDK
|
|
12
|
-
pod '
|
|
13
|
-
# pod 'OISecurity', '1.0.0'
|
|
12
|
+
pod 'OILiveness3D', '1.0.1'
|
|
14
13
|
|
|
15
14
|
end
|
package/ios/Podfile.lock
CHANGED
|
@@ -1,20 +1,34 @@
|
|
|
1
1
|
PODS:
|
|
2
|
-
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
- OICommons (1.1.0)
|
|
3
|
+
- OIComponents (1.2.1):
|
|
4
|
+
- OICommons (~> 1.1.0)
|
|
5
|
+
- OILiveness3D (1.0.0):
|
|
6
|
+
- OICommons (~> 1.1.0)
|
|
7
|
+
- OIComponents (~> 1.2.0)
|
|
8
|
+
- OILiveness3D_FT (= 9.6.40)
|
|
9
|
+
- OINetwork (~> 1.2.0)
|
|
10
|
+
- OILiveness3D_FT (9.6.40)
|
|
11
|
+
- OINetwork (1.2.0):
|
|
12
|
+
- OICommons (~> 1.1.0)
|
|
5
13
|
|
|
6
14
|
DEPENDENCIES:
|
|
7
|
-
-
|
|
15
|
+
- OILiveness3D (= 1.0.0)
|
|
8
16
|
|
|
9
17
|
SPEC REPOS:
|
|
10
|
-
https://github.com/oititec/
|
|
11
|
-
-
|
|
18
|
+
https://github.com/oititec/ios-artifactory.git:
|
|
19
|
+
- OICommons
|
|
20
|
+
- OIComponents
|
|
21
|
+
- OILiveness3D
|
|
12
22
|
- OILiveness3D_FT
|
|
23
|
+
- OINetwork
|
|
13
24
|
|
|
14
25
|
SPEC CHECKSUMS:
|
|
15
|
-
|
|
16
|
-
|
|
26
|
+
OICommons: c304a4f3aa3f0fe9282eae013a45fde717ad42bf
|
|
27
|
+
OIComponents: 8cf47c0dc9b3477e8e4d5513c99b0c83283da3ce
|
|
28
|
+
OILiveness3D: 0c563045356e9af3c182788e4cfd56b4b5d6c7a3
|
|
29
|
+
OILiveness3D_FT: a58ceb6ea1b1229015434125d25b78b46f7667a9
|
|
30
|
+
OINetwork: 3cf1ea4bd61a98bd68db7d1caa3f175b4868f5b4
|
|
17
31
|
|
|
18
|
-
PODFILE CHECKSUM:
|
|
32
|
+
PODFILE CHECKSUM: a3090c37daedeabb4d72153ace1c3354a15c0f2a
|
|
19
33
|
|
|
20
34
|
COCOAPODS: 1.12.0
|
package/ios/Pods/Manifest.lock
CHANGED
|
@@ -1,20 +1,34 @@
|
|
|
1
1
|
PODS:
|
|
2
|
-
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
- OICommons (1.1.0)
|
|
3
|
+
- OIComponents (1.2.1):
|
|
4
|
+
- OICommons (~> 1.1.0)
|
|
5
|
+
- OILiveness3D (1.0.0):
|
|
6
|
+
- OICommons (~> 1.1.0)
|
|
7
|
+
- OIComponents (~> 1.2.0)
|
|
8
|
+
- OILiveness3D_FT (= 9.6.40)
|
|
9
|
+
- OINetwork (~> 1.2.0)
|
|
10
|
+
- OILiveness3D_FT (9.6.40)
|
|
11
|
+
- OINetwork (1.2.0):
|
|
12
|
+
- OICommons (~> 1.1.0)
|
|
5
13
|
|
|
6
14
|
DEPENDENCIES:
|
|
7
|
-
-
|
|
15
|
+
- OILiveness3D (= 1.0.0)
|
|
8
16
|
|
|
9
17
|
SPEC REPOS:
|
|
10
|
-
https://github.com/oititec/
|
|
11
|
-
-
|
|
18
|
+
https://github.com/oititec/ios-artifactory.git:
|
|
19
|
+
- OICommons
|
|
20
|
+
- OIComponents
|
|
21
|
+
- OILiveness3D
|
|
12
22
|
- OILiveness3D_FT
|
|
23
|
+
- OINetwork
|
|
13
24
|
|
|
14
25
|
SPEC CHECKSUMS:
|
|
15
|
-
|
|
16
|
-
|
|
26
|
+
OICommons: c304a4f3aa3f0fe9282eae013a45fde717ad42bf
|
|
27
|
+
OIComponents: 8cf47c0dc9b3477e8e4d5513c99b0c83283da3ce
|
|
28
|
+
OILiveness3D: 0c563045356e9af3c182788e4cfd56b4b5d6c7a3
|
|
29
|
+
OILiveness3D_FT: a58ceb6ea1b1229015434125d25b78b46f7667a9
|
|
30
|
+
OINetwork: 3cf1ea4bd61a98bd68db7d1caa3f175b4868f5b4
|
|
17
31
|
|
|
18
|
-
PODFILE CHECKSUM:
|
|
32
|
+
PODFILE CHECKSUM: a3090c37daedeabb4d72153ace1c3354a15c0f2a
|
|
19
33
|
|
|
20
34
|
COCOAPODS: 1.12.0
|
package/ios/RnLiveness3d.swift
CHANGED
|
@@ -1,32 +1,14 @@
|
|
|
1
|
-
import
|
|
1
|
+
import OILiveness3D
|
|
2
|
+
import OIComponents
|
|
3
|
+
import OICommons
|
|
2
4
|
import AVFoundation
|
|
3
5
|
|
|
4
|
-
class ObservabilityWorker {
|
|
5
|
-
private let configuration: OIObservability.EventConfigurationProtocol
|
|
6
|
-
private let manager: OIObservability.EventManagerProtocol
|
|
7
|
-
|
|
8
|
-
init(configuration: OIOBservability.EventConfigurationProtocol){
|
|
9
|
-
serf.configuration = configuration
|
|
10
|
-
self.manager = configuration.eventManager
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
func logEventHybrid(value: String){
|
|
14
|
-
let parameters: [String: Any] = [
|
|
15
|
-
"value": values,
|
|
16
|
-
"timestamp": Date().timeIntervalSince1970
|
|
17
|
-
]
|
|
18
|
-
manager.logEvent(type: .ACTION_L3FT_instructionContinue, parameters: parameters)
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
6
|
@objc(RnLiveness3d)
|
|
23
7
|
class RnLiveness3d: NSObject, Liveness3DDelegate {
|
|
24
8
|
|
|
25
9
|
var resolve:RCTPromiseResolveBlock!
|
|
26
10
|
var reject:RCTPromiseRejectBlock!
|
|
27
11
|
|
|
28
|
-
private let certifaceURL = "https://comercial.certiface.com.br:8443/"
|
|
29
|
-
|
|
30
12
|
func handleLiveness3DValidation(validateModel: Liveness3DSuccess) {
|
|
31
13
|
resolve("RESULT_OK")
|
|
32
14
|
}
|
|
@@ -39,19 +21,16 @@ class RnLiveness3d: NSObject, Liveness3DDelegate {
|
|
|
39
21
|
func logevent(args: Dictionary<String,Any>?, resolve:@escaping RCTPromiseResolveBlock, reject:RCTPromiseRejectBlock) -> Void {
|
|
40
22
|
let event = args?["event"] as? String ?? ""
|
|
41
23
|
print(event)
|
|
42
|
-
|
|
43
|
-
|
|
44
24
|
}
|
|
45
25
|
|
|
46
|
-
|
|
47
26
|
@objc(checkiospermission:withResolver:withRejecter:)
|
|
48
27
|
func checkiospermission(args: Dictionary<String,Any>?, resolve:@escaping RCTPromiseResolveBlock, reject:RCTPromiseRejectBlock) -> Void {
|
|
49
28
|
AVCaptureDevice.requestAccess(for: AVMediaType.video) { response in
|
|
50
29
|
if response {
|
|
51
|
-
|
|
30
|
+
resolve("true")
|
|
52
31
|
|
|
53
32
|
} else {
|
|
54
|
-
|
|
33
|
+
resolve("false")
|
|
55
34
|
}
|
|
56
35
|
}
|
|
57
36
|
}
|
|
@@ -65,135 +44,145 @@ class RnLiveness3d: NSObject, Liveness3DDelegate {
|
|
|
65
44
|
}
|
|
66
45
|
}
|
|
67
46
|
|
|
68
|
-
|
|
69
|
-
|
|
70
47
|
@objc(startliveness3d:withResolver:withRejecter:)
|
|
71
48
|
func startliveness3D(args: Dictionary<String,Any>?, resolve:@escaping RCTPromiseResolveBlock, reject:RCTPromiseRejectBlock) -> Void {
|
|
72
49
|
self.resolve = resolve
|
|
73
50
|
|
|
74
|
-
|
|
75
|
-
|
|
76
51
|
let appKey = args?["appkey"] as? String ?? ""
|
|
77
|
-
let
|
|
78
|
-
let environment = args?["environment"] as? String ?? "HML"
|
|
52
|
+
let env = args?["environment"] as? String ?? "HML"
|
|
79
53
|
let apparence = args?["apparence"] as? Dictionary<String,Any> ?? nil
|
|
54
|
+
|
|
55
|
+
let loading = args?["loading"] as? Dictionary<String,Any> ?? nil
|
|
56
|
+
|
|
57
|
+
let typeLoading = loading?["type"] as? String ?? "default"
|
|
58
|
+
let sizeLoading = loading?["size"] as? Int ?? 180
|
|
59
|
+
let backgroundColor = loading?["backgroundColor"] as? String ?? "#FFFFFF"
|
|
60
|
+
let loadingColor = loading?["loadingColor"] as? String ?? "#000000"
|
|
61
|
+
|
|
62
|
+
//Map Texts
|
|
80
63
|
let liveness3Dtext = args?["liveness3Dtext"] as? Dictionary<String,Any> ?? nil
|
|
81
64
|
|
|
65
|
+
// Ready Screen
|
|
82
66
|
let READY_HEADER_1 = liveness3Dtext?["READY_HEADER_1"] as? String ?? ""
|
|
83
67
|
let READY_HEADER_2 = liveness3Dtext?["READY_HEADER_2"] as? String ?? ""
|
|
84
68
|
let READY_MESSAGE_1 = liveness3Dtext?["READY_MESSAGE_1"] as? String ?? ""
|
|
85
69
|
let READY_MESSAGE_2 = liveness3Dtext?["READY_MESSAGE_2"] as? String ?? ""
|
|
86
|
-
let RETRY_HEADER = liveness3Dtext?["RETRY_HEADER"] as? String ?? "Vamos tentar novamente?"
|
|
87
70
|
let READY_BUTTON = liveness3Dtext?["READY_BUTTON"] as? String ?? ""
|
|
88
|
-
let RETRY_BUTTON = liveness3Dtext?["READY_BUTTON"] as? String ?? "Tentar novamente"
|
|
89
|
-
let RETRY_YOUR_PICTURE = liveness3Dtext?["RETRY_YOUR_PICTURE"] as? String ?? "Sua foto"
|
|
90
|
-
|
|
91
|
-
let RETRY_MESSAGE_SMILE = liveness3Dtext?["RETRY_MESSAGE_SMILE"] as? String ?? "Expressão Neutra, Sem Sorrir"
|
|
92
|
-
let RETRY_MESSAGE_LIGHTING = liveness3Dtext?["RETRY_MESSAGE_LIGHTING"] as? String ?? "Evite reflexos e iluminação extrema."
|
|
93
|
-
let RETRY_MESSAGE_CONTRAST = liveness3Dtext?["RETRY_MESSAGE_CONTRAST"] as? String ?? "Limpe Sua Câmera"
|
|
94
|
-
let RETRY_IDEAL_PICTURE = liveness3Dtext?["RETRY_IDEAL_PICTURE"] as? String ?? ""
|
|
95
|
-
let RETRY_SUBHEADER = liveness3Dtext?["RETRY_SUBHEADER"] as? String ?? "Siga o exemplo de foto ideal abaixo:"
|
|
96
71
|
|
|
72
|
+
// Feedback Screen
|
|
73
|
+
let FEEDBACK_CENTER_FACE = liveness3Dtext?["FEEDBACK_CENTER_FACE"] as? String ?? ""
|
|
74
|
+
let FEEDBACK_FACE_NOT_FOUND = liveness3Dtext?["FEEDBACK_FACE_NOT_FOUND"] as? String ?? ""
|
|
75
|
+
let FEEDBACK_FACE_NOT_LOOKING_STRAIGHT_AHEAD = liveness3Dtext?["FEEDBACK_FACE_NOT_LOOKING_STRAIGHT_AHEAD"] as? String ?? ""
|
|
76
|
+
let FEEDBACK_FACE_NOT_UPRIGHT = liveness3Dtext?["FEEDBACK_FACE_NOT_UPRIGHT"] as? String ?? ""
|
|
77
|
+
let FEEDBACK_HOLD_STEADY = liveness3Dtext?["FEEDBACK_HOLD_STEADY"] as? String ?? ""
|
|
78
|
+
let FEEDBACK_MOVE_PHONE_AWAY = liveness3Dtext?["FEEDBACK_MOVE_PHONE_AWAY"] as? String ?? ""
|
|
79
|
+
let FEEDBACK_MOVE_PHONE_CLOSER = liveness3Dtext?["FEEDBACK_MOVE_PHONE_CLOSER"] as? String ?? ""
|
|
80
|
+
let FEEDBACK_MOVE_PHONE_TO_EYE_LEVEL = liveness3Dtext?["FEEDBACK_MOVE_PHONE_TO_EYE_LEVEL"] as? String ?? ""
|
|
81
|
+
let FEEDBACK_USE_EVEN_LIGHTING = liveness3Dtext?["FEEDBACK_USE_EVEN_LIGHTING"] as? String ?? ""
|
|
97
82
|
let FEEDBACK_FRAME_YOUR_FACE = liveness3Dtext?["FEEDBACK_FRAME_YOUR_FACE"] as? String ?? ""
|
|
83
|
+
let FEEDBACK_POSITION_FACE_STRAIGHT_IN_OVAL = liveness3Dtext?["FEEDBACK_POSITION_FACE_STRAIGHT_IN_OVAL"] as? String ?? ""
|
|
98
84
|
let FEEDBACK_HOLD_STEADY_1 = liveness3Dtext?["FEEDBACK_HOLD_STEADY_1"] as? String ?? ""
|
|
99
85
|
let FEEDBACK_HOLD_STEADY_2 = liveness3Dtext?["FEEDBACK_HOLD_STEADY_2"] as? String ?? ""
|
|
100
86
|
let FEEDBACK_HOLD_STEADY_3 = liveness3Dtext?["FEEDBACK_HOLD_STEADY_3"] as? String ?? ""
|
|
87
|
+
let FEEDBACK_REMOVE_DARK_GLASSES = liveness3Dtext?["FEEDBACK_REMOVE_DARK_GLASSES"] as? String ?? ""
|
|
88
|
+
let FEEDBACK_NEUTRAL_EXPRESSION = liveness3Dtext?["FEEDBACK_NEUTRAL_EXPRESSION"] as? String ?? ""
|
|
89
|
+
let FEEDBACK_CONDITIONS_TOO_BRIGHT = liveness3Dtext?["FEEDBACK_CONDITIONS_TOO_BRIGHT"] as? String ?? ""
|
|
90
|
+
let FEEDBACK_BRIGHTEN_YOUR_ENVIRONMENT = liveness3Dtext?["FEEDBACK_BRIGHTEN_YOUR_ENVIRONMENT"] as? String ?? ""
|
|
101
91
|
|
|
102
|
-
|
|
103
|
-
|
|
92
|
+
// Result Screen
|
|
93
|
+
let RESULT_UPLOAD_MESSAGE = liveness3Dtext?["RESULT_UPLOAD_MESSAGE"] as? String ?? ""
|
|
94
|
+
let RESULT_SUCCESS_MESSAGE = liveness3Dtext?["RESULT_SUCCESS_MESSAGE"] as? String ?? ""
|
|
104
95
|
|
|
96
|
+
// Retry Screen
|
|
97
|
+
let RETRY_HEADER = liveness3Dtext?["RETRY_HEADER"] as? String ?? "Vamos tentar novamente?"
|
|
98
|
+
let RETRY_SUBHEADER = liveness3Dtext?["RETRY_SUBHEADER"] as? String ?? "Siga o exemplo de foto ideal abaixo:"
|
|
99
|
+
let RETRY_YOUR_PICTURE = liveness3Dtext?["RETRY_YOUR_PICTURE"] as? String ?? "Sua foto"
|
|
100
|
+
let RETRY_IDEAL_PICTURE = liveness3Dtext?["RETRY_IDEAL_PICTURE"] as? String ?? "Não sorria"
|
|
101
|
+
let RETRY_MESSAGE_SMILE = liveness3Dtext?["RETRY_MESSAGE_SMILE"] as? String ?? "Expressão Neutra, Sem Sorrir"
|
|
102
|
+
let RETRY_MESSAGE_LIGHTING = liveness3Dtext?["RETRY_MESSAGE_LIGHTING"] as? String ?? "Evite reflexos e iluminação extrema."
|
|
103
|
+
let RETRY_MESSAGE_CONTRAST = liveness3Dtext?["RETRY_MESSAGE_CONTRAST"] as? String ?? "Limpe Sua Câmera"
|
|
104
|
+
let RETRY_BUTTON = liveness3Dtext?["READY_BUTTON"] as? String ?? "Tentar novamente"
|
|
105
105
|
|
|
106
|
-
|
|
107
|
-
let
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
"FaceTec_retry_subheader_message": RETRY_SUBHEADER,
|
|
150
|
-
"FaceTec_retry_instruction_message_1": RETRY_MESSAGE_SMILE,
|
|
151
|
-
"FaceTec_retry_instruction_message_2": RETRY_MESSAGE_LIGHTING,
|
|
152
|
-
"FaceTec_retry_instruction_message_3": RETRY_MESSAGE_CONTRAST,
|
|
153
|
-
"FaceTec_retry_your_image_label": RETRY_YOUR_PICTURE,
|
|
154
|
-
"FaceTec_retry_ideal_image_label": RETRY_IDEAL_PICTURE];
|
|
155
|
-
|
|
156
|
-
var theme = Liveness3DTheme(Liveness3DThemeType.light)
|
|
157
|
-
theme.ovarCustomizationStrokeColor = UIColor(red: 0.9137, green: 0.3216, blue: 0.149, alpha: 1.0)
|
|
158
|
-
theme.ovarCustomizationProgressColor1 = UIColor(red: 0.9137, green: 0.3216, blue: 0.149, alpha: 1.0)
|
|
159
|
-
theme.ovarCustomizationProgressColor2 = UIColor(red: 0.9137, green: 0.3216, blue: 0.149, alpha: 1.0)
|
|
160
|
-
theme.guidanceCustomizationButtonBackgroundNormalColor = UIColor(red: 0.9137, green: 0.3216, blue: 0.149, alpha: 1.0)
|
|
161
|
-
theme.guidanceCustomizationButtonBackgroundHighlightColor = UIColor(red: 0.9137, green: 0.3216, blue: 0.149, alpha: 1.0)
|
|
162
|
-
theme.guidanceCustomizationButtonBackgroundDisabledColor = UIColor(red: 0.9137, green: 0.3216, blue: 0.149, alpha: 0.5)
|
|
106
|
+
//Liveness3D Texts
|
|
107
|
+
let liveness3DTexts: [Liveness3DTextKey: String] = [
|
|
108
|
+
// Ready Screen
|
|
109
|
+
.readyHeader1: READY_HEADER_1,
|
|
110
|
+
.readyHeader2: READY_HEADER_2,
|
|
111
|
+
.readyMessage1: READY_MESSAGE_1,
|
|
112
|
+
.readyMessage2: READY_MESSAGE_2,
|
|
113
|
+
.readyButton: READY_BUTTON,
|
|
114
|
+
|
|
115
|
+
// Feedback Screen
|
|
116
|
+
.feedbackCenterFace: FEEDBACK_CENTER_FACE,
|
|
117
|
+
.feedbackFaceNotFound: FEEDBACK_FACE_NOT_FOUND,
|
|
118
|
+
.feedbackFaceNotLookingStraightAhead: FEEDBACK_FACE_NOT_LOOKING_STRAIGHT_AHEAD,
|
|
119
|
+
.feedbackFaceNotUpright: FEEDBACK_FACE_NOT_UPRIGHT,
|
|
120
|
+
.feedbackHoldSteady: FEEDBACK_HOLD_STEADY,
|
|
121
|
+
.feedbackMovePhoneAway: FEEDBACK_MOVE_PHONE_AWAY,
|
|
122
|
+
.feedbackMovePhoneCloser: FEEDBACK_MOVE_PHONE_CLOSER,
|
|
123
|
+
.feedbackMovePhoneToEyeLevel: FEEDBACK_MOVE_PHONE_TO_EYE_LEVEL,
|
|
124
|
+
.feedbackUseEvenLighting: FEEDBACK_USE_EVEN_LIGHTING,
|
|
125
|
+
.feedbackFrameYourFace: FEEDBACK_FRAME_YOUR_FACE,
|
|
126
|
+
.feedbackPositionFaceStraightInOval: FEEDBACK_POSITION_FACE_STRAIGHT_IN_OVAL,
|
|
127
|
+
.feedbackHoldSteady1: FEEDBACK_HOLD_STEADY_1,
|
|
128
|
+
.feedbackHoldSteady2: FEEDBACK_HOLD_STEADY_2,
|
|
129
|
+
.feedbackHoldSteady3: FEEDBACK_HOLD_STEADY_3,
|
|
130
|
+
.feedbackRemoveDarkGlasses: FEEDBACK_REMOVE_DARK_GLASSES,
|
|
131
|
+
.feedbackNeutralExpression: FEEDBACK_NEUTRAL_EXPRESSION,
|
|
132
|
+
.feedbackConditionsTooBright: FEEDBACK_CONDITIONS_TOO_BRIGHT,
|
|
133
|
+
.feedbackBrightenYourEnvironment: FEEDBACK_BRIGHTEN_YOUR_ENVIRONMENT,
|
|
134
|
+
|
|
135
|
+
// Result Screen
|
|
136
|
+
.resultUploadMessage: RESULT_UPLOAD_MESSAGE,
|
|
137
|
+
.resultSuccessMessage: RESULT_SUCCESS_MESSAGE,
|
|
138
|
+
|
|
139
|
+
// Retry Screen
|
|
140
|
+
.retryHeader: RETRY_HEADER,
|
|
141
|
+
.retrySubheader: RETRY_SUBHEADER,
|
|
142
|
+
.retryYourPicture: RETRY_YOUR_PICTURE,
|
|
143
|
+
.retryIdealPicture: RETRY_IDEAL_PICTURE,
|
|
144
|
+
.retryMessageSmile: RETRY_MESSAGE_SMILE,
|
|
145
|
+
.retryMessageLightning: RETRY_MESSAGE_LIGHTING,
|
|
146
|
+
.retryMessageContrast: RETRY_MESSAGE_CONTRAST,
|
|
147
|
+
.retryButton: RETRY_BUTTON
|
|
148
|
+
]
|
|
163
149
|
|
|
164
150
|
let liveness3DUser = Liveness3DUser(
|
|
165
151
|
appKey: appKey,
|
|
166
|
-
environment: .HML
|
|
152
|
+
environment: env == "PRD" ? Environment.PRD : Environment.HML,
|
|
153
|
+
texts: liveness3DTexts
|
|
167
154
|
)
|
|
168
155
|
|
|
169
|
-
|
|
170
|
-
let liveness3DUser = Liveness3DUser(
|
|
171
|
-
appKey: appKey,
|
|
172
|
-
environment: .PRD,
|
|
173
|
-
defaultTheme: theme,
|
|
174
|
-
lowLightTheme: theme,
|
|
175
|
-
texts: textsFT
|
|
176
|
-
)
|
|
177
|
-
|
|
178
|
-
}
|
|
179
|
-
*/
|
|
156
|
+
|
|
180
157
|
AVCaptureDevice.requestAccess(for: AVMediaType.video) { response in
|
|
181
158
|
if response {
|
|
182
|
-
|
|
159
|
+
|
|
160
|
+
let spinnerLoading = SpinnerConfiguration(
|
|
161
|
+
backgroundColor: .init(hex: backgroundColor),
|
|
162
|
+
loadingColor: .init(hex: loadingColor),
|
|
163
|
+
strokeWidth: 10,
|
|
164
|
+
scaleFactor: sizeLoading
|
|
165
|
+
)
|
|
166
|
+
|
|
167
|
+
let defaultLoading = ActivityIndicatorConfiguration(
|
|
168
|
+
loadingColor: .init(hex: loadingColor),
|
|
169
|
+
backgroundColor: .init(hex: backgroundColor),
|
|
170
|
+
scaleFactor: sizeLoading
|
|
171
|
+
)
|
|
172
|
+
|
|
183
173
|
DispatchQueue.main.async {
|
|
184
|
-
let initTheme = HybridViewAppearance(
|
|
185
|
-
backgroundColor: .init(hex: backgroundColor),
|
|
186
|
-
loadingColor:.init(hex: loadingColor)
|
|
187
|
-
)
|
|
188
174
|
|
|
189
175
|
let liveness3DViewController = HybridLiveness3DViewController(
|
|
190
176
|
liveness3DUser: liveness3DUser,
|
|
191
177
|
delegate: self,
|
|
192
|
-
customAppearance:
|
|
178
|
+
customAppearance: typeLoading == "spinner" ? .init(configuration: spinnerLoading) : .init(configuration: defaultLoading)
|
|
193
179
|
)
|
|
180
|
+
|
|
194
181
|
liveness3DViewController.modalPresentationStyle = .fullScreen
|
|
195
182
|
RCTPresentedViewController()?.present(liveness3DViewController, animated: true)
|
|
196
183
|
}
|
|
184
|
+
|
|
185
|
+
|
|
197
186
|
} else {
|
|
198
187
|
resolve("RESULT_CANCELED")
|
|
199
188
|
}
|
|
@@ -279,6 +279,7 @@
|
|
|
279
279
|
"$(SRCROOT)/../../../React/**",
|
|
280
280
|
"$(SRCROOT)/../../react-native/React/**",
|
|
281
281
|
);
|
|
282
|
+
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
|
|
282
283
|
LIBRARY_SEARCH_PATHS = "$(inherited)";
|
|
283
284
|
OTHER_LDFLAGS = "-ObjC";
|
|
284
285
|
PRODUCT_NAME = RnLiveness3d;
|
|
@@ -299,6 +300,7 @@
|
|
|
299
300
|
"$(SRCROOT)/../../../React/**",
|
|
300
301
|
"$(SRCROOT)/../../react-native/React/**",
|
|
301
302
|
);
|
|
303
|
+
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
|
|
302
304
|
LIBRARY_SEARCH_PATHS = "$(inherited)";
|
|
303
305
|
OTHER_LDFLAGS = "-ObjC";
|
|
304
306
|
PRODUCT_NAME = RnLiveness3d;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<Scheme
|
|
3
|
+
LastUpgradeVersion = "1430"
|
|
4
|
+
version = "1.7">
|
|
5
|
+
<BuildAction
|
|
6
|
+
parallelizeBuildables = "YES"
|
|
7
|
+
buildImplicitDependencies = "YES">
|
|
8
|
+
<BuildActionEntries>
|
|
9
|
+
<BuildActionEntry
|
|
10
|
+
buildForTesting = "YES"
|
|
11
|
+
buildForRunning = "YES"
|
|
12
|
+
buildForProfiling = "YES"
|
|
13
|
+
buildForArchiving = "YES"
|
|
14
|
+
buildForAnalyzing = "YES">
|
|
15
|
+
<BuildableReference
|
|
16
|
+
BuildableIdentifier = "primary"
|
|
17
|
+
BlueprintIdentifier = "58B511DA1A9E6C8500147676"
|
|
18
|
+
BuildableName = "libRnLiveness3d.a"
|
|
19
|
+
BlueprintName = "RnLiveness3d"
|
|
20
|
+
ReferencedContainer = "container:RnLiveness3d.xcodeproj">
|
|
21
|
+
</BuildableReference>
|
|
22
|
+
</BuildActionEntry>
|
|
23
|
+
<BuildActionEntry
|
|
24
|
+
buildForTesting = "YES"
|
|
25
|
+
buildForRunning = "YES"
|
|
26
|
+
buildForProfiling = "YES"
|
|
27
|
+
buildForArchiving = "YES"
|
|
28
|
+
buildForAnalyzing = "YES">
|
|
29
|
+
<BuildableReference
|
|
30
|
+
BuildableIdentifier = "primary"
|
|
31
|
+
BlueprintIdentifier = "1E2E843BEB5FDC71DDCCF52C06A9113F"
|
|
32
|
+
BuildableName = "OILiveness3D_FT"
|
|
33
|
+
BlueprintName = "OILiveness3D_FT"
|
|
34
|
+
ReferencedContainer = "container:Pods/Pods.xcodeproj">
|
|
35
|
+
</BuildableReference>
|
|
36
|
+
</BuildActionEntry>
|
|
37
|
+
</BuildActionEntries>
|
|
38
|
+
</BuildAction>
|
|
39
|
+
<TestAction
|
|
40
|
+
buildConfiguration = "Debug"
|
|
41
|
+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
|
42
|
+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
|
43
|
+
shouldUseLaunchSchemeArgsEnv = "YES"
|
|
44
|
+
shouldAutocreateTestPlan = "YES">
|
|
45
|
+
</TestAction>
|
|
46
|
+
<LaunchAction
|
|
47
|
+
buildConfiguration = "Debug"
|
|
48
|
+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
|
49
|
+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
|
50
|
+
launchStyle = "0"
|
|
51
|
+
useCustomWorkingDirectory = "NO"
|
|
52
|
+
ignoresPersistentStateOnLaunch = "NO"
|
|
53
|
+
debugDocumentVersioning = "YES"
|
|
54
|
+
debugServiceExtension = "internal"
|
|
55
|
+
allowLocationSimulation = "YES">
|
|
56
|
+
</LaunchAction>
|
|
57
|
+
<ProfileAction
|
|
58
|
+
buildConfiguration = "Release"
|
|
59
|
+
shouldUseLaunchSchemeArgsEnv = "YES"
|
|
60
|
+
savedToolIdentifier = ""
|
|
61
|
+
useCustomWorkingDirectory = "NO"
|
|
62
|
+
debugDocumentVersioning = "YES">
|
|
63
|
+
<MacroExpansion>
|
|
64
|
+
<BuildableReference
|
|
65
|
+
BuildableIdentifier = "primary"
|
|
66
|
+
BlueprintIdentifier = "58B511DA1A9E6C8500147676"
|
|
67
|
+
BuildableName = "libRnLiveness3d.a"
|
|
68
|
+
BlueprintName = "RnLiveness3d"
|
|
69
|
+
ReferencedContainer = "container:RnLiveness3d.xcodeproj">
|
|
70
|
+
</BuildableReference>
|
|
71
|
+
</MacroExpansion>
|
|
72
|
+
</ProfileAction>
|
|
73
|
+
<AnalyzeAction
|
|
74
|
+
buildConfiguration = "Debug">
|
|
75
|
+
</AnalyzeAction>
|
|
76
|
+
<ArchiveAction
|
|
77
|
+
buildConfiguration = "Release"
|
|
78
|
+
revealArchiveInOrganizer = "YES">
|
|
79
|
+
</ArchiveAction>
|
|
80
|
+
</Scheme>
|
package/lib/commonjs/index.js
CHANGED
|
@@ -29,7 +29,7 @@ const RnLiveness3d = _reactNative.NativeModules.RnLiveness3d ? _reactNative.Nati
|
|
|
29
29
|
throw new Error(LINKING_ERROR);
|
|
30
30
|
}
|
|
31
31
|
});
|
|
32
|
-
function startLiveness3d(options) {
|
|
32
|
+
function startLiveness3d(options, loading) {
|
|
33
33
|
var _options$apparence, _options$apparence2, _options$apparence3, _options$apparence4;
|
|
34
34
|
let args = {
|
|
35
35
|
appkey: (options === null || options === void 0 ? void 0 : options.appkey) === undefined ? '' : options === null || options === void 0 ? void 0 : options.appkey,
|
|
@@ -39,18 +39,24 @@ function startLiveness3d(options) {
|
|
|
39
39
|
backgroundColor: (options === null || options === void 0 ? void 0 : (_options$apparence = options.apparence) === null || _options$apparence === void 0 ? void 0 : _options$apparence.backgroundColor) === '' ? '#1E1E1E' : options === null || options === void 0 ? void 0 : (_options$apparence2 = options.apparence) === null || _options$apparence2 === void 0 ? void 0 : _options$apparence2.backgroundColor,
|
|
40
40
|
loadingColor: (options === null || options === void 0 ? void 0 : (_options$apparence3 = options.apparence) === null || _options$apparence3 === void 0 ? void 0 : _options$apparence3.loadingColor) === '' ? '#05D758' : options === null || options === void 0 ? void 0 : (_options$apparence4 = options.apparence) === null || _options$apparence4 === void 0 ? void 0 : _options$apparence4.loadingColor
|
|
41
41
|
},
|
|
42
|
-
liveness3Dtext: options.liveness3Dtext || []
|
|
42
|
+
liveness3Dtext: options.liveness3Dtext || [],
|
|
43
|
+
loading: loading
|
|
43
44
|
};
|
|
44
45
|
if (_reactNative.Platform.OS === 'android') {
|
|
45
|
-
return RnLiveness3d.startliveness3d(args.appkey);
|
|
46
|
+
return RnLiveness3d.startliveness3d(args.appkey, loading === null || loading === void 0 ? void 0 : loading.type, (loading === null || loading === void 0 ? void 0 : loading.size) * 200, loading === null || loading === void 0 ? void 0 : loading.backgroundColor, loading === null || loading === void 0 ? void 0 : loading.loadingColor);
|
|
46
47
|
}
|
|
47
48
|
return RnLiveness3d.startliveness3d(args);
|
|
48
49
|
}
|
|
49
50
|
function logEvent3D(name, appkey) {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
51
|
+
if (_reactNative.Platform.OS === 'ios') {
|
|
52
|
+
return RnLiveness3d.logevent({
|
|
53
|
+
event: name,
|
|
54
|
+
appkey: appkey
|
|
55
|
+
});
|
|
56
|
+
} else {
|
|
57
|
+
console.log(name, appkey);
|
|
58
|
+
return RnLiveness3d.logevent(name, appkey);
|
|
59
|
+
}
|
|
54
60
|
}
|
|
55
61
|
function checkIosPermission() {
|
|
56
62
|
return RnLiveness3d.checkiospermission({
|
|
@@ -63,7 +69,7 @@ function checkIosPermissionGranted() {
|
|
|
63
69
|
});
|
|
64
70
|
}
|
|
65
71
|
const PERMISSIONS_REQUEST = _reactNative.PermissionsAndroid.PERMISSIONS.CAMERA;
|
|
66
|
-
const requestCameraPermission = async options => {
|
|
72
|
+
const requestCameraPermission = async (options, loading) => {
|
|
67
73
|
if (_reactNative.Platform.OS === 'ios') {
|
|
68
74
|
checkIosPermission().then(result => {
|
|
69
75
|
if (result === 'true') {
|
|
@@ -76,14 +82,14 @@ const requestCameraPermission = async options => {
|
|
|
76
82
|
}
|
|
77
83
|
try {
|
|
78
84
|
const granted = await _reactNative.PermissionsAndroid.request(PERMISSIONS_REQUEST, {
|
|
79
|
-
title: '
|
|
80
|
-
message: 'Precisamos acessar sua
|
|
85
|
+
title: '',
|
|
86
|
+
message: 'Precisamos acessar sua câmera',
|
|
81
87
|
buttonNeutral: 'Ver Depois',
|
|
82
88
|
buttonNegative: 'Cancelar',
|
|
83
89
|
buttonPositive: 'OK'
|
|
84
90
|
});
|
|
85
91
|
if (granted === _reactNative.PermissionsAndroid.RESULTS.GRANTED) {
|
|
86
|
-
startLiveness3d(options).then(result => console.log(result));
|
|
92
|
+
startLiveness3d(options, loading).then(result => console.log(result));
|
|
87
93
|
} else {
|
|
88
94
|
console.log('Camera permission denied');
|
|
89
95
|
}
|
|
@@ -112,19 +118,22 @@ function Liveness3dView(_ref) {
|
|
|
112
118
|
let {
|
|
113
119
|
CustomInstructionView,
|
|
114
120
|
CustomPermissionView,
|
|
115
|
-
options
|
|
121
|
+
options,
|
|
122
|
+
loading
|
|
116
123
|
} = _ref;
|
|
117
124
|
return /*#__PURE__*/_react.default.createElement(GetIntructionView, {
|
|
118
125
|
CustomInstructionView: CustomInstructionView,
|
|
119
126
|
CustomPermissionView: CustomPermissionView,
|
|
120
|
-
options: options
|
|
127
|
+
options: options,
|
|
128
|
+
loading: loading
|
|
121
129
|
});
|
|
122
130
|
}
|
|
123
131
|
function GetIntructionView(_ref2) {
|
|
124
132
|
let {
|
|
125
133
|
CustomInstructionView,
|
|
126
134
|
CustomPermissionView,
|
|
127
|
-
options
|
|
135
|
+
options,
|
|
136
|
+
loading
|
|
128
137
|
} = _ref2;
|
|
129
138
|
const [screen, setScreen] = (0, _react.useState)(1);
|
|
130
139
|
function onBack() {
|
|
@@ -141,7 +150,7 @@ function GetIntructionView(_ref2) {
|
|
|
141
150
|
if (screen === 1) {
|
|
142
151
|
logEvent3D('ACTION_L3FT_instructionContinue', options.appkey);
|
|
143
152
|
if ((await checkPermission()) === true) {
|
|
144
|
-
startLiveness3d(options).then(result => console.log(result));
|
|
153
|
+
startLiveness3d(options, loading).then(result => console.log(result));
|
|
145
154
|
} else {
|
|
146
155
|
setScreen(2);
|
|
147
156
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_InstructionsView","_interopRequireDefault","_PermissionView","obj","__esModule","default","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","LINKING_ERROR","Platform","select","ios","SCREEN","freeze","INSTRUCTION_VIEW","PERMISSION_VIEW","RnLiveness3d","NativeModules","Proxy","Error","startLiveness3d","options","_options$apparence","_options$apparence2","_options$apparence3","_options$apparence4","args","appkey","undefined","environment","baseUrl","apparence","backgroundColor","loadingColor","liveness3Dtext","OS","startliveness3d","logEvent3D","name","logevent","event","checkIosPermission","checkiospermission","p","checkIosPermissionGranted","checkpermissiongranted","PERMISSIONS_REQUEST","PermissionsAndroid","PERMISSIONS","CAMERA","requestCameraPermission","then","result","granted","request","title","message","buttonNeutral","buttonNegative","buttonPositive","RESULTS","GRANTED","
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_InstructionsView","_interopRequireDefault","_PermissionView","obj","__esModule","default","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","LINKING_ERROR","Platform","select","ios","SCREEN","freeze","INSTRUCTION_VIEW","PERMISSION_VIEW","RnLiveness3d","NativeModules","Proxy","Error","startLiveness3d","options","loading","_options$apparence","_options$apparence2","_options$apparence3","_options$apparence4","args","appkey","undefined","environment","baseUrl","apparence","backgroundColor","loadingColor","liveness3Dtext","OS","startliveness3d","type","size","logEvent3D","name","logevent","event","console","log","checkIosPermission","checkiospermission","p","checkIosPermissionGranted","checkpermissiongranted","PERMISSIONS_REQUEST","PermissionsAndroid","PERMISSIONS","CAMERA","requestCameraPermission","then","result","granted","request","title","message","buttonNeutral","buttonNegative","buttonPositive","RESULTS","GRANTED","err","warn","checkPermission","grantediso","check","Liveness3dView","_ref","CustomInstructionView","CustomPermissionView","createElement","GetIntructionView","_ref2","screen","setScreen","useState","onBack","verifyPermission","useEffect","Fragment","onVerify"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAEA,IAAAE,iBAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,eAAA,GAAAD,sBAAA,CAAAH,OAAA;AAAsD,SAAAG,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAV,wBAAAM,GAAA,EAAAI,WAAA,SAAAA,WAAA,IAAAJ,GAAA,IAAAA,GAAA,CAAAC,UAAA,WAAAD,GAAA,QAAAA,GAAA,oBAAAA,GAAA,wBAAAA,GAAA,4BAAAE,OAAA,EAAAF,G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B,uBAAuB,CAAClC,OAAO,CAAC;MACtC2D,SAAS,CAAC,CAAC,CAAC;IACd;EACF;EACA,IAAAI,gBAAS,EAAC,MAAM;IACd,IAAIL,MAAM,KAAK,CAAC,EAAE;MAChBvC,UAAU,CAAC,4BAA4B,EAAEnB,OAAO,CAACO,MAAM,CAAC;IAC1D;IACA,IAAImD,MAAM,KAAK,CAAC,EAAE;MAChBvC,UAAU,CAAC,2BAA2B,EAAEnB,OAAO,CAACO,MAAM,CAAC;IACzD;EACF,CAAC,CAAC;EAEF,oBACEjD,MAAA,CAAAS,OAAA,CAAAwF,aAAA,CAAAjG,MAAA,CAAAS,OAAA,CAAAiG,QAAA,QACGN,MAAM,KAAK,CAAC,KACV,CAACL,qBAAqB,gBACrB/F,MAAA,CAAAS,OAAA,CAAAwF,aAAA,CAAC7F,iBAAA,CAAAK,OAAgB;IAACkG,QAAQ,EAAEH,gBAAiB;IAACD,MAAM,EAAEA;EAAO,EAAG,GAEhER,qBACD,CAAC,EAEHK,MAAM,KAAK,CAAC,KACV,CAACJ,oBAAoB,gBACpBhG,MAAA,CAAAS,OAAA,CAAAwF,aAAA,CAAC3F,eAAA,CAAAG,OAAc;IAACkG,QAAQ,EAAEH,gBAAiB;IAACD,MAAM,EAAEA;EAAO,EAAG,GAE9DP,oBACD,CAAC,CACH;AAEP"}
|
package/lib/module/index.js
CHANGED
|
@@ -15,7 +15,7 @@ const RnLiveness3d = NativeModules.RnLiveness3d ? NativeModules.RnLiveness3d : n
|
|
|
15
15
|
throw new Error(LINKING_ERROR);
|
|
16
16
|
}
|
|
17
17
|
});
|
|
18
|
-
export function startLiveness3d(options) {
|
|
18
|
+
export function startLiveness3d(options, loading) {
|
|
19
19
|
var _options$apparence, _options$apparence2, _options$apparence3, _options$apparence4;
|
|
20
20
|
let args = {
|
|
21
21
|
appkey: (options === null || options === void 0 ? void 0 : options.appkey) === undefined ? '' : options === null || options === void 0 ? void 0 : options.appkey,
|
|
@@ -25,18 +25,24 @@ export function startLiveness3d(options) {
|
|
|
25
25
|
backgroundColor: (options === null || options === void 0 ? void 0 : (_options$apparence = options.apparence) === null || _options$apparence === void 0 ? void 0 : _options$apparence.backgroundColor) === '' ? '#1E1E1E' : options === null || options === void 0 ? void 0 : (_options$apparence2 = options.apparence) === null || _options$apparence2 === void 0 ? void 0 : _options$apparence2.backgroundColor,
|
|
26
26
|
loadingColor: (options === null || options === void 0 ? void 0 : (_options$apparence3 = options.apparence) === null || _options$apparence3 === void 0 ? void 0 : _options$apparence3.loadingColor) === '' ? '#05D758' : options === null || options === void 0 ? void 0 : (_options$apparence4 = options.apparence) === null || _options$apparence4 === void 0 ? void 0 : _options$apparence4.loadingColor
|
|
27
27
|
},
|
|
28
|
-
liveness3Dtext: options.liveness3Dtext || []
|
|
28
|
+
liveness3Dtext: options.liveness3Dtext || [],
|
|
29
|
+
loading: loading
|
|
29
30
|
};
|
|
30
31
|
if (Platform.OS === 'android') {
|
|
31
|
-
return RnLiveness3d.startliveness3d(args.appkey);
|
|
32
|
+
return RnLiveness3d.startliveness3d(args.appkey, loading === null || loading === void 0 ? void 0 : loading.type, (loading === null || loading === void 0 ? void 0 : loading.size) * 200, loading === null || loading === void 0 ? void 0 : loading.backgroundColor, loading === null || loading === void 0 ? void 0 : loading.loadingColor);
|
|
32
33
|
}
|
|
33
34
|
return RnLiveness3d.startliveness3d(args);
|
|
34
35
|
}
|
|
35
36
|
export function logEvent3D(name, appkey) {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
if (Platform.OS === 'ios') {
|
|
38
|
+
return RnLiveness3d.logevent({
|
|
39
|
+
event: name,
|
|
40
|
+
appkey: appkey
|
|
41
|
+
});
|
|
42
|
+
} else {
|
|
43
|
+
console.log(name, appkey);
|
|
44
|
+
return RnLiveness3d.logevent(name, appkey);
|
|
45
|
+
}
|
|
40
46
|
}
|
|
41
47
|
export function checkIosPermission() {
|
|
42
48
|
return RnLiveness3d.checkiospermission({
|
|
@@ -49,7 +55,7 @@ export function checkIosPermissionGranted() {
|
|
|
49
55
|
});
|
|
50
56
|
}
|
|
51
57
|
const PERMISSIONS_REQUEST = PermissionsAndroid.PERMISSIONS.CAMERA;
|
|
52
|
-
const requestCameraPermission = async options => {
|
|
58
|
+
const requestCameraPermission = async (options, loading) => {
|
|
53
59
|
if (Platform.OS === 'ios') {
|
|
54
60
|
checkIosPermission().then(result => {
|
|
55
61
|
if (result === 'true') {
|
|
@@ -62,14 +68,14 @@ const requestCameraPermission = async options => {
|
|
|
62
68
|
}
|
|
63
69
|
try {
|
|
64
70
|
const granted = await PermissionsAndroid.request(PERMISSIONS_REQUEST, {
|
|
65
|
-
title: '
|
|
66
|
-
message: 'Precisamos acessar sua
|
|
71
|
+
title: '',
|
|
72
|
+
message: 'Precisamos acessar sua câmera',
|
|
67
73
|
buttonNeutral: 'Ver Depois',
|
|
68
74
|
buttonNegative: 'Cancelar',
|
|
69
75
|
buttonPositive: 'OK'
|
|
70
76
|
});
|
|
71
77
|
if (granted === PermissionsAndroid.RESULTS.GRANTED) {
|
|
72
|
-
startLiveness3d(options).then(result => console.log(result));
|
|
78
|
+
startLiveness3d(options, loading).then(result => console.log(result));
|
|
73
79
|
} else {
|
|
74
80
|
console.log('Camera permission denied');
|
|
75
81
|
}
|
|
@@ -98,19 +104,22 @@ export function Liveness3dView(_ref) {
|
|
|
98
104
|
let {
|
|
99
105
|
CustomInstructionView,
|
|
100
106
|
CustomPermissionView,
|
|
101
|
-
options
|
|
107
|
+
options,
|
|
108
|
+
loading
|
|
102
109
|
} = _ref;
|
|
103
110
|
return /*#__PURE__*/React.createElement(GetIntructionView, {
|
|
104
111
|
CustomInstructionView: CustomInstructionView,
|
|
105
112
|
CustomPermissionView: CustomPermissionView,
|
|
106
|
-
options: options
|
|
113
|
+
options: options,
|
|
114
|
+
loading: loading
|
|
107
115
|
});
|
|
108
116
|
}
|
|
109
117
|
export function GetIntructionView(_ref2) {
|
|
110
118
|
let {
|
|
111
119
|
CustomInstructionView,
|
|
112
120
|
CustomPermissionView,
|
|
113
|
-
options
|
|
121
|
+
options,
|
|
122
|
+
loading
|
|
114
123
|
} = _ref2;
|
|
115
124
|
const [screen, setScreen] = useState(1);
|
|
116
125
|
function onBack() {
|
|
@@ -127,7 +136,7 @@ export function GetIntructionView(_ref2) {
|
|
|
127
136
|
if (screen === 1) {
|
|
128
137
|
logEvent3D('ACTION_L3FT_instructionContinue', options.appkey);
|
|
129
138
|
if ((await checkPermission()) === true) {
|
|
130
|
-
startLiveness3d(options).then(result => console.log(result));
|
|
139
|
+
startLiveness3d(options, loading).then(result => console.log(result));
|
|
131
140
|
} else {
|
|
132
141
|
setScreen(2);
|
|
133
142
|
}
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useEffect","useState","NativeModules","Platform","PermissionsAndroid","InstructionsView","PermissionView","LINKING_ERROR","select","ios","default","SCREEN","Object","freeze","INSTRUCTION_VIEW","PERMISSION_VIEW","RnLiveness3d","Proxy","get","Error","startLiveness3d","options","_options$apparence","_options$apparence2","_options$apparence3","_options$apparence4","args","appkey","undefined","environment","baseUrl","apparence","backgroundColor","loadingColor","liveness3Dtext","OS","startliveness3d","logEvent3D","name","logevent","event","checkIosPermission","checkiospermission","p","checkIosPermissionGranted","checkpermissiongranted","PERMISSIONS_REQUEST","PERMISSIONS","CAMERA","requestCameraPermission","then","result","granted","request","title","message","buttonNeutral","buttonNegative","buttonPositive","RESULTS","GRANTED","
|
|
1
|
+
{"version":3,"names":["React","useEffect","useState","NativeModules","Platform","PermissionsAndroid","InstructionsView","PermissionView","LINKING_ERROR","select","ios","default","SCREEN","Object","freeze","INSTRUCTION_VIEW","PERMISSION_VIEW","RnLiveness3d","Proxy","get","Error","startLiveness3d","options","loading","_options$apparence","_options$apparence2","_options$apparence3","_options$apparence4","args","appkey","undefined","environment","baseUrl","apparence","backgroundColor","loadingColor","liveness3Dtext","OS","startliveness3d","type","size","logEvent3D","name","logevent","event","console","log","checkIosPermission","checkiospermission","p","checkIosPermissionGranted","checkpermissiongranted","PERMISSIONS_REQUEST","PERMISSIONS","CAMERA","requestCameraPermission","then","result","granted","request","title","message","buttonNeutral","buttonNegative","buttonPositive","RESULTS","GRANTED","err","warn","checkPermission","grantediso","check","Liveness3dView","_ref","CustomInstructionView","CustomPermissionView","createElement","GetIntructionView","_ref2","screen","setScreen","onBack","verifyPermission","Fragment","onVerify"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":"AAAA,OAAOA,KAAK,IAAQC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AACtD,SAASC,aAAa,EAAEC,QAAQ,EAAEC,kBAAkB,QAAQ,cAAc;AAE1E,OAAOC,gBAAgB,MAAM,uCAAuC;AACpE,OAAOC,cAAc,MAAM,0BAA0B;AAErD,MAAMC,aAAa,GAChB,8EAA6E,GAC9EJ,QAAQ,CAACK,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B;AAEjC,MAAMC,MAAM,GAAGC,MAAM,CAACC,MAAM,CAAC;EAC3BC,gBAAgB,EAAE,CAAC;EACnBC,eAAe,EAAE;AACnB,CAAC,CAAU;AAEX,MAAMC,YAAY,GAAGd,aAAa,CAACc,YAAY,GAC3Cd,aAAa,CAACc,YAAY,GAC1B,IAAIC,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACZ,aAAa,CAAC;EAChC;AACF,CAAC,CACF;AAEL,OAAO,SAASa,eAAeA,CAC7BC,OAAiB,EACjBC,OAAa,EACC;EAAA,IAAAC,kBAAA,EAAAC,mBAAA,EAAAC,mBAAA,EAAAC,mBAAA;EACd,IAAIC,IAAc,GAAG;IACnBC,MAAM,EAAE,CAAAP,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEO,MAAM,MAAKC,SAAS,GAA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IkD,MAAM,KAAK,CAAC,EAAE;MAChBtC,UAAU,CAAC,2BAA2B,EAAEnB,OAAO,CAACO,MAAM,CAAC;IACzD;EACF,CAAC,CAAC;EAEF,oBACE7B,KAAA,CAAA4E,aAAA,CAAA5E,KAAA,CAAAmF,QAAA,QACGJ,MAAM,KAAK,CAAC,KACV,CAACL,qBAAqB,gBACrB1E,KAAA,CAAA4E,aAAA,CAACtE,gBAAgB;IAAC8E,QAAQ,EAAEF,gBAAiB;IAACD,MAAM,EAAEA;EAAO,EAAG,GAEhEP,qBACD,CAAC,EAEHK,MAAM,KAAK,CAAC,KACV,CAACJ,oBAAoB,gBACpB3E,KAAA,CAAA4E,aAAA,CAACrE,cAAc;IAAC6E,QAAQ,EAAEF,gBAAiB;IAACD,MAAM,EAAEA;EAAO,EAAG,GAE9DN,oBACD,CAAC,CACH;AAEP"}
|
|
@@ -4,9 +4,16 @@ export type ArgsType = {
|
|
|
4
4
|
baseUrl: string;
|
|
5
5
|
apparence: ApparenceType;
|
|
6
6
|
liveness3Dtext: object;
|
|
7
|
+
loading: LoadingType;
|
|
7
8
|
};
|
|
8
9
|
export type ApparenceType = {
|
|
9
10
|
backgroundColor: string | undefined;
|
|
10
11
|
loadingColor: string | undefined;
|
|
11
12
|
};
|
|
13
|
+
export type LoadingType = {
|
|
14
|
+
type: 'default' | 'spinner';
|
|
15
|
+
size: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10;
|
|
16
|
+
backgroundColor: string | undefined;
|
|
17
|
+
loadingColor: string | undefined;
|
|
18
|
+
};
|
|
12
19
|
//# sourceMappingURL=ArgsType.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ArgsType.d.ts","sourceRoot":"","sources":["../../../src/@types/ArgsType.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,QAAQ,GAAG;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,GAAG,MAAM,CAAC;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,aAAa,CAAC;IACzB,cAAc,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"ArgsType.d.ts","sourceRoot":"","sources":["../../../src/@types/ArgsType.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,QAAQ,GAAG;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,GAAG,MAAM,CAAC;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,aAAa,CAAC;IACzB,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,WAAW,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,eAAe,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC,YAAY,EAAE,MAAM,GAAG,SAAS,CAAC;CAClC,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,SAAS,GAAG,SAAS,CAAC;IAC5B,IAAI,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC;IACjD,eAAe,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC,YAAY,EAAE,MAAM,GAAG,SAAS,CAAC;CAClC,CAAC"}
|
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
|
-
import type { ArgsType } from './@types/ArgsType';
|
|
3
|
-
export declare function startLiveness3d(options: ArgsType): Promise<any>;
|
|
2
|
+
import type { ArgsType, LoadingType } from './@types/ArgsType';
|
|
3
|
+
export declare function startLiveness3d(options: ArgsType, loading?: any): Promise<any>;
|
|
4
4
|
export declare function logEvent3D(name: string, appkey: string): Promise<any>;
|
|
5
5
|
export declare function checkIosPermission(): Promise<any>;
|
|
6
6
|
export declare function checkIosPermissionGranted(): Promise<any>;
|
|
7
|
-
export declare function Liveness3dView({ CustomInstructionView, CustomPermissionView, options, }: {
|
|
7
|
+
export declare function Liveness3dView({ CustomInstructionView, CustomPermissionView, options, loading, }: {
|
|
8
8
|
CustomInstructionView: FC;
|
|
9
9
|
CustomPermissionView: FC;
|
|
10
10
|
options: ArgsType;
|
|
11
|
+
loading: LoadingType;
|
|
11
12
|
}): JSX.Element;
|
|
12
|
-
export declare function GetIntructionView({ CustomInstructionView, CustomPermissionView, options, }: {
|
|
13
|
+
export declare function GetIntructionView({ CustomInstructionView, CustomPermissionView, options, loading, }: {
|
|
13
14
|
CustomInstructionView: FC;
|
|
14
15
|
CustomPermissionView: FC;
|
|
15
16
|
options: ArgsType;
|
|
17
|
+
loading: LoadingType;
|
|
16
18
|
}): JSX.Element;
|
|
17
19
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,EAAE,EAAuB,MAAM,OAAO,CAAC;AAEvD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,EAAE,EAAuB,MAAM,OAAO,CAAC;AAEvD,OAAO,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AA0B/D,wBAAgB,eAAe,CAC7B,OAAO,EAAE,QAAQ,EACjB,OAAO,CAAC,EAAE,GAAG,GACZ,OAAO,CAAC,GAAG,CAAC,CA+Bd;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,CAOrE;AAED,wBAAgB,kBAAkB,IAAI,OAAO,CAAC,GAAG,CAAC,CAEjD;AACD,wBAAgB,yBAAyB,IAAI,OAAO,CAAC,GAAG,CAAC,CAExD;AAuDD,wBAAgB,cAAc,CAAC,EAC7B,qBAAqB,EACrB,oBAAoB,EACpB,OAAO,EACP,OAAO,GACR,EAAE;IACD,qBAAqB,EAAE,EAAE,CAAC;IAC1B,oBAAoB,EAAE,EAAE,CAAC;IACzB,OAAO,EAAE,QAAQ,CAAC;IAClB,OAAO,EAAE,WAAW,CAAC;CACtB,eASA;AAED,wBAAgB,iBAAiB,CAAC,EAChC,qBAAqB,EACrB,oBAAoB,EACpB,OAAO,EACP,OAAO,GACR,EAAE;IACD,qBAAqB,EAAE,EAAE,CAAC;IAC1B,oBAAoB,EAAE,EAAE,CAAC;IACzB,OAAO,EAAE,QAAQ,CAAC;IAClB,OAAO,EAAE,WAAW,CAAC;CACtB,eAsDA"}
|
|
@@ -17,8 +17,8 @@ Pod::Spec.new do |s|
|
|
|
17
17
|
s.source_files = "ios/**/*.{h,m,mm,swift}"
|
|
18
18
|
|
|
19
19
|
s.dependency "React-Core"
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
|
|
21
|
+
s.ios.dependency 'OILiveness3D', '1.0.1'
|
|
22
22
|
|
|
23
23
|
# Don't install the dependencies when we run `pod install` in the old architecture.
|
|
24
24
|
if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
|
package/package.json
CHANGED
package/src/@types/ArgsType.ts
CHANGED
|
@@ -4,9 +4,17 @@ export type ArgsType = {
|
|
|
4
4
|
baseUrl: string;
|
|
5
5
|
apparence: ApparenceType;
|
|
6
6
|
liveness3Dtext: object;
|
|
7
|
+
loading: LoadingType;
|
|
7
8
|
};
|
|
8
9
|
|
|
9
10
|
export type ApparenceType = {
|
|
10
11
|
backgroundColor: string | undefined;
|
|
11
12
|
loadingColor: string | undefined;
|
|
12
13
|
};
|
|
14
|
+
|
|
15
|
+
export type LoadingType = {
|
|
16
|
+
type: 'default' | 'spinner';
|
|
17
|
+
size: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10;
|
|
18
|
+
backgroundColor: string | undefined;
|
|
19
|
+
loadingColor: string | undefined;
|
|
20
|
+
};
|
package/src/index.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { FC, useEffect, useState } from 'react';
|
|
2
2
|
import { NativeModules, Platform, PermissionsAndroid } from 'react-native';
|
|
3
|
-
import type { ArgsType } from './@types/ArgsType';
|
|
3
|
+
import type { ArgsType, LoadingType } from './@types/ArgsType';
|
|
4
4
|
import InstructionsView from './screens/Liveness3D/InstructionsView';
|
|
5
5
|
import PermissionView from './screens/PermissionView';
|
|
6
6
|
|
|
@@ -26,7 +26,10 @@ const RnLiveness3d = NativeModules.RnLiveness3d
|
|
|
26
26
|
}
|
|
27
27
|
);
|
|
28
28
|
|
|
29
|
-
export function startLiveness3d(
|
|
29
|
+
export function startLiveness3d(
|
|
30
|
+
options: ArgsType,
|
|
31
|
+
loading?: any
|
|
32
|
+
): Promise<any> {
|
|
30
33
|
let args: ArgsType = {
|
|
31
34
|
appkey: options?.appkey === undefined ? '' : options?.appkey,
|
|
32
35
|
environment:
|
|
@@ -43,17 +46,29 @@ export function startLiveness3d(options: ArgsType): Promise<any> {
|
|
|
43
46
|
: options?.apparence?.loadingColor,
|
|
44
47
|
},
|
|
45
48
|
liveness3Dtext: options.liveness3Dtext || [],
|
|
49
|
+
loading: loading,
|
|
46
50
|
};
|
|
47
51
|
|
|
48
52
|
if (Platform.OS === 'android') {
|
|
49
|
-
return RnLiveness3d.startliveness3d(
|
|
53
|
+
return RnLiveness3d.startliveness3d(
|
|
54
|
+
args.appkey,
|
|
55
|
+
loading?.type,
|
|
56
|
+
loading?.size * 200,
|
|
57
|
+
loading?.backgroundColor,
|
|
58
|
+
loading?.loadingColor
|
|
59
|
+
);
|
|
50
60
|
}
|
|
51
61
|
|
|
52
62
|
return RnLiveness3d.startliveness3d(args);
|
|
53
63
|
}
|
|
54
64
|
|
|
55
65
|
export function logEvent3D(name: string, appkey: string): Promise<any> {
|
|
56
|
-
|
|
66
|
+
if (Platform.OS === 'ios') {
|
|
67
|
+
return RnLiveness3d.logevent({ event: name, appkey: appkey });
|
|
68
|
+
} else {
|
|
69
|
+
console.log(name, appkey);
|
|
70
|
+
return RnLiveness3d.logevent(name, appkey);
|
|
71
|
+
}
|
|
57
72
|
}
|
|
58
73
|
|
|
59
74
|
export function checkIosPermission(): Promise<any> {
|
|
@@ -65,7 +80,10 @@ export function checkIosPermissionGranted(): Promise<any> {
|
|
|
65
80
|
|
|
66
81
|
const PERMISSIONS_REQUEST: any = PermissionsAndroid.PERMISSIONS.CAMERA;
|
|
67
82
|
|
|
68
|
-
const requestCameraPermission = async (
|
|
83
|
+
const requestCameraPermission = async (
|
|
84
|
+
options: ArgsType,
|
|
85
|
+
loading?: LoadingType
|
|
86
|
+
) => {
|
|
69
87
|
if (Platform.OS === 'ios') {
|
|
70
88
|
checkIosPermission().then((result) => {
|
|
71
89
|
if (result === 'true') {
|
|
@@ -78,15 +96,15 @@ const requestCameraPermission = async (options: ArgsType) => {
|
|
|
78
96
|
}
|
|
79
97
|
try {
|
|
80
98
|
const granted = await PermissionsAndroid.request(PERMISSIONS_REQUEST, {
|
|
81
|
-
title: '
|
|
82
|
-
message: 'Precisamos acessar sua
|
|
99
|
+
title: '',
|
|
100
|
+
message: 'Precisamos acessar sua câmera',
|
|
83
101
|
buttonNeutral: 'Ver Depois',
|
|
84
102
|
buttonNegative: 'Cancelar',
|
|
85
103
|
buttonPositive: 'OK',
|
|
86
104
|
});
|
|
87
105
|
|
|
88
106
|
if (granted === PermissionsAndroid.RESULTS.GRANTED) {
|
|
89
|
-
startLiveness3d(options).then((result) => console.log(result));
|
|
107
|
+
startLiveness3d(options, loading).then((result) => console.log(result));
|
|
90
108
|
} else {
|
|
91
109
|
console.log('Camera permission denied');
|
|
92
110
|
}
|
|
@@ -117,16 +135,19 @@ export function Liveness3dView({
|
|
|
117
135
|
CustomInstructionView,
|
|
118
136
|
CustomPermissionView,
|
|
119
137
|
options,
|
|
138
|
+
loading,
|
|
120
139
|
}: {
|
|
121
140
|
CustomInstructionView: FC;
|
|
122
141
|
CustomPermissionView: FC;
|
|
123
142
|
options: ArgsType;
|
|
143
|
+
loading: LoadingType;
|
|
124
144
|
}) {
|
|
125
145
|
return (
|
|
126
146
|
<GetIntructionView
|
|
127
147
|
CustomInstructionView={CustomInstructionView}
|
|
128
148
|
CustomPermissionView={CustomPermissionView}
|
|
129
149
|
options={options}
|
|
150
|
+
loading={loading}
|
|
130
151
|
/>
|
|
131
152
|
);
|
|
132
153
|
}
|
|
@@ -135,10 +156,12 @@ export function GetIntructionView({
|
|
|
135
156
|
CustomInstructionView,
|
|
136
157
|
CustomPermissionView,
|
|
137
158
|
options,
|
|
159
|
+
loading,
|
|
138
160
|
}: {
|
|
139
161
|
CustomInstructionView: FC;
|
|
140
162
|
CustomPermissionView: FC;
|
|
141
163
|
options: ArgsType;
|
|
164
|
+
loading: LoadingType;
|
|
142
165
|
}) {
|
|
143
166
|
const [screen, setScreen] = useState(1);
|
|
144
167
|
|
|
@@ -156,7 +179,7 @@ export function GetIntructionView({
|
|
|
156
179
|
if (screen === 1) {
|
|
157
180
|
logEvent3D('ACTION_L3FT_instructionContinue', options.appkey);
|
|
158
181
|
if ((await checkPermission()) === true) {
|
|
159
|
-
startLiveness3d(options).then((result) => console.log(result));
|
|
182
|
+
startLiveness3d(options, loading).then((result) => console.log(result));
|
|
160
183
|
} else {
|
|
161
184
|
setScreen(2);
|
|
162
185
|
}
|