assentify-sdk-react-native 0.0.42 → 1.0.0-Beta
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 +5 -1
- package/android/build.gradle +29 -32
- package/android/gradle.properties +2 -2
- package/android/src/main/java/com/assentifysdk/AssentifySdkModule.kt +81 -118
- package/android/src/main/java/com/assentifysdk/FaceMatchActivity.kt +27 -24
- package/android/src/main/java/com/assentifysdk/FlowActivity.kt +191 -0
- package/android/src/main/java/com/assentifysdk/QrActivity.kt +10 -11
- package/android/src/main/java/com/assentifysdk/ScanIDActivity.kt +83 -98
- package/android/src/main/java/com/assentifysdk/ScanOtherActivity.kt +7 -6
- package/android/src/main/java/com/assentifysdk/ScanPassportActivity.kt +8 -13
- package/android/src/main/res/layout/activity_face_scan.xml +1 -1
- package/android/src/main/res/layout/activity_flow.xml +9 -0
- package/android/src/main/res/layout/activity_scan.xml +1 -1
- package/assentify-sdk.podspec +2 -1
- package/ios/NativeAssentifySdk.mm +24 -4
- package/ios/NativeAssentifySdk.swift +229 -30
- package/ios/UIComponents/RNPassportScanner.swift +4 -3
- package/ios/View/FaceMatchController.swift +131 -124
- package/ios/View/IDCardController.swift +48 -35
- package/ios/View/OtherController.swift +9 -18
- package/ios/View/PassportController.swift +82 -121
- package/ios/View/QrController.swift +9 -6
- package/lib/commonjs/AssentifyProvider.js +88 -101
- package/lib/commonjs/AssentifyProvider.js.map +1 -1
- package/lib/commonjs/AssentifyWrapper.js +11 -17
- package/lib/commonjs/AssentifyWrapper.js.map +1 -1
- package/lib/commonjs/BackgroundType.js +11 -0
- package/lib/commonjs/BackgroundType.js.map +1 -0
- package/lib/commonjs/helpers/parsers/FlowCompletedModelParser.js +26 -0
- package/lib/commonjs/helpers/parsers/FlowCompletedModelParser.js.map +1 -0
- package/lib/commonjs/index.js +4 -4
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/types.js.map +1 -1
- package/lib/module/AssentifyProvider.js +86 -98
- package/lib/module/AssentifyProvider.js.map +1 -1
- package/lib/module/AssentifyWrapper.js +11 -17
- package/lib/module/AssentifyWrapper.js.map +1 -1
- package/lib/module/BackgroundType.js +5 -0
- package/lib/module/BackgroundType.js.map +1 -0
- package/lib/module/helpers/parsers/FlowCompletedModelParser.js +20 -0
- package/lib/module/helpers/parsers/FlowCompletedModelParser.js.map +1 -0
- package/lib/module/index.js +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/types.js.map +1 -1
- package/lib/typescript/example/babel.config.d.ts +153 -1
- package/lib/typescript/example/babel.config.d.ts.map +1 -1
- package/lib/typescript/example/metro.config.d.ts +2 -2
- package/lib/typescript/example/metro.config.d.ts.map +1 -1
- package/lib/typescript/example/react-native.config.d.ts +153 -1
- package/lib/typescript/example/react-native.config.d.ts.map +1 -1
- package/lib/typescript/example/src/App.d.ts.map +1 -1
- package/lib/typescript/example/src/Home.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/AssentifyProvider.d.ts +3 -1
- package/lib/typescript/lib/commonjs/AssentifyProvider.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/AssentifyWrapper.d.ts +4 -6
- package/lib/typescript/lib/commonjs/AssentifyWrapper.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/BackgroundType.d.ts +6 -0
- package/lib/typescript/lib/commonjs/BackgroundType.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/helpers/parsers/FlowCompletedModelParser.d.ts +11 -0
- package/lib/typescript/lib/commonjs/helpers/parsers/FlowCompletedModelParser.d.ts.map +1 -0
- package/lib/typescript/lib/module/AssentifyProvider.d.ts +4 -2
- package/lib/typescript/lib/module/AssentifyProvider.d.ts.map +1 -1
- package/lib/typescript/lib/module/AssentifyWrapper.d.ts +4 -6
- package/lib/typescript/lib/module/AssentifyWrapper.d.ts.map +1 -1
- package/lib/typescript/lib/module/BackgroundType.d.ts +5 -0
- package/lib/typescript/lib/module/BackgroundType.d.ts.map +1 -0
- package/lib/typescript/lib/module/helpers/parsers/FlowCompletedModelParser.d.ts +10 -0
- package/lib/typescript/lib/module/helpers/parsers/FlowCompletedModelParser.d.ts.map +1 -0
- package/lib/typescript/lib/module/index.d.ts +5 -7
- package/lib/typescript/lib/module/index.d.ts.map +1 -1
- package/lib/typescript/src/AssentifyProvider.d.ts +5 -2
- package/lib/typescript/src/AssentifyProvider.d.ts.map +1 -1
- package/lib/typescript/src/AssentifyWrapper.d.ts +6 -7
- package/lib/typescript/src/AssentifyWrapper.d.ts.map +1 -1
- package/lib/typescript/src/BackgroundType.d.ts +6 -0
- package/lib/typescript/src/BackgroundType.d.ts.map +1 -0
- package/lib/typescript/src/helpers/parsers/FaceMatchParser.d.ts.map +1 -1
- package/lib/typescript/src/helpers/parsers/FlowCompletedModelParser.d.ts +4 -0
- package/lib/typescript/src/helpers/parsers/FlowCompletedModelParser.d.ts.map +1 -0
- package/lib/typescript/src/helpers/parsers/IDCardParser.d.ts.map +1 -1
- package/lib/typescript/src/helpers/parsers/OtherIDParser.d.ts.map +1 -1
- package/lib/typescript/src/helpers/parsers/PassportParser.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +5 -7
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/types.d.ts +11 -2
- package/lib/typescript/src/types.d.ts.map +1 -1
- package/package.json +14 -10
- package/src/AssentifyProvider.tsx +196 -147
- package/src/AssentifyWrapper.ts +55 -27
- package/src/BackgroundType.ts +7 -0
- package/src/helpers/parsers/FlowCompletedModelParser.ts +31 -0
- package/src/index.ts +1 -1
- package/src/types.ts +13 -2
- package/lib/commonjs/DoneFlags.js +0 -14
- package/lib/commonjs/DoneFlags.js.map +0 -1
- package/lib/module/DoneFlags.js +0 -8
- package/lib/module/DoneFlags.js.map +0 -1
- package/lib/typescript/lib/commonjs/DoneFlags.d.ts +0 -9
- package/lib/typescript/lib/commonjs/DoneFlags.d.ts.map +0 -1
- package/lib/typescript/lib/module/DoneFlags.d.ts +0 -8
- package/lib/typescript/lib/module/DoneFlags.d.ts.map +0 -1
- package/lib/typescript/src/DoneFlags.d.ts +0 -9
- package/lib/typescript/src/DoneFlags.d.ts.map +0 -1
- package/src/DoneFlags.ts +0 -11
|
@@ -36,7 +36,6 @@ import android.widget.LinearLayout
|
|
|
36
36
|
import android.widget.RelativeLayout
|
|
37
37
|
import java.text.SimpleDateFormat
|
|
38
38
|
import com.assentify.sdk.Core.Constants.BrightnessEvents
|
|
39
|
-
import com.assentify.sdk.Core.Constants.DoneFlags
|
|
40
39
|
import com.assentify.sdk.ScanPassport.ScanPassportManual
|
|
41
40
|
import com.assentify.sdk.ScanPassport.ScanPassportResult
|
|
42
41
|
|
|
@@ -285,15 +284,9 @@ class ScanPassportActivity : AppCompatActivity(),
|
|
|
285
284
|
}
|
|
286
285
|
}
|
|
287
286
|
|
|
288
|
-
override fun onComplete(dataModel: PassportResponseModel
|
|
287
|
+
override fun onComplete(dataModel: PassportResponseModel) {
|
|
289
288
|
|
|
290
|
-
|
|
291
|
-
runOnUiThread {
|
|
292
|
-
start = false;
|
|
293
|
-
showPopUpMessage(R.drawable.expire, "Expired", "Please provide valid ID", false)
|
|
294
|
-
}
|
|
295
|
-
} else {
|
|
296
|
-
triggerCompleteEvent("onComplete", dataModel,doneFlag)
|
|
289
|
+
triggerCompleteEvent("onComplete",dataModel)
|
|
297
290
|
/** Steps **/
|
|
298
291
|
|
|
299
292
|
/** Data To Submit **/
|
|
@@ -349,12 +342,12 @@ class ScanPassportActivity : AppCompatActivity(),
|
|
|
349
342
|
|
|
350
343
|
}
|
|
351
344
|
|
|
352
|
-
|
|
345
|
+
|
|
353
346
|
|
|
354
347
|
|
|
355
348
|
}
|
|
356
349
|
|
|
357
|
-
override fun onEnvironmentalConditionsChange(brightnessEvents:
|
|
350
|
+
override fun onEnvironmentalConditionsChange(brightnessEvents:BrightnessEvents, motion: MotionType,zoom: ZoomType, isCentered: Boolean,){
|
|
358
351
|
runOnUiThread {
|
|
359
352
|
if(start == false){
|
|
360
353
|
infoLayout.visibility = View.VISIBLE
|
|
@@ -390,6 +383,9 @@ class ScanPassportActivity : AppCompatActivity(),
|
|
|
390
383
|
if (motion == MotionType.NO_DETECT && zoom == ZoomType.NO_DETECT){
|
|
391
384
|
infoText.setText("Please present passport")
|
|
392
385
|
infoIcon.setImageDrawable(getResources().getDrawable(R.drawable.info_icon))
|
|
386
|
+
}else if(!isCentered){
|
|
387
|
+
infoText.setText("Please center your card")
|
|
388
|
+
infoIcon.setImageDrawable(getResources().getDrawable(R.drawable.info_icon))
|
|
393
389
|
}
|
|
394
390
|
}
|
|
395
391
|
}else {
|
|
@@ -405,14 +401,13 @@ class ScanPassportActivity : AppCompatActivity(),
|
|
|
405
401
|
} ?: emptyMap()
|
|
406
402
|
}
|
|
407
403
|
|
|
408
|
-
private fun triggerCompleteEvent(eventName: String, dataModel: PassportResponseModel?
|
|
404
|
+
private fun triggerCompleteEvent(eventName: String, dataModel: PassportResponseModel?) {
|
|
409
405
|
|
|
410
406
|
val eventResultMap = Arguments.createMap().apply {
|
|
411
407
|
if (dataModel != null) {
|
|
412
408
|
val gson = Gson()
|
|
413
409
|
val jsonString = gson.toJson(dataModel.passportExtractedModel!!)
|
|
414
410
|
putString("PassportDataModel", jsonString)
|
|
415
|
-
putString("DoneFlag", doneFlag.toString())
|
|
416
411
|
}
|
|
417
412
|
}
|
|
418
413
|
reactApplicationContext.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter::class.java)
|
|
@@ -246,7 +246,7 @@
|
|
|
246
246
|
android:layout_height="56dp"
|
|
247
247
|
android:layout_marginStart="16dp"
|
|
248
248
|
android:layout_marginEnd="16dp"
|
|
249
|
-
android:layout_marginBottom="
|
|
249
|
+
android:layout_marginBottom="30dp"
|
|
250
250
|
android:text="Take Photo"
|
|
251
251
|
android:textAllCaps="false"
|
|
252
252
|
android:textColor="@android:color/white"
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
3
|
+
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
4
|
+
xmlns:tools="http://schemas.android.com/tools"
|
|
5
|
+
android:layout_width="match_parent"
|
|
6
|
+
android:layout_height="match_parent"
|
|
7
|
+
tools:context=".FlowActivity">
|
|
8
|
+
|
|
9
|
+
</androidx.constraintlayout.widget.ConstraintLayout>
|
package/assentify-sdk.podspec
CHANGED
|
@@ -9,7 +9,6 @@ RCT_EXTERN_METHOD(initialize: (NSString *)apiKey
|
|
|
9
9
|
performLivenessFace:(BOOL *)performLivenessFace
|
|
10
10
|
ENV_CustomColor:(NSString *)ENV_CustomColor
|
|
11
11
|
enableDetect:(BOOL *)enableDetect
|
|
12
|
-
enableGuide:(BOOL *)enableGuide
|
|
13
12
|
androidMotionCardLimit:(nonnull NSNumber * )androidMotionCardLimit
|
|
14
13
|
androidMotionPassportLimit:(nonnull NSNumber * )androidMotionPassportLimit
|
|
15
14
|
iOSMotionCardsLimit:(nonnull NSNumber * )iOSMotionCardsLimit
|
|
@@ -20,12 +19,12 @@ RCT_EXTERN_METHOD(initialize: (NSString *)apiKey
|
|
|
20
19
|
iOSBrightnessLowThreshold:(nonnull NSNumber * )iOSBrightnessLowThreshold
|
|
21
20
|
activeLiveType:(NSString * )activeLiveType
|
|
22
21
|
activeLivenessCheckCount:(nonnull NSNumber * )activeLivenessCheckCount
|
|
23
|
-
retryCount:(nonnull NSNumber * )retryCount
|
|
24
22
|
faceLivenessRetryCount:(nonnull NSNumber * )faceLivenessRetryCount
|
|
25
23
|
minRam:(nonnull NSNumber * )minRam
|
|
26
24
|
iOSMinRam:(nonnull NSNumber * )iOSMinRam
|
|
27
25
|
minCPUCores:(nonnull NSNumber * )minCPUCores
|
|
28
26
|
manualClickColor:(NSString * )manualClickColor
|
|
27
|
+
countDownNumbersColor:(NSString * )countDownNumbersColor
|
|
29
28
|
)
|
|
30
29
|
RCT_EXTERN_METHOD(startScanPassport:
|
|
31
30
|
(NSString *)language
|
|
@@ -35,12 +34,12 @@ RCT_EXTERN_METHOD(startScanOtherIDPage:
|
|
|
35
34
|
(NSString *)language
|
|
36
35
|
stepID:(nonnull NSNumber *)stepID
|
|
37
36
|
)
|
|
38
|
-
RCT_EXTERN_METHOD(startScanIDPage:(NSString *)
|
|
37
|
+
RCT_EXTERN_METHOD(startScanIDPage:(NSString *)templatesByCountryObject
|
|
39
38
|
language:(NSString *)language
|
|
40
39
|
flippingCard:(BOOL)flippingCard
|
|
41
40
|
stepID:(nonnull NSNumber *)stepID
|
|
42
41
|
)
|
|
43
|
-
RCT_EXTERN_METHOD(startScanQrPage:(NSString *)
|
|
42
|
+
RCT_EXTERN_METHOD(startScanQrPage:(NSString *)templatesByCountryObject
|
|
44
43
|
language:(NSString *)language
|
|
45
44
|
stepID:(nonnull NSNumber *)stepID
|
|
46
45
|
)
|
|
@@ -55,6 +54,27 @@ RCT_EXTERN_METHOD(signature:(NSString *)signature)
|
|
|
55
54
|
|
|
56
55
|
|
|
57
56
|
RCT_EXTERN_METHOD(submitData:(NSDictionary *)data)
|
|
57
|
+
|
|
58
|
+
RCT_EXTERN_METHOD(startFlow:(NSString *)logoUrl
|
|
59
|
+
svgBackgroundImageUrl:(NSString *)svgBackgroundImageUrl
|
|
60
|
+
textColor:(NSString *)textColor
|
|
61
|
+
secondaryTextColor:(NSString *)secondaryTextColor
|
|
62
|
+
backgroundCardColor:(NSString *)backgroundCardColor
|
|
63
|
+
accentColor:(NSString *)accentColor
|
|
64
|
+
backgroundColors:(NSArray *)backgroundColors
|
|
65
|
+
clickColors:(NSArray *)clickColors
|
|
66
|
+
angleDegreesBackgroundColors:(nonnull NSNumber *)angleDegreesBackgroundColors
|
|
67
|
+
holdUntilBackgroundColors:(nonnull NSNumber *)holdUntilBackgroundColors
|
|
68
|
+
angleDegreesClickColors:(nonnull NSNumber *)angleDegreesClickColors
|
|
69
|
+
holdUntilClickColors:(nonnull NSNumber *)holdUntilClickColors
|
|
70
|
+
backgroundType:(NSString *)backgroundType
|
|
71
|
+
clear:(BOOL)clear
|
|
72
|
+
language:(NSString *)language
|
|
73
|
+
enableNfc:(BOOL)enableNfc
|
|
74
|
+
enableQr:(BOOL)enableQr
|
|
75
|
+
blockLoaderCustomProperties:(NSString *)blockLoaderCustomProperties)
|
|
76
|
+
|
|
77
|
+
|
|
58
78
|
RCT_EXTERN_METHOD(supportedEvents)
|
|
59
79
|
|
|
60
80
|
+ (BOOL)requiresMainQueueSetup
|
|
@@ -4,7 +4,7 @@ import Foundation
|
|
|
4
4
|
import AssentifySdk
|
|
5
5
|
|
|
6
6
|
@objc(NativeAssentifySdk)
|
|
7
|
-
class NativeAssentifySdk: RCTEventEmitter ,AssentifySdkDelegate , SubmitDataDelegate
|
|
7
|
+
class NativeAssentifySdk: RCTEventEmitter ,AssentifySdkDelegate , SubmitDataDelegate,FlowDelegate{
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
@@ -30,7 +30,6 @@ class NativeAssentifySdk: RCTEventEmitter ,AssentifySdkDelegate , SubmitDataDel
|
|
|
30
30
|
performLivenessFace: Bool = false,
|
|
31
31
|
ENV_CustomColor: String = "#f5a103",
|
|
32
32
|
enableDetect: Bool = true,
|
|
33
|
-
enableGuide: Bool = true,
|
|
34
33
|
androidMotionCardLimit: NSNumber,
|
|
35
34
|
androidMotionPassportLimit: NSNumber,
|
|
36
35
|
iOSMotionCardsLimit: NSNumber,
|
|
@@ -41,12 +40,12 @@ class NativeAssentifySdk: RCTEventEmitter ,AssentifySdkDelegate , SubmitDataDel
|
|
|
41
40
|
iOSBrightnessLowThreshold: NSNumber,
|
|
42
41
|
activeLiveType: String,
|
|
43
42
|
activeLivenessCheckCount:NSNumber,
|
|
44
|
-
retryCount:NSNumber,
|
|
45
43
|
faceLivenessRetryCount:NSNumber,
|
|
46
44
|
minRam:NSNumber,
|
|
47
45
|
iOSMinRam:NSNumber,
|
|
48
46
|
minCPUCores:NSNumber,
|
|
49
|
-
manualClickColor:String
|
|
47
|
+
manualClickColor:String,
|
|
48
|
+
countDownNumbersColor: String = "#f5a103",
|
|
50
49
|
) -> Void {
|
|
51
50
|
|
|
52
51
|
if(apiKey.isEmpty || tenantIdentifier.isEmpty || instanceHash.isEmpty ){
|
|
@@ -66,7 +65,6 @@ class NativeAssentifySdk: RCTEventEmitter ,AssentifySdkDelegate , SubmitDataDel
|
|
|
66
65
|
print("\(tag) performLivenessFace: \(performLivenessFace)")
|
|
67
66
|
print("\(tag) ENV_CustomColor: \(ENV_CustomColor)")
|
|
68
67
|
print("\(tag) enableDetect: \(enableDetect)")
|
|
69
|
-
print("\(tag) enableGuide: \(enableGuide)")
|
|
70
68
|
print("\(tag) androidMotionCardLimit: \(androidMotionCardLimit)")
|
|
71
69
|
print("\(tag) androidMotionPassportLimit: \(androidMotionPassportLimit)")
|
|
72
70
|
print("\(tag) iOSMotionCardsLimit: \(iOSMotionCardsLimit)")
|
|
@@ -77,12 +75,12 @@ class NativeAssentifySdk: RCTEventEmitter ,AssentifySdkDelegate , SubmitDataDel
|
|
|
77
75
|
print("\(tag) iOSBrightnessLowThreshold: \(iOSBrightnessLowThreshold)")
|
|
78
76
|
print("\(tag) ActiveLiveType: \(activeLiveType)")
|
|
79
77
|
print("\(tag) ActiveLivenessCheckCount: \(activeLivenessCheckCount)")
|
|
80
|
-
print("\(tag) RetryCount: \(retryCount)")
|
|
81
78
|
print("\(tag) FaceLivenessRetryCount:\(faceLivenessRetryCount)")
|
|
82
79
|
print("\(tag) MinRam: \(minRam)")
|
|
83
80
|
print("\(tag) iOSMinRam:\(iOSMinRam)")
|
|
84
81
|
print("\(tag) MinCPUCores: \(minCPUCores)")
|
|
85
82
|
print("\(tag) ManualClickColor: \(manualClickColor)")
|
|
83
|
+
print("\(tag) CountDownNumbersColor: \(countDownNumbersColor)")
|
|
86
84
|
print("\(tag) ==============================================")
|
|
87
85
|
|
|
88
86
|
|
|
@@ -116,8 +114,7 @@ class NativeAssentifySdk: RCTEventEmitter ,AssentifySdkDelegate , SubmitDataDel
|
|
|
116
114
|
|
|
117
115
|
let environmentalConditions = EnvironmentalConditions(
|
|
118
116
|
enableDetect: enableDetect,
|
|
119
|
-
|
|
120
|
-
CustomColor: "#ffffff",
|
|
117
|
+
CountDownNumbersColor:countDownNumbersColor,
|
|
121
118
|
HoldHandColor: ENV_CustomColor,
|
|
122
119
|
BRIGHTNESS_HIGH_THRESHOLD :Double(iOSBrightnessHighThreshold.intValue),
|
|
123
120
|
BRIGHTNESS_LOW_THRESHOLD:Double(iOSBrightnessLowThreshold.intValue),
|
|
@@ -125,7 +122,6 @@ class NativeAssentifySdk: RCTEventEmitter ,AssentifySdkDelegate , SubmitDataDel
|
|
|
125
122
|
MotionLimitFace: iOSMotionFaceLimit.intValue,
|
|
126
123
|
activeLiveType: typeActive,
|
|
127
124
|
activeLivenessCheckCount:activeLivenessCheckCount.intValue,
|
|
128
|
-
retryCount:retryCount.intValue,
|
|
129
125
|
faceLivenessRetryCount:faceLivenessRetryCount.intValue,
|
|
130
126
|
minRam:iOSMinRam.intValue,
|
|
131
127
|
minCPUCores:minCPUCores.intValue
|
|
@@ -166,7 +162,13 @@ class NativeAssentifySdk: RCTEventEmitter ,AssentifySdkDelegate , SubmitDataDel
|
|
|
166
162
|
self.stepDefinitions = configModel.stepDefinitions;
|
|
167
163
|
self.configModel = configModel;
|
|
168
164
|
|
|
169
|
-
|
|
165
|
+
if let stepId = configModel.stepMap
|
|
166
|
+
.first(where: { $0.stepDefinition == StepsNames.identificationDocumentCapture })?
|
|
167
|
+
.id {
|
|
168
|
+
|
|
169
|
+
templatesByCountry = self.assentifySdk!.getTemplates(stepID: stepId)
|
|
170
|
+
}
|
|
171
|
+
|
|
170
172
|
do {
|
|
171
173
|
let jsonDataTemplates = try JSONEncoder().encode(self.templatesByCountry)
|
|
172
174
|
let jsonStringTemplates = String(decoding: jsonDataTemplates, as: UTF8.self)
|
|
@@ -217,7 +219,8 @@ class NativeAssentifySdk: RCTEventEmitter ,AssentifySdkDelegate , SubmitDataDel
|
|
|
217
219
|
"onSignature",
|
|
218
220
|
"onCompleteQrScan",
|
|
219
221
|
"onStartQrScan",
|
|
220
|
-
"onErrorQrScan"
|
|
222
|
+
"onErrorQrScan",
|
|
223
|
+
"OnNativeFlowCompleted"
|
|
221
224
|
]
|
|
222
225
|
}
|
|
223
226
|
|
|
@@ -249,16 +252,16 @@ class NativeAssentifySdk: RCTEventEmitter ,AssentifySdkDelegate , SubmitDataDel
|
|
|
249
252
|
}
|
|
250
253
|
|
|
251
254
|
|
|
252
|
-
func navigateToIDCardController(
|
|
253
|
-
if(
|
|
255
|
+
func navigateToIDCardController(templatesByCountryObject: String,language: String,flippingCard:Bool,stepID:Int) {
|
|
256
|
+
if(templatesByCountryObject.isEmpty) {
|
|
254
257
|
return;
|
|
255
258
|
}
|
|
256
|
-
|
|
257
|
-
|
|
259
|
+
let jsonData = Data(templatesByCountryObject.utf8)
|
|
260
|
+
let templatesByCountry: TemplatesByCountry = try! JSONDecoder().decode(TemplatesByCountry.self, from: jsonData)
|
|
258
261
|
DispatchQueue.main.async {
|
|
259
262
|
self.timeStarted = self.getTimeUTC();
|
|
260
263
|
if let currentViewController = UIApplication.shared.keyWindow?.rootViewController {
|
|
261
|
-
|
|
264
|
+
let viewController = IDCardController(assentifySdk: self.assentifySdk!,nativeAssentifySdk: self,holdHandColor: self.holdHandColor!,processingColor: self.processingColor!,templatesByCountry: templatesByCountry,language:language,flippingCard: flippingCard,titleID:"ID Capture", showCountDown: true,apiKey: self.apiKey!,
|
|
262
265
|
stepID: stepID,manualClickColor:self.manualClickColor!)
|
|
263
266
|
viewController.modalPresentationStyle = .fullScreen
|
|
264
267
|
currentViewController.present(viewController, animated: true, completion: nil)
|
|
@@ -267,16 +270,16 @@ class NativeAssentifySdk: RCTEventEmitter ,AssentifySdkDelegate , SubmitDataDel
|
|
|
267
270
|
}
|
|
268
271
|
|
|
269
272
|
|
|
270
|
-
func navigateToQrController(
|
|
271
|
-
if(
|
|
272
|
-
|
|
273
|
+
func navigateToQrController(templatesByCountryObject: String,language: String,stepID:Int) {
|
|
274
|
+
if(templatesByCountryObject.isEmpty) {
|
|
275
|
+
return;
|
|
273
276
|
}
|
|
274
|
-
|
|
275
|
-
|
|
277
|
+
let jsonData = Data(templatesByCountryObject.utf8)
|
|
278
|
+
let templatesByCountry: TemplatesByCountry = try! JSONDecoder().decode(TemplatesByCountry.self, from: jsonData)
|
|
276
279
|
DispatchQueue.main.async {
|
|
277
280
|
self.timeStarted = self.getTimeUTC();
|
|
278
281
|
if let currentViewController = UIApplication.shared.keyWindow?.rootViewController {
|
|
279
|
-
let viewController = QrController(assentifySdk: self.assentifySdk!,nativeAssentifySdk: self,holdHandColor: self.holdHandColor!,processingColor: self.processingColor!,
|
|
282
|
+
let viewController = QrController(assentifySdk: self.assentifySdk!,nativeAssentifySdk: self,holdHandColor: self.holdHandColor!,processingColor: self.processingColor!,templatesByCountry: templatesByCountry,language:language,titleID:"QR Capture", showCountDown: true,apiKey: self.apiKey!,
|
|
280
283
|
stepID: stepID,manualClickColor:self.manualClickColor!)
|
|
281
284
|
viewController.modalPresentationStyle = .fullScreen
|
|
282
285
|
currentViewController.present(viewController, animated: true, completion: nil)
|
|
@@ -324,15 +327,15 @@ class NativeAssentifySdk: RCTEventEmitter ,AssentifySdkDelegate , SubmitDataDel
|
|
|
324
327
|
}
|
|
325
328
|
|
|
326
329
|
@objc
|
|
327
|
-
func startScanIDPage(_
|
|
330
|
+
func startScanIDPage(_ templatesByCountryObject: String ,language: String,flippingCard:Bool,stepID:NSNumber) {
|
|
328
331
|
let stepIDValue = stepID.intValue
|
|
329
|
-
navigateToIDCardController(
|
|
332
|
+
navigateToIDCardController(templatesByCountryObject: templatesByCountryObject,language:language,flippingCard:flippingCard,stepID:stepIDValue)
|
|
330
333
|
}
|
|
331
334
|
|
|
332
335
|
@objc
|
|
333
|
-
func startScanQrPage(_
|
|
336
|
+
func startScanQrPage(_ templatesByCountryObject: String ,language: String,stepID:NSNumber) {
|
|
334
337
|
let stepIDValue = stepID.intValue
|
|
335
|
-
navigateToQrController(
|
|
338
|
+
navigateToQrController(templatesByCountryObject: templatesByCountryObject,language:language,stepID:stepIDValue)
|
|
336
339
|
}
|
|
337
340
|
|
|
338
341
|
@objc
|
|
@@ -574,18 +577,17 @@ class NativeAssentifySdk: RCTEventEmitter ,AssentifySdkDelegate , SubmitDataDel
|
|
|
574
577
|
|
|
575
578
|
@objc
|
|
576
579
|
func startContextAwareSigning() {
|
|
577
|
-
contextAwareSigning = assentifySdk?.startContextAwareSigning(contextAwareDelegate: self)
|
|
580
|
+
// contextAwareSigning = assentifySdk?.startContextAwareSigning(contextAwareDelegate: self)
|
|
578
581
|
}
|
|
579
582
|
|
|
580
583
|
@objc
|
|
581
584
|
func createUserDocumentInstance(_ data: [String: String]) {
|
|
582
|
-
contextAwareSigning?.createUserDocumentInstance(data: data);
|
|
585
|
+
// contextAwareSigning?.createUserDocumentInstance(data: data);
|
|
583
586
|
}
|
|
584
587
|
|
|
585
588
|
@objc
|
|
586
589
|
func signature(_ signature: String) {
|
|
587
|
-
contextAwareSigning?.signature(
|
|
588
|
-
documentId: signatureResponseModel!.documentId,documentInstanceId: signatureResponseModel!.templateInstanceId, signature:signature)
|
|
590
|
+
// contextAwareSigning?.signature(documentId: signatureResponseModel!.documentId,documentInstanceId: signatureResponseModel!.templateInstanceId,signature:signature)
|
|
589
591
|
}
|
|
590
592
|
|
|
591
593
|
func onHasTokens(documentTokens: [DocumentTokensModel]) {
|
|
@@ -635,6 +637,203 @@ class NativeAssentifySdk: RCTEventEmitter ,AssentifySdkDelegate , SubmitDataDel
|
|
|
635
637
|
func onError(message: String) {
|
|
636
638
|
///
|
|
637
639
|
}
|
|
640
|
+
|
|
641
|
+
|
|
642
|
+
@objc
|
|
643
|
+
func startFlow(
|
|
644
|
+
_ logoUrl: String,
|
|
645
|
+
svgBackgroundImageUrl: String,
|
|
646
|
+
textColor: String,
|
|
647
|
+
secondaryTextColor: String,
|
|
648
|
+
backgroundCardColor: String,
|
|
649
|
+
accentColor: String,
|
|
650
|
+
backgroundColors: [String],
|
|
651
|
+
clickColors: [String],
|
|
652
|
+
angleDegreesBackgroundColors: NSNumber,
|
|
653
|
+
holdUntilBackgroundColors: NSNumber,
|
|
654
|
+
angleDegreesClickColors: NSNumber,
|
|
655
|
+
holdUntilClickColors: NSNumber,
|
|
656
|
+
backgroundType: String,
|
|
657
|
+
clear: Bool,
|
|
658
|
+
language: String,
|
|
659
|
+
enableNfc: Bool,
|
|
660
|
+
enableQr: Bool,
|
|
661
|
+
blockLoaderCustomProperties: String
|
|
662
|
+
) {
|
|
663
|
+
navToFlow(
|
|
664
|
+
logoUrl:logoUrl,
|
|
665
|
+
svgBackgroundImageUrl: svgBackgroundImageUrl,
|
|
666
|
+
textColor: textColor,
|
|
667
|
+
secondaryTextColor: secondaryTextColor,
|
|
668
|
+
backgroundCardColor: backgroundCardColor,
|
|
669
|
+
accentColor: accentColor,
|
|
670
|
+
backgroundColors: backgroundColors,
|
|
671
|
+
clickColors: clickColors,
|
|
672
|
+
angleDegreesBackgroundColors: angleDegreesBackgroundColors,
|
|
673
|
+
holdUntilBackgroundColors: holdUntilBackgroundColors,
|
|
674
|
+
angleDegreesClickColors: angleDegreesClickColors,
|
|
675
|
+
holdUntilClickColors: holdUntilClickColors,
|
|
676
|
+
backgroundType: backgroundType,
|
|
677
|
+
clear: clear,
|
|
678
|
+
language: language,
|
|
679
|
+
enableNfc: enableNfc,
|
|
680
|
+
enableQr: enableQr,
|
|
681
|
+
blockLoaderCustomProperties: blockLoaderCustomProperties
|
|
682
|
+
)
|
|
683
|
+
}
|
|
684
|
+
|
|
685
|
+
|
|
686
|
+
|
|
687
|
+
|
|
688
|
+
func navToFlow(
|
|
689
|
+
logoUrl: String,
|
|
690
|
+
svgBackgroundImageUrl: String,
|
|
691
|
+
textColor: String,
|
|
692
|
+
secondaryTextColor: String,
|
|
693
|
+
backgroundCardColor: String,
|
|
694
|
+
accentColor: String,
|
|
695
|
+
backgroundColors: [String],
|
|
696
|
+
clickColors: [String],
|
|
697
|
+
angleDegreesBackgroundColors: NSNumber,
|
|
698
|
+
holdUntilBackgroundColors: NSNumber,
|
|
699
|
+
angleDegreesClickColors: NSNumber,
|
|
700
|
+
holdUntilClickColors: NSNumber,
|
|
701
|
+
backgroundType: String,
|
|
702
|
+
clear: Bool,
|
|
703
|
+
language: String,
|
|
704
|
+
enableNfc: Bool,
|
|
705
|
+
enableQr: Bool,
|
|
706
|
+
blockLoaderCustomProperties: String
|
|
707
|
+
) {
|
|
708
|
+
|
|
709
|
+
let angleBg = angleDegreesBackgroundColors.floatValue
|
|
710
|
+
let holdBg = holdUntilBackgroundColors.floatValue
|
|
711
|
+
let angleClick = angleDegreesClickColors.floatValue
|
|
712
|
+
let holdClick = holdUntilClickColors.floatValue
|
|
713
|
+
|
|
714
|
+
var parsedBlockLoaderCustomProperties: [String: Any] = [:]
|
|
715
|
+
|
|
716
|
+
if let data = blockLoaderCustomProperties.data(using: .utf8) {
|
|
717
|
+
do {
|
|
718
|
+
if let dict = try JSONSerialization.jsonObject(with: data, options: []) as? [String: Any] {
|
|
719
|
+
parsedBlockLoaderCustomProperties = dict
|
|
720
|
+
}
|
|
721
|
+
} catch {
|
|
722
|
+
print("Failed to parse blockLoaderCustomProperties: \(error)")
|
|
723
|
+
}
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
let tag = "FlowActivity"
|
|
727
|
+
|
|
728
|
+
print("\(tag) ===== Received Extras =====")
|
|
729
|
+
print("\(tag) logoUrl: \(logoUrl)")
|
|
730
|
+
print("\(tag) svgBackgroundImageUrl: \(svgBackgroundImageUrl)")
|
|
731
|
+
print("\(tag) textColor: \(textColor)")
|
|
732
|
+
print("\(tag) secondaryTextColor: \(secondaryTextColor)")
|
|
733
|
+
print("\(tag) backgroundCardColor: \(backgroundCardColor)")
|
|
734
|
+
print("\(tag) accentColor: \(accentColor)")
|
|
735
|
+
print("\(tag) backgroundType: \(backgroundType)")
|
|
736
|
+
print("\(tag) backgroundColors: \(backgroundColors)")
|
|
737
|
+
print("\(tag) angleDegreesBackgroundColors: \(angleBg)")
|
|
738
|
+
print("\(tag) holdUntilBackgroundColors: \(holdBg)")
|
|
739
|
+
print("\(tag) clickColors: \(clickColors)")
|
|
740
|
+
print("\(tag) angleDegreesClickColors: \(angleClick)")
|
|
741
|
+
print("\(tag) holdUntilClickColors: \(holdClick)")
|
|
742
|
+
print("\(tag) language: \(language)")
|
|
743
|
+
print("\(tag) enableNfc: \(enableNfc)")
|
|
744
|
+
print("\(tag) enableQr: \(enableQr)")
|
|
745
|
+
print("\(tag) clear: \(clear)")
|
|
746
|
+
print("\(tag) blockLoaderCustomProperties: \(parsedBlockLoaderCustomProperties)")
|
|
747
|
+
print("\(tag) =================================")
|
|
748
|
+
|
|
749
|
+
let bType: BackgroundType = {
|
|
750
|
+
switch backgroundType.lowercased() {
|
|
751
|
+
case "image":
|
|
752
|
+
return .image
|
|
753
|
+
case "color":
|
|
754
|
+
return .color
|
|
755
|
+
default:
|
|
756
|
+
return .color
|
|
757
|
+
}
|
|
758
|
+
}()
|
|
759
|
+
|
|
760
|
+
var backgroundColor: BackgroundStyle? = nil
|
|
761
|
+
var clickColor: BackgroundStyle? = nil
|
|
762
|
+
|
|
763
|
+
if !backgroundColors.isEmpty {
|
|
764
|
+
if backgroundColors.count >= 2 {
|
|
765
|
+
backgroundColor = .gradient(
|
|
766
|
+
colorsHex: backgroundColors,
|
|
767
|
+
angleDegrees: CGFloat(angleBg),
|
|
768
|
+
holdUntil: CGFloat(holdBg)
|
|
769
|
+
)
|
|
770
|
+
} else if let first = backgroundColors.first {
|
|
771
|
+
backgroundColor = .solid(hex: first)
|
|
772
|
+
}
|
|
773
|
+
}
|
|
774
|
+
|
|
775
|
+
if !clickColors.isEmpty {
|
|
776
|
+
if clickColors.count >= 2 {
|
|
777
|
+
clickColor = .gradient(
|
|
778
|
+
colorsHex: clickColors,
|
|
779
|
+
angleDegrees: CGFloat(angleClick),
|
|
780
|
+
holdUntil: CGFloat(holdClick)
|
|
781
|
+
)
|
|
782
|
+
} else if let first = clickColors.first {
|
|
783
|
+
clickColor = .solid(hex: first)
|
|
784
|
+
}
|
|
785
|
+
}
|
|
786
|
+
|
|
787
|
+
let flowEnvironmentalConditions = FlowEnvironmentalConditions(
|
|
788
|
+
backgroundType: bType,
|
|
789
|
+
logoUrl: logoUrl,
|
|
790
|
+
svgBackgroundImageUrl: svgBackgroundImageUrl,
|
|
791
|
+
textColor: textColor,
|
|
792
|
+
secondaryTextColor: secondaryTextColor,
|
|
793
|
+
backgroundCardColor: backgroundCardColor,
|
|
794
|
+
accentColor: accentColor,
|
|
795
|
+
backgroundColor: backgroundColor,
|
|
796
|
+
clickColor: clickColor,
|
|
797
|
+
language: language,
|
|
798
|
+
enableNfc: enableNfc,
|
|
799
|
+
enableQr: enableQr,
|
|
800
|
+
blockLoaderCustomProperties: parsedBlockLoaderCustomProperties
|
|
801
|
+
)
|
|
802
|
+
DispatchQueue.main.async {
|
|
803
|
+
if(clear){
|
|
804
|
+
self.assentifySdk!.clearFlow();
|
|
805
|
+
}
|
|
806
|
+
if let currentViewController = UIApplication.shared.keyWindow?.rootViewController {
|
|
807
|
+
|
|
808
|
+
self.assentifySdk!.startFlow(
|
|
809
|
+
from: currentViewController,
|
|
810
|
+
flowDelegate: self,
|
|
811
|
+
flowEnvironmentalConditions: flowEnvironmentalConditions
|
|
812
|
+
)
|
|
813
|
+
}
|
|
814
|
+
}
|
|
815
|
+
|
|
816
|
+
|
|
817
|
+
}
|
|
818
|
+
|
|
819
|
+
public func onFlowCompleted(flowData: [FlowCompletedModel]) {
|
|
820
|
+
DispatchQueue.main.async {
|
|
821
|
+
var eventData : [String: Any] = ["DataModel" : self.flowCompletedModelToJsonString(flowData)!,]
|
|
822
|
+
self.sendEvent(withName: "OnNativeFlowCompleted",body : eventData)
|
|
823
|
+
}
|
|
824
|
+
}
|
|
825
|
+
|
|
826
|
+
func flowCompletedModelToJsonString(_ models: [FlowCompletedModel]) -> String? {
|
|
827
|
+
do {
|
|
828
|
+
let encoder = JSONEncoder()
|
|
829
|
+
let data = try encoder.encode(models)
|
|
830
|
+
return String(data: data, encoding: .utf8)
|
|
831
|
+
} catch {
|
|
832
|
+
print("Encoding error: \(error)")
|
|
833
|
+
return nil
|
|
834
|
+
}
|
|
835
|
+
}
|
|
836
|
+
|
|
638
837
|
}
|
|
639
838
|
|
|
640
839
|
extension UIViewController {
|
|
@@ -6,9 +6,10 @@ class PassportScannerView: UIView, ScanPassportDelegate {
|
|
|
6
6
|
//
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
func
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
func onUploadingProgress(progress: Double) {
|
|
10
|
+
// NOTHING TODO
|
|
11
|
+
}
|
|
12
|
+
|
|
12
13
|
|
|
13
14
|
|
|
14
15
|
private var assentifySdk:AssentifySdk?;
|