assentify-sdk-react-native 0.0.6 → 0.0.8
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 +11 -0
- package/android/build.gradle +1 -1
- package/android/src/main/java/com/assentifysdk/AssentifySdkModule.kt +0 -4
- package/android/src/main/java/com/assentifysdk/FaceMatchActivity.kt +58 -9
- package/android/src/main/java/com/assentifysdk/ScanIDActivity.kt +23 -16
- package/android/src/main/java/com/assentifysdk/ScanOtherActivity.kt +23 -16
- package/android/src/main/java/com/assentifysdk/ScanPassportActivity.kt +23 -15
- package/assentify-sdk.podspec +1 -1
- package/ios/NativeAssentifySdk.swift +36 -39
- package/ios/View/FaceMatchController.swift +86 -37
- package/ios/View/IDCardController.swift +69 -60
- package/ios/View/OtherController.swift +65 -56
- package/ios/View/PassportController.swift +67 -58
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -93,6 +93,17 @@ yarn add assentify-sdk-react-native
|
|
|
93
93
|
|
|
94
94
|
## Versions
|
|
95
95
|
|
|
96
|
+
**0.0.8**
|
|
97
|
+
- Face match improvements
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
**0.0.7**
|
|
101
|
+
- Face events improvements
|
|
102
|
+
- Face zoom improvements
|
|
103
|
+
- Face brightness improvements
|
|
104
|
+
- Face liveness improvements
|
|
105
|
+
|
|
106
|
+
|
|
96
107
|
**0.0.6**
|
|
97
108
|
- Improvements
|
|
98
109
|
|
package/android/build.gradle
CHANGED
|
@@ -99,7 +99,7 @@ dependencies {
|
|
|
99
99
|
implementation "com.facebook.react:react-native:+"
|
|
100
100
|
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
101
101
|
|
|
102
|
-
implementation 'com.github.AssentifyLTD:Assentify.SDK.Android:0.0.
|
|
102
|
+
implementation 'com.github.AssentifyLTD:Assentify.SDK.Android:0.0.64'
|
|
103
103
|
|
|
104
104
|
/* Assentify Sdk Dependencies */
|
|
105
105
|
implementation 'com.google.code.gson:gson:2.8.9'
|
|
@@ -32,6 +32,8 @@ import com.facebook.react.modules.core.DeviceEventManagerModule
|
|
|
32
32
|
import com.facebook.react.bridge.Arguments
|
|
33
33
|
import com.facebook.react.bridge.ReactApplicationContext
|
|
34
34
|
import android.util.Log
|
|
35
|
+
import com.assentify.sdk.Core.Constants.BrightnessEvents
|
|
36
|
+
import com.assentify.sdk.Core.Constants.FaceEvents
|
|
35
37
|
|
|
36
38
|
class FaceMatchActivity: AppCompatActivity(),
|
|
37
39
|
FaceMatchCallback {
|
|
@@ -246,28 +248,75 @@ private lateinit var assentifySdk: AssentifySdk
|
|
|
246
248
|
}
|
|
247
249
|
|
|
248
250
|
override fun onEnvironmentalConditionsChange(
|
|
249
|
-
|
|
251
|
+
brightnessEvents: BrightnessEvents,
|
|
250
252
|
motion: MotionType,
|
|
253
|
+
faceEvents: FaceEvents,
|
|
254
|
+
zoomType: ZoomType
|
|
251
255
|
) {
|
|
252
256
|
runOnUiThread {
|
|
253
|
-
if
|
|
257
|
+
if(start == false){
|
|
254
258
|
infoLayout.visibility = View.VISIBLE
|
|
255
|
-
if (
|
|
259
|
+
if (zoomType != ZoomType.SENDING && zoomType != ZoomType.NO_DETECT) {
|
|
260
|
+
if (zoomType == ZoomType.ZOOM_IN) {
|
|
261
|
+
infoText.setText("Please Move Closer")
|
|
262
|
+
infoIcon.setImageDrawable(getResources().getDrawable(R.drawable.zoom_in))
|
|
263
|
+
}
|
|
264
|
+
if (zoomType == ZoomType.ZOOM_OUT) {
|
|
265
|
+
infoText.setText("Please Move Further")
|
|
266
|
+
infoIcon.setImageDrawable(getResources().getDrawable(R.drawable.zoom_out))
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
else if (motion != MotionType.SENDING && motion != MotionType.NO_DETECT) {
|
|
256
270
|
infoText.setText("Please Hold Your Hand")
|
|
257
271
|
infoIcon.setImageDrawable(getResources().getDrawable(R.drawable.info_icon))
|
|
258
|
-
|
|
259
|
-
|
|
272
|
+
|
|
273
|
+
} else if(brightnessEvents != BrightnessEvents.Good){
|
|
274
|
+
if(brightnessEvents == BrightnessEvents.TooDark){
|
|
275
|
+
infoText.setText("Please increase the lighting")
|
|
276
|
+
infoIcon.setImageDrawable(getResources().getDrawable(R.drawable.info_icon))
|
|
277
|
+
}
|
|
278
|
+
if(brightnessEvents == BrightnessEvents.TooBright){
|
|
279
|
+
infoText.setText("Please reduce the lighting")
|
|
280
|
+
infoIcon.setImageDrawable(getResources().getDrawable(R.drawable.info_icon))
|
|
281
|
+
}
|
|
282
|
+
} else if(faceEvents != FaceEvents.Good && faceEvents != FaceEvents.NO_DETECT) {
|
|
283
|
+
if(faceEvents == FaceEvents.RollLeft){
|
|
284
|
+
infoText.setText("Please tilt your head to the right")
|
|
285
|
+
infoIcon.setImageDrawable(getResources().getDrawable(R.drawable.info_icon))
|
|
286
|
+
}
|
|
287
|
+
if(faceEvents == FaceEvents.RollRight){
|
|
288
|
+
infoText.setText("Please tilt your head to the left")
|
|
289
|
+
infoIcon.setImageDrawable(getResources().getDrawable(R.drawable.info_icon))
|
|
290
|
+
}
|
|
291
|
+
if(faceEvents == FaceEvents.YawLeft){
|
|
292
|
+
infoText.setText("Please turn your head to the right")
|
|
293
|
+
infoIcon.setImageDrawable(getResources().getDrawable(R.drawable.info_icon))
|
|
294
|
+
}
|
|
295
|
+
if(faceEvents == FaceEvents.YawRight){
|
|
296
|
+
infoText.setText("Please turn your head to the left")
|
|
297
|
+
infoIcon.setImageDrawable(getResources().getDrawable(R.drawable.info_icon))
|
|
298
|
+
}
|
|
299
|
+
if(faceEvents == FaceEvents.PitchUp){
|
|
300
|
+
infoText.setText("Please lower your head")
|
|
301
|
+
infoIcon.setImageDrawable(getResources().getDrawable(R.drawable.info_icon))
|
|
302
|
+
}
|
|
303
|
+
if(faceEvents == FaceEvents.PitchDown){
|
|
304
|
+
infoText.setText("Please raise your head")
|
|
305
|
+
infoIcon.setImageDrawable(getResources().getDrawable(R.drawable.info_icon))
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
else {
|
|
309
|
+
if (motion == MotionType.SENDING && zoomType == ZoomType.SENDING && brightnessEvents == BrightnessEvents.Good && faceEvents == FaceEvents.Good){
|
|
260
310
|
infoText.setText("Hold Steady")
|
|
261
311
|
infoIcon.setImageDrawable(getResources().getDrawable(R.drawable.info_icon))
|
|
262
312
|
}
|
|
263
|
-
if (motion == MotionType.NO_DETECT)
|
|
313
|
+
if (motion == MotionType.NO_DETECT && zoomType == ZoomType.NO_DETECT && faceEvents == FaceEvents.NO_DETECT){
|
|
264
314
|
infoText.setText("Please face within circle")
|
|
265
315
|
infoIcon.setImageDrawable(getResources().getDrawable(R.drawable.info_icon))
|
|
266
316
|
}
|
|
267
|
-
|
|
268
317
|
}
|
|
269
|
-
}
|
|
270
|
-
infoLayout.visibility = View.GONE
|
|
318
|
+
}else {
|
|
319
|
+
infoLayout.visibility = View.GONE
|
|
271
320
|
}
|
|
272
321
|
}
|
|
273
322
|
}
|
|
@@ -29,6 +29,7 @@ import pl.droidsonroids.gif.GifImageView
|
|
|
29
29
|
import com.assentify.sdk.RemoteClient.Models.StepDefinitions
|
|
30
30
|
import ImageToBase64Converter
|
|
31
31
|
import android.content.Intent
|
|
32
|
+
import com.assentify.sdk.Core.Constants.BrightnessEvents
|
|
32
33
|
import com.assentify.sdk.RemoteClient.Models.SubmitRequestModel
|
|
33
34
|
import com.facebook.react.bridge.Arguments
|
|
34
35
|
import com.facebook.react.modules.core.DeviceEventManagerModule
|
|
@@ -356,46 +357,52 @@ class ScanIDActivity: AppCompatActivity(),
|
|
|
356
357
|
}
|
|
357
358
|
}
|
|
358
359
|
|
|
359
|
-
override fun onEnvironmentalConditionsChange(
|
|
360
|
-
brightness: Double,
|
|
361
|
-
motion: MotionType,
|
|
362
|
-
zoomType: ZoomType
|
|
363
|
-
) {
|
|
360
|
+
override fun onEnvironmentalConditionsChange(brightnessEvents: BrightnessEvents, motion: MotionType, zoom: ZoomType){
|
|
364
361
|
runOnUiThread {
|
|
365
|
-
if
|
|
362
|
+
if(start == false){
|
|
366
363
|
infoLayout.visibility = View.VISIBLE
|
|
367
|
-
if (
|
|
368
|
-
if (
|
|
364
|
+
if (zoom != ZoomType.SENDING && zoom != ZoomType.NO_DETECT) {
|
|
365
|
+
if (zoom == ZoomType.ZOOM_IN) {
|
|
369
366
|
infoText.setText("Move ID Closer")
|
|
370
367
|
infoIcon.setImageDrawable(getResources().getDrawable(R.drawable.zoom_in))
|
|
371
368
|
}
|
|
372
|
-
if (
|
|
369
|
+
if (zoom == ZoomType.ZOOM_OUT) {
|
|
373
370
|
infoText.setText("Move ID Further")
|
|
374
371
|
infoIcon.setImageDrawable(getResources().getDrawable(R.drawable.zoom_out))
|
|
375
372
|
}
|
|
376
|
-
}
|
|
373
|
+
}
|
|
374
|
+
else if (motion != MotionType.SENDING && motion != MotionType.NO_DETECT) {
|
|
377
375
|
infoText.setText("Please Hold Your Hand")
|
|
378
376
|
infoIcon.setImageDrawable(getResources().getDrawable(R.drawable.info_icon))
|
|
377
|
+
|
|
378
|
+
} else if(brightnessEvents != BrightnessEvents.Good){
|
|
379
|
+
if(brightnessEvents == BrightnessEvents.TooDark){
|
|
380
|
+
infoText.setText("Please increase the lighting")
|
|
381
|
+
infoIcon.setImageDrawable(getResources().getDrawable(R.drawable.info_icon))
|
|
382
|
+
}
|
|
383
|
+
if(brightnessEvents == BrightnessEvents.TooBright){
|
|
384
|
+
infoText.setText("Please reduce the lighting")
|
|
385
|
+
infoIcon.setImageDrawable(getResources().getDrawable(R.drawable.info_icon))
|
|
386
|
+
}
|
|
387
|
+
|
|
379
388
|
} else {
|
|
380
|
-
if (motion == MotionType.SENDING &&
|
|
389
|
+
if (motion == MotionType.SENDING && zoom == ZoomType.SENDING && brightnessEvents == BrightnessEvents.Good){
|
|
381
390
|
infoText.setText("Hold Steady")
|
|
382
391
|
infoIcon.setImageDrawable(getResources().getDrawable(R.drawable.info_icon))
|
|
383
392
|
}
|
|
384
|
-
if (motion == MotionType.NO_DETECT &&
|
|
393
|
+
if (motion == MotionType.NO_DETECT && zoom == ZoomType.NO_DETECT){
|
|
385
394
|
infoText.setText("Please present ID")
|
|
386
395
|
infoIcon.setImageDrawable(getResources().getDrawable(R.drawable.info_icon))
|
|
387
396
|
}
|
|
388
|
-
|
|
389
397
|
}
|
|
390
|
-
}
|
|
398
|
+
}else {
|
|
391
399
|
infoLayout.visibility = View.GONE
|
|
392
400
|
}
|
|
393
|
-
|
|
394
|
-
|
|
395
401
|
}
|
|
396
402
|
}
|
|
397
403
|
|
|
398
404
|
|
|
405
|
+
|
|
399
406
|
fun convertMap(map: Map<String, Any>?): Map<String, String> {
|
|
400
407
|
return map?.mapValues {
|
|
401
408
|
it.value.toString()
|
|
@@ -32,6 +32,7 @@ import android.graphics.Color
|
|
|
32
32
|
import android.graphics.PorterDuff
|
|
33
33
|
import android.widget.LinearLayout
|
|
34
34
|
import android.widget.RelativeLayout
|
|
35
|
+
import com.assentify.sdk.Core.Constants.BrightnessEvents
|
|
35
36
|
import java.text.SimpleDateFormat
|
|
36
37
|
|
|
37
38
|
|
|
@@ -255,46 +256,52 @@ class ScanOtherActivity: AppCompatActivity(),
|
|
|
255
256
|
|
|
256
257
|
}
|
|
257
258
|
|
|
258
|
-
override fun onEnvironmentalConditionsChange(
|
|
259
|
-
brightness: Double,
|
|
260
|
-
motion: MotionType,
|
|
261
|
-
zoomType: ZoomType
|
|
262
|
-
) {
|
|
259
|
+
override fun onEnvironmentalConditionsChange(brightnessEvents: BrightnessEvents, motion: MotionType, zoom: ZoomType){
|
|
263
260
|
runOnUiThread {
|
|
264
|
-
if
|
|
261
|
+
if(start == false){
|
|
265
262
|
infoLayout.visibility = View.VISIBLE
|
|
266
|
-
if (
|
|
267
|
-
if (
|
|
263
|
+
if (zoom != ZoomType.SENDING && zoom != ZoomType.NO_DETECT) {
|
|
264
|
+
if (zoom == ZoomType.ZOOM_IN) {
|
|
268
265
|
infoText.setText("Move ID Closer")
|
|
269
266
|
infoIcon.setImageDrawable(getResources().getDrawable(R.drawable.zoom_in))
|
|
270
267
|
}
|
|
271
|
-
if (
|
|
268
|
+
if (zoom == ZoomType.ZOOM_OUT) {
|
|
272
269
|
infoText.setText("Move ID Further")
|
|
273
270
|
infoIcon.setImageDrawable(getResources().getDrawable(R.drawable.zoom_out))
|
|
274
271
|
}
|
|
275
|
-
}
|
|
272
|
+
}
|
|
273
|
+
else if (motion != MotionType.SENDING && motion != MotionType.NO_DETECT) {
|
|
276
274
|
infoText.setText("Please Hold Your Hand")
|
|
277
275
|
infoIcon.setImageDrawable(getResources().getDrawable(R.drawable.info_icon))
|
|
276
|
+
|
|
277
|
+
} else if(brightnessEvents != BrightnessEvents.Good){
|
|
278
|
+
if(brightnessEvents == BrightnessEvents.TooDark){
|
|
279
|
+
infoText.setText("Please increase the lighting")
|
|
280
|
+
infoIcon.setImageDrawable(getResources().getDrawable(R.drawable.info_icon))
|
|
281
|
+
}
|
|
282
|
+
if(brightnessEvents == BrightnessEvents.TooBright){
|
|
283
|
+
infoText.setText("Please reduce the lighting")
|
|
284
|
+
infoIcon.setImageDrawable(getResources().getDrawable(R.drawable.info_icon))
|
|
285
|
+
}
|
|
286
|
+
|
|
278
287
|
} else {
|
|
279
|
-
if (motion == MotionType.SENDING &&
|
|
288
|
+
if (motion == MotionType.SENDING && zoom == ZoomType.SENDING && brightnessEvents == BrightnessEvents.Good){
|
|
280
289
|
infoText.setText("Hold Steady")
|
|
281
290
|
infoIcon.setImageDrawable(getResources().getDrawable(R.drawable.info_icon))
|
|
282
291
|
}
|
|
283
|
-
if (motion == MotionType.NO_DETECT &&
|
|
292
|
+
if (motion == MotionType.NO_DETECT && zoom == ZoomType.NO_DETECT){
|
|
284
293
|
infoText.setText("Please present ID")
|
|
285
294
|
infoIcon.setImageDrawable(getResources().getDrawable(R.drawable.info_icon))
|
|
286
295
|
}
|
|
287
|
-
|
|
288
296
|
}
|
|
289
|
-
}
|
|
297
|
+
}else {
|
|
290
298
|
infoLayout.visibility = View.GONE
|
|
291
299
|
}
|
|
292
|
-
|
|
293
|
-
|
|
294
300
|
}
|
|
295
301
|
}
|
|
296
302
|
|
|
297
303
|
|
|
304
|
+
|
|
298
305
|
fun convertMap(map: Map<String, Any>?): Map<String, String> {
|
|
299
306
|
return map?.mapValues {
|
|
300
307
|
it.value.toString()
|
|
@@ -34,6 +34,8 @@ import android.widget.LinearLayout
|
|
|
34
34
|
import android.widget.RelativeLayout
|
|
35
35
|
import java.text.SimpleDateFormat
|
|
36
36
|
import android.util.Log
|
|
37
|
+
import com.assentify.sdk.Core.Constants.BrightnessEvents
|
|
38
|
+
|
|
37
39
|
class ScanPassportActivity : AppCompatActivity(),
|
|
38
40
|
ScanPassportCallback {
|
|
39
41
|
private lateinit var assentifySdk: AssentifySdk
|
|
@@ -280,41 +282,47 @@ class ScanPassportActivity : AppCompatActivity(),
|
|
|
280
282
|
|
|
281
283
|
}
|
|
282
284
|
|
|
283
|
-
override fun onEnvironmentalConditionsChange(
|
|
284
|
-
brightness: Double,
|
|
285
|
-
motion: MotionType,
|
|
286
|
-
zoomType: ZoomType
|
|
287
|
-
) {
|
|
285
|
+
override fun onEnvironmentalConditionsChange(brightnessEvents: BrightnessEvents, motion: MotionType, zoom: ZoomType){
|
|
288
286
|
runOnUiThread {
|
|
289
|
-
if
|
|
287
|
+
if(start == false){
|
|
290
288
|
infoLayout.visibility = View.VISIBLE
|
|
291
|
-
if (
|
|
292
|
-
if (
|
|
289
|
+
if (zoom != ZoomType.SENDING && zoom != ZoomType.NO_DETECT) {
|
|
290
|
+
if (zoom == ZoomType.ZOOM_IN) {
|
|
293
291
|
infoText.setText("Move Passport Closer")
|
|
294
292
|
infoIcon.setImageDrawable(getResources().getDrawable(R.drawable.zoom_in))
|
|
295
293
|
}
|
|
296
|
-
if (
|
|
294
|
+
if (zoom == ZoomType.ZOOM_OUT) {
|
|
297
295
|
infoText.setText("Move Passport Further")
|
|
298
296
|
infoIcon.setImageDrawable(getResources().getDrawable(R.drawable.zoom_out))
|
|
299
297
|
}
|
|
300
|
-
}
|
|
298
|
+
}
|
|
299
|
+
else if (motion != MotionType.SENDING && motion != MotionType.NO_DETECT) {
|
|
301
300
|
infoText.setText("Please Hold Your Hand")
|
|
302
301
|
infoIcon.setImageDrawable(getResources().getDrawable(R.drawable.info_icon))
|
|
302
|
+
|
|
303
|
+
} else if(brightnessEvents != BrightnessEvents.Good){
|
|
304
|
+
if(brightnessEvents == BrightnessEvents.TooDark){
|
|
305
|
+
infoText.setText("Please increase the lighting")
|
|
306
|
+
infoIcon.setImageDrawable(getResources().getDrawable(R.drawable.info_icon))
|
|
307
|
+
}
|
|
308
|
+
if(brightnessEvents == BrightnessEvents.TooBright){
|
|
309
|
+
infoText.setText("Please reduce the lighting")
|
|
310
|
+
infoIcon.setImageDrawable(getResources().getDrawable(R.drawable.info_icon))
|
|
311
|
+
}
|
|
312
|
+
|
|
303
313
|
} else {
|
|
304
|
-
if (motion == MotionType.SENDING &&
|
|
314
|
+
if (motion == MotionType.SENDING && zoom == ZoomType.SENDING && brightnessEvents == BrightnessEvents.Good){
|
|
305
315
|
infoText.setText("Hold Steady")
|
|
306
316
|
infoIcon.setImageDrawable(getResources().getDrawable(R.drawable.info_icon))
|
|
307
317
|
}
|
|
308
|
-
if (motion == MotionType.NO_DETECT &&
|
|
318
|
+
if (motion == MotionType.NO_DETECT && zoom == ZoomType.NO_DETECT){
|
|
309
319
|
infoText.setText("Please present passport")
|
|
310
320
|
infoIcon.setImageDrawable(getResources().getDrawable(R.drawable.info_icon))
|
|
311
321
|
}
|
|
312
|
-
|
|
313
322
|
}
|
|
314
|
-
}
|
|
323
|
+
}else {
|
|
315
324
|
infoLayout.visibility = View.GONE
|
|
316
325
|
}
|
|
317
|
-
|
|
318
326
|
}
|
|
319
327
|
}
|
|
320
328
|
|
package/assentify-sdk.podspec
CHANGED
|
@@ -5,8 +5,8 @@ import AssentifySdk
|
|
|
5
5
|
|
|
6
6
|
@objc(NativeAssentifySdk)
|
|
7
7
|
class NativeAssentifySdk: RCTEventEmitter ,AssentifySdkDelegate , SubmitDataDelegate , ContextAwareDelegate{
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
|
|
9
|
+
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
private var assentifySdk :AssentifySdk?
|
|
@@ -36,14 +36,14 @@ class NativeAssentifySdk: RCTEventEmitter ,AssentifySdkDelegate , SubmitDataDel
|
|
|
36
36
|
ENV_CustomColor: String = "#f5a103",
|
|
37
37
|
enableDetect: Bool = true,
|
|
38
38
|
enableGuide: Bool = true
|
|
39
|
-
|
|
39
|
+
|
|
40
40
|
) -> Void {
|
|
41
41
|
|
|
42
42
|
if(apiKey.isEmpty || tenantIdentifier.isEmpty || instanceHash.isEmpty ){
|
|
43
43
|
print("apiKey, tenantIdentifier, instanceHash a are mandatory parameters")
|
|
44
44
|
return
|
|
45
45
|
}
|
|
46
|
-
|
|
46
|
+
|
|
47
47
|
self.apiKey = apiKey
|
|
48
48
|
|
|
49
49
|
print("apiKey: \(apiKey)")
|
|
@@ -70,20 +70,17 @@ class NativeAssentifySdk: RCTEventEmitter ,AssentifySdkDelegate , SubmitDataDel
|
|
|
70
70
|
|
|
71
71
|
UserDefaults.standard.set(instanceHash, forKey:"instanceHash")
|
|
72
72
|
// UserDefaults.standard.set(previewURL, forKey:"previewURL")
|
|
73
|
-
|
|
73
|
+
|
|
74
74
|
let environmentalConditions = EnvironmentalConditions(
|
|
75
|
-
enableDetect: enableDetect,
|
|
76
|
-
|
|
77
|
-
BRIGHTNESS_LOW_THRESHOLD: 0.0,
|
|
78
|
-
PREDICTION_LOW_PERCENTAGE: 50.0,
|
|
79
|
-
PREDICTION_HIGH_PERCENTAGE: 100.0,
|
|
75
|
+
enableDetect: enableDetect,
|
|
76
|
+
enableGuide: enableGuide,
|
|
80
77
|
CustomColor: "#ffffff",
|
|
81
78
|
HoldHandColor: ENV_CustomColor
|
|
82
79
|
)
|
|
83
80
|
|
|
84
81
|
self.holdHandColor = ENV_CustomColor;
|
|
85
82
|
self.processingColor = "#ffffff";
|
|
86
|
-
|
|
83
|
+
|
|
87
84
|
|
|
88
85
|
self.assentifySdk = AssentifySdk(
|
|
89
86
|
apiKey: apiKey,
|
|
@@ -209,7 +206,7 @@ class NativeAssentifySdk: RCTEventEmitter ,AssentifySdkDelegate , SubmitDataDel
|
|
|
209
206
|
}
|
|
210
207
|
}
|
|
211
208
|
|
|
212
|
-
|
|
209
|
+
|
|
213
210
|
func navigateToFaceMatchontroller(imageUrl: String ,showCountDown:Bool) {
|
|
214
211
|
DispatchQueue.main.async {
|
|
215
212
|
let imageDocUrl = URL(string: imageUrl)
|
|
@@ -227,9 +224,9 @@ class NativeAssentifySdk: RCTEventEmitter ,AssentifySdkDelegate , SubmitDataDel
|
|
|
227
224
|
currentViewController.present(viewController, animated: true, completion: nil)
|
|
228
225
|
}
|
|
229
226
|
}
|
|
230
|
-
|
|
227
|
+
|
|
231
228
|
}
|
|
232
|
-
|
|
229
|
+
|
|
233
230
|
}
|
|
234
231
|
}
|
|
235
232
|
|
|
@@ -249,13 +246,13 @@ class NativeAssentifySdk: RCTEventEmitter ,AssentifySdkDelegate , SubmitDataDel
|
|
|
249
246
|
func startScanIDPage(_ kycDocumentDetails: String ,language: String,flippingCard:Bool) {
|
|
250
247
|
navigateToIDCardController(jsonStringKycDocumentDetails: kycDocumentDetails,language:language,flippingCard:flippingCard)
|
|
251
248
|
}
|
|
252
|
-
|
|
249
|
+
|
|
253
250
|
@objc
|
|
254
251
|
func startFaceMatch(_ imageUrl: String ,showCountDown:Bool) {
|
|
255
252
|
navigateToFaceMatchontroller(imageUrl: imageUrl,showCountDown:showCountDown)
|
|
256
253
|
}
|
|
257
|
-
|
|
258
|
-
|
|
254
|
+
|
|
255
|
+
|
|
259
256
|
|
|
260
257
|
@objc
|
|
261
258
|
func submitData(_ data: [String: Any]) {
|
|
@@ -312,7 +309,7 @@ class NativeAssentifySdk: RCTEventEmitter ,AssentifySdkDelegate , SubmitDataDel
|
|
|
312
309
|
extractedInformation:extractedInformationWrapUp
|
|
313
310
|
))
|
|
314
311
|
}
|
|
315
|
-
|
|
312
|
+
|
|
316
313
|
if(!self.documentURL.isEmpty){
|
|
317
314
|
if(step.stepDefinition == StepsName.ContextAwareSigning){
|
|
318
315
|
step.outputProperties.forEach({ property in
|
|
@@ -327,7 +324,7 @@ class NativeAssentifySdk: RCTEventEmitter ,AssentifySdkDelegate , SubmitDataDel
|
|
|
327
324
|
))
|
|
328
325
|
}
|
|
329
326
|
}
|
|
330
|
-
|
|
327
|
+
|
|
331
328
|
if(step.stepDefinition == StepsName.BlockLoader){
|
|
332
329
|
step.outputProperties.forEach({ property in
|
|
333
330
|
if (property.key.contains(BlockLoaderKeys.DeviceName)) {
|
|
@@ -427,7 +424,7 @@ class NativeAssentifySdk: RCTEventEmitter ,AssentifySdkDelegate , SubmitDataDel
|
|
|
427
424
|
|
|
428
425
|
func getIdTitle(kycDocumentDetails: [KycDocumentDetails]) -> String {
|
|
429
426
|
var title = ""
|
|
430
|
-
|
|
427
|
+
|
|
431
428
|
for country in self.templatesByCountry ?? [] {
|
|
432
429
|
for template in country.templates {
|
|
433
430
|
if !template.kycDocumentDetails.isEmpty {
|
|
@@ -437,58 +434,58 @@ class NativeAssentifySdk: RCTEventEmitter ,AssentifySdkDelegate , SubmitDataDel
|
|
|
437
434
|
}
|
|
438
435
|
}
|
|
439
436
|
}
|
|
440
|
-
|
|
437
|
+
|
|
441
438
|
return title
|
|
442
439
|
}
|
|
443
440
|
|
|
444
441
|
func imageToBase64(from url: URL, completion: @escaping (String?) -> Void) {
|
|
445
|
-
|
|
442
|
+
|
|
446
443
|
var request = URLRequest(url: url)
|
|
447
|
-
|
|
444
|
+
|
|
448
445
|
let headers = ["X-Api-Key": self.apiKey]
|
|
449
|
-
|
|
446
|
+
|
|
450
447
|
for (headerField, headerValue) in headers {
|
|
451
448
|
request.setValue(headerValue, forHTTPHeaderField: headerField)
|
|
452
449
|
}
|
|
453
|
-
|
|
450
|
+
|
|
454
451
|
let task = URLSession.shared.dataTask(with: request) { data, response, error in
|
|
455
452
|
guard let imageData = data, error == nil else {
|
|
456
453
|
print("Failed to download image from URL: \(error?.localizedDescription ?? "Unknown error")")
|
|
457
454
|
completion(nil)
|
|
458
455
|
return
|
|
459
456
|
}
|
|
460
|
-
|
|
457
|
+
|
|
461
458
|
let base64String = imageData.base64EncodedString()
|
|
462
|
-
|
|
459
|
+
|
|
463
460
|
completion(base64String)
|
|
464
461
|
}
|
|
465
|
-
|
|
462
|
+
|
|
466
463
|
task.resume()
|
|
467
464
|
}
|
|
468
|
-
|
|
469
|
-
|
|
465
|
+
|
|
466
|
+
|
|
470
467
|
@objc
|
|
471
468
|
func startContextAwareSigning() {
|
|
472
469
|
contextAwareSigning = assentifySdk?.startContextAwareSigning(contextAwareDelegate: self)
|
|
473
470
|
}
|
|
474
|
-
|
|
471
|
+
|
|
475
472
|
@objc
|
|
476
473
|
func createUserDocumentInstance(_ data: [String: String]) {
|
|
477
474
|
contextAwareSigning?.createUserDocumentInstance(data: data);
|
|
478
475
|
}
|
|
479
|
-
|
|
476
|
+
|
|
480
477
|
@objc
|
|
481
478
|
func signature(_ signature: String) {
|
|
482
479
|
contextAwareSigning?.signature(
|
|
483
480
|
documentId: signatureResponseModel!.documentId,documentInstanceId: signatureResponseModel!.templateInstanceId, signature:signature)
|
|
484
481
|
}
|
|
485
|
-
|
|
482
|
+
|
|
486
483
|
func onHasTokens(documentTokens: [DocumentTokensModel]) {
|
|
487
484
|
DispatchQueue.main.async {
|
|
488
485
|
do{
|
|
489
486
|
let jsonData = try JSONEncoder().encode(documentTokens)
|
|
490
487
|
let jsonString = String(decoding: jsonData, as: UTF8.self)
|
|
491
|
-
|
|
488
|
+
|
|
492
489
|
let eventResultMap: [String: Any] = [
|
|
493
490
|
"documentTokens": jsonString,
|
|
494
491
|
]
|
|
@@ -496,14 +493,14 @@ class NativeAssentifySdk: RCTEventEmitter ,AssentifySdkDelegate , SubmitDataDel
|
|
|
496
493
|
} catch {}
|
|
497
494
|
}
|
|
498
495
|
}
|
|
499
|
-
|
|
496
|
+
|
|
500
497
|
func onCreateUserDocumentInstance(userDocumentResponseModel: CreateUserDocumentResponseModel) {
|
|
501
498
|
signatureResponseModel = userDocumentResponseModel;
|
|
502
499
|
DispatchQueue.main.async {
|
|
503
500
|
do{
|
|
504
501
|
let jsonData = try JSONEncoder().encode(userDocumentResponseModel)
|
|
505
502
|
let jsonString = String(decoding: jsonData, as: UTF8.self)
|
|
506
|
-
|
|
503
|
+
|
|
507
504
|
let eventResultMap: [String: Any] = [
|
|
508
505
|
"userDocumentResponseModel": jsonString,
|
|
509
506
|
]
|
|
@@ -511,14 +508,14 @@ class NativeAssentifySdk: RCTEventEmitter ,AssentifySdkDelegate , SubmitDataDel
|
|
|
511
508
|
} catch {}
|
|
512
509
|
}
|
|
513
510
|
}
|
|
514
|
-
|
|
511
|
+
|
|
515
512
|
func onSignature(signatureResponseModel: SignatureResponseModel) {
|
|
516
513
|
self.documentURL = signatureResponseModel.signedDocumentUri;
|
|
517
514
|
DispatchQueue.main.async {
|
|
518
515
|
do{
|
|
519
516
|
let jsonData = try JSONEncoder().encode(signatureResponseModel)
|
|
520
517
|
let jsonString = String(decoding: jsonData, as: UTF8.self)
|
|
521
|
-
|
|
518
|
+
|
|
522
519
|
let eventResultMap: [String: Any] = [
|
|
523
520
|
"signatureResponseModel": jsonString,
|
|
524
521
|
]
|
|
@@ -526,7 +523,7 @@ class NativeAssentifySdk: RCTEventEmitter ,AssentifySdkDelegate , SubmitDataDel
|
|
|
526
523
|
} catch {}
|
|
527
524
|
}
|
|
528
525
|
}
|
|
529
|
-
|
|
526
|
+
|
|
530
527
|
func onError(message: String) {
|
|
531
528
|
///
|
|
532
529
|
}
|