assentify-sdk-react-native 0.0.42 → 1.0.0-Beta.1
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 -3
- package/android/build.gradle +31 -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 +198 -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 +240 -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 +97 -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 +95 -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 +207 -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,9 @@ 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
|
+
|
|
9
|
+
|
|
8
10
|
|
|
9
11
|
|
|
10
12
|
|
|
@@ -30,7 +32,6 @@ class NativeAssentifySdk: RCTEventEmitter ,AssentifySdkDelegate , SubmitDataDel
|
|
|
30
32
|
performLivenessFace: Bool = false,
|
|
31
33
|
ENV_CustomColor: String = "#f5a103",
|
|
32
34
|
enableDetect: Bool = true,
|
|
33
|
-
enableGuide: Bool = true,
|
|
34
35
|
androidMotionCardLimit: NSNumber,
|
|
35
36
|
androidMotionPassportLimit: NSNumber,
|
|
36
37
|
iOSMotionCardsLimit: NSNumber,
|
|
@@ -41,12 +42,12 @@ class NativeAssentifySdk: RCTEventEmitter ,AssentifySdkDelegate , SubmitDataDel
|
|
|
41
42
|
iOSBrightnessLowThreshold: NSNumber,
|
|
42
43
|
activeLiveType: String,
|
|
43
44
|
activeLivenessCheckCount:NSNumber,
|
|
44
|
-
retryCount:NSNumber,
|
|
45
45
|
faceLivenessRetryCount:NSNumber,
|
|
46
46
|
minRam:NSNumber,
|
|
47
47
|
iOSMinRam:NSNumber,
|
|
48
48
|
minCPUCores:NSNumber,
|
|
49
|
-
manualClickColor:String
|
|
49
|
+
manualClickColor:String,
|
|
50
|
+
countDownNumbersColor: String = "#f5a103",
|
|
50
51
|
) -> Void {
|
|
51
52
|
|
|
52
53
|
if(apiKey.isEmpty || tenantIdentifier.isEmpty || instanceHash.isEmpty ){
|
|
@@ -66,7 +67,6 @@ class NativeAssentifySdk: RCTEventEmitter ,AssentifySdkDelegate , SubmitDataDel
|
|
|
66
67
|
print("\(tag) performLivenessFace: \(performLivenessFace)")
|
|
67
68
|
print("\(tag) ENV_CustomColor: \(ENV_CustomColor)")
|
|
68
69
|
print("\(tag) enableDetect: \(enableDetect)")
|
|
69
|
-
print("\(tag) enableGuide: \(enableGuide)")
|
|
70
70
|
print("\(tag) androidMotionCardLimit: \(androidMotionCardLimit)")
|
|
71
71
|
print("\(tag) androidMotionPassportLimit: \(androidMotionPassportLimit)")
|
|
72
72
|
print("\(tag) iOSMotionCardsLimit: \(iOSMotionCardsLimit)")
|
|
@@ -77,12 +77,12 @@ class NativeAssentifySdk: RCTEventEmitter ,AssentifySdkDelegate , SubmitDataDel
|
|
|
77
77
|
print("\(tag) iOSBrightnessLowThreshold: \(iOSBrightnessLowThreshold)")
|
|
78
78
|
print("\(tag) ActiveLiveType: \(activeLiveType)")
|
|
79
79
|
print("\(tag) ActiveLivenessCheckCount: \(activeLivenessCheckCount)")
|
|
80
|
-
print("\(tag) RetryCount: \(retryCount)")
|
|
81
80
|
print("\(tag) FaceLivenessRetryCount:\(faceLivenessRetryCount)")
|
|
82
81
|
print("\(tag) MinRam: \(minRam)")
|
|
83
82
|
print("\(tag) iOSMinRam:\(iOSMinRam)")
|
|
84
83
|
print("\(tag) MinCPUCores: \(minCPUCores)")
|
|
85
84
|
print("\(tag) ManualClickColor: \(manualClickColor)")
|
|
85
|
+
print("\(tag) CountDownNumbersColor: \(countDownNumbersColor)")
|
|
86
86
|
print("\(tag) ==============================================")
|
|
87
87
|
|
|
88
88
|
|
|
@@ -116,8 +116,7 @@ class NativeAssentifySdk: RCTEventEmitter ,AssentifySdkDelegate , SubmitDataDel
|
|
|
116
116
|
|
|
117
117
|
let environmentalConditions = EnvironmentalConditions(
|
|
118
118
|
enableDetect: enableDetect,
|
|
119
|
-
|
|
120
|
-
CustomColor: "#ffffff",
|
|
119
|
+
CountDownNumbersColor:countDownNumbersColor,
|
|
121
120
|
HoldHandColor: ENV_CustomColor,
|
|
122
121
|
BRIGHTNESS_HIGH_THRESHOLD :Double(iOSBrightnessHighThreshold.intValue),
|
|
123
122
|
BRIGHTNESS_LOW_THRESHOLD:Double(iOSBrightnessLowThreshold.intValue),
|
|
@@ -125,7 +124,6 @@ class NativeAssentifySdk: RCTEventEmitter ,AssentifySdkDelegate , SubmitDataDel
|
|
|
125
124
|
MotionLimitFace: iOSMotionFaceLimit.intValue,
|
|
126
125
|
activeLiveType: typeActive,
|
|
127
126
|
activeLivenessCheckCount:activeLivenessCheckCount.intValue,
|
|
128
|
-
retryCount:retryCount.intValue,
|
|
129
127
|
faceLivenessRetryCount:faceLivenessRetryCount.intValue,
|
|
130
128
|
minRam:iOSMinRam.intValue,
|
|
131
129
|
minCPUCores:minCPUCores.intValue
|
|
@@ -166,7 +164,13 @@ class NativeAssentifySdk: RCTEventEmitter ,AssentifySdkDelegate , SubmitDataDel
|
|
|
166
164
|
self.stepDefinitions = configModel.stepDefinitions;
|
|
167
165
|
self.configModel = configModel;
|
|
168
166
|
|
|
169
|
-
|
|
167
|
+
if let stepId = configModel.stepMap
|
|
168
|
+
.first(where: { $0.stepDefinition == StepsNames.identificationDocumentCapture })?
|
|
169
|
+
.id {
|
|
170
|
+
|
|
171
|
+
templatesByCountry = self.assentifySdk!.getTemplates(stepID: stepId)
|
|
172
|
+
}
|
|
173
|
+
|
|
170
174
|
do {
|
|
171
175
|
let jsonDataTemplates = try JSONEncoder().encode(self.templatesByCountry)
|
|
172
176
|
let jsonStringTemplates = String(decoding: jsonDataTemplates, as: UTF8.self)
|
|
@@ -217,7 +221,9 @@ class NativeAssentifySdk: RCTEventEmitter ,AssentifySdkDelegate , SubmitDataDel
|
|
|
217
221
|
"onSignature",
|
|
218
222
|
"onCompleteQrScan",
|
|
219
223
|
"onStartQrScan",
|
|
220
|
-
"onErrorQrScan"
|
|
224
|
+
"onErrorQrScan",
|
|
225
|
+
"OnNativeFlowCompleted",
|
|
226
|
+
"OnNativeStepCompleted",
|
|
221
227
|
]
|
|
222
228
|
}
|
|
223
229
|
|
|
@@ -249,16 +255,16 @@ class NativeAssentifySdk: RCTEventEmitter ,AssentifySdkDelegate , SubmitDataDel
|
|
|
249
255
|
}
|
|
250
256
|
|
|
251
257
|
|
|
252
|
-
func navigateToIDCardController(
|
|
253
|
-
if(
|
|
258
|
+
func navigateToIDCardController(templatesByCountryObject: String,language: String,flippingCard:Bool,stepID:Int) {
|
|
259
|
+
if(templatesByCountryObject.isEmpty) {
|
|
254
260
|
return;
|
|
255
261
|
}
|
|
256
|
-
|
|
257
|
-
|
|
262
|
+
let jsonData = Data(templatesByCountryObject.utf8)
|
|
263
|
+
let templatesByCountry: TemplatesByCountry = try! JSONDecoder().decode(TemplatesByCountry.self, from: jsonData)
|
|
258
264
|
DispatchQueue.main.async {
|
|
259
265
|
self.timeStarted = self.getTimeUTC();
|
|
260
266
|
if let currentViewController = UIApplication.shared.keyWindow?.rootViewController {
|
|
261
|
-
|
|
267
|
+
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
268
|
stepID: stepID,manualClickColor:self.manualClickColor!)
|
|
263
269
|
viewController.modalPresentationStyle = .fullScreen
|
|
264
270
|
currentViewController.present(viewController, animated: true, completion: nil)
|
|
@@ -267,16 +273,16 @@ class NativeAssentifySdk: RCTEventEmitter ,AssentifySdkDelegate , SubmitDataDel
|
|
|
267
273
|
}
|
|
268
274
|
|
|
269
275
|
|
|
270
|
-
func navigateToQrController(
|
|
271
|
-
if(
|
|
272
|
-
|
|
276
|
+
func navigateToQrController(templatesByCountryObject: String,language: String,stepID:Int) {
|
|
277
|
+
if(templatesByCountryObject.isEmpty) {
|
|
278
|
+
return;
|
|
273
279
|
}
|
|
274
|
-
|
|
275
|
-
|
|
280
|
+
let jsonData = Data(templatesByCountryObject.utf8)
|
|
281
|
+
let templatesByCountry: TemplatesByCountry = try! JSONDecoder().decode(TemplatesByCountry.self, from: jsonData)
|
|
276
282
|
DispatchQueue.main.async {
|
|
277
283
|
self.timeStarted = self.getTimeUTC();
|
|
278
284
|
if let currentViewController = UIApplication.shared.keyWindow?.rootViewController {
|
|
279
|
-
let viewController = QrController(assentifySdk: self.assentifySdk!,nativeAssentifySdk: self,holdHandColor: self.holdHandColor!,processingColor: self.processingColor!,
|
|
285
|
+
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
286
|
stepID: stepID,manualClickColor:self.manualClickColor!)
|
|
281
287
|
viewController.modalPresentationStyle = .fullScreen
|
|
282
288
|
currentViewController.present(viewController, animated: true, completion: nil)
|
|
@@ -324,15 +330,15 @@ class NativeAssentifySdk: RCTEventEmitter ,AssentifySdkDelegate , SubmitDataDel
|
|
|
324
330
|
}
|
|
325
331
|
|
|
326
332
|
@objc
|
|
327
|
-
func startScanIDPage(_
|
|
333
|
+
func startScanIDPage(_ templatesByCountryObject: String ,language: String,flippingCard:Bool,stepID:NSNumber) {
|
|
328
334
|
let stepIDValue = stepID.intValue
|
|
329
|
-
navigateToIDCardController(
|
|
335
|
+
navigateToIDCardController(templatesByCountryObject: templatesByCountryObject,language:language,flippingCard:flippingCard,stepID:stepIDValue)
|
|
330
336
|
}
|
|
331
337
|
|
|
332
338
|
@objc
|
|
333
|
-
func startScanQrPage(_
|
|
339
|
+
func startScanQrPage(_ templatesByCountryObject: String ,language: String,stepID:NSNumber) {
|
|
334
340
|
let stepIDValue = stepID.intValue
|
|
335
|
-
navigateToQrController(
|
|
341
|
+
navigateToQrController(templatesByCountryObject: templatesByCountryObject,language:language,stepID:stepIDValue)
|
|
336
342
|
}
|
|
337
343
|
|
|
338
344
|
@objc
|
|
@@ -574,18 +580,17 @@ class NativeAssentifySdk: RCTEventEmitter ,AssentifySdkDelegate , SubmitDataDel
|
|
|
574
580
|
|
|
575
581
|
@objc
|
|
576
582
|
func startContextAwareSigning() {
|
|
577
|
-
contextAwareSigning = assentifySdk?.startContextAwareSigning(contextAwareDelegate: self)
|
|
583
|
+
// contextAwareSigning = assentifySdk?.startContextAwareSigning(contextAwareDelegate: self)
|
|
578
584
|
}
|
|
579
585
|
|
|
580
586
|
@objc
|
|
581
587
|
func createUserDocumentInstance(_ data: [String: String]) {
|
|
582
|
-
contextAwareSigning?.createUserDocumentInstance(data: data);
|
|
588
|
+
// contextAwareSigning?.createUserDocumentInstance(data: data);
|
|
583
589
|
}
|
|
584
590
|
|
|
585
591
|
@objc
|
|
586
592
|
func signature(_ signature: String) {
|
|
587
|
-
contextAwareSigning?.signature(
|
|
588
|
-
documentId: signatureResponseModel!.documentId,documentInstanceId: signatureResponseModel!.templateInstanceId, signature:signature)
|
|
593
|
+
// contextAwareSigning?.signature(documentId: signatureResponseModel!.documentId,documentInstanceId: signatureResponseModel!.templateInstanceId,signature:signature)
|
|
589
594
|
}
|
|
590
595
|
|
|
591
596
|
func onHasTokens(documentTokens: [DocumentTokensModel]) {
|
|
@@ -635,6 +640,211 @@ class NativeAssentifySdk: RCTEventEmitter ,AssentifySdkDelegate , SubmitDataDel
|
|
|
635
640
|
func onError(message: String) {
|
|
636
641
|
///
|
|
637
642
|
}
|
|
643
|
+
|
|
644
|
+
|
|
645
|
+
@objc
|
|
646
|
+
func startFlow(
|
|
647
|
+
_ logoUrl: String,
|
|
648
|
+
svgBackgroundImageUrl: String,
|
|
649
|
+
textColor: String,
|
|
650
|
+
secondaryTextColor: String,
|
|
651
|
+
backgroundCardColor: String,
|
|
652
|
+
accentColor: String,
|
|
653
|
+
backgroundColors: [String],
|
|
654
|
+
clickColors: [String],
|
|
655
|
+
angleDegreesBackgroundColors: NSNumber,
|
|
656
|
+
holdUntilBackgroundColors: NSNumber,
|
|
657
|
+
angleDegreesClickColors: NSNumber,
|
|
658
|
+
holdUntilClickColors: NSNumber,
|
|
659
|
+
backgroundType: String,
|
|
660
|
+
clear: Bool,
|
|
661
|
+
language: String,
|
|
662
|
+
enableNfc: Bool,
|
|
663
|
+
enableQr: Bool,
|
|
664
|
+
blockLoaderCustomProperties: String
|
|
665
|
+
) {
|
|
666
|
+
navToFlow(
|
|
667
|
+
logoUrl:logoUrl,
|
|
668
|
+
svgBackgroundImageUrl: svgBackgroundImageUrl,
|
|
669
|
+
textColor: textColor,
|
|
670
|
+
secondaryTextColor: secondaryTextColor,
|
|
671
|
+
backgroundCardColor: backgroundCardColor,
|
|
672
|
+
accentColor: accentColor,
|
|
673
|
+
backgroundColors: backgroundColors,
|
|
674
|
+
clickColors: clickColors,
|
|
675
|
+
angleDegreesBackgroundColors: angleDegreesBackgroundColors,
|
|
676
|
+
holdUntilBackgroundColors: holdUntilBackgroundColors,
|
|
677
|
+
angleDegreesClickColors: angleDegreesClickColors,
|
|
678
|
+
holdUntilClickColors: holdUntilClickColors,
|
|
679
|
+
backgroundType: backgroundType,
|
|
680
|
+
clear: clear,
|
|
681
|
+
language: language,
|
|
682
|
+
enableNfc: enableNfc,
|
|
683
|
+
enableQr: enableQr,
|
|
684
|
+
blockLoaderCustomProperties: blockLoaderCustomProperties
|
|
685
|
+
)
|
|
686
|
+
}
|
|
687
|
+
|
|
688
|
+
|
|
689
|
+
|
|
690
|
+
|
|
691
|
+
func navToFlow(
|
|
692
|
+
logoUrl: String,
|
|
693
|
+
svgBackgroundImageUrl: String,
|
|
694
|
+
textColor: String,
|
|
695
|
+
secondaryTextColor: String,
|
|
696
|
+
backgroundCardColor: String,
|
|
697
|
+
accentColor: String,
|
|
698
|
+
backgroundColors: [String],
|
|
699
|
+
clickColors: [String],
|
|
700
|
+
angleDegreesBackgroundColors: NSNumber,
|
|
701
|
+
holdUntilBackgroundColors: NSNumber,
|
|
702
|
+
angleDegreesClickColors: NSNumber,
|
|
703
|
+
holdUntilClickColors: NSNumber,
|
|
704
|
+
backgroundType: String,
|
|
705
|
+
clear: Bool,
|
|
706
|
+
language: String,
|
|
707
|
+
enableNfc: Bool,
|
|
708
|
+
enableQr: Bool,
|
|
709
|
+
blockLoaderCustomProperties: String
|
|
710
|
+
) {
|
|
711
|
+
|
|
712
|
+
let angleBg = angleDegreesBackgroundColors.floatValue
|
|
713
|
+
let holdBg = holdUntilBackgroundColors.floatValue
|
|
714
|
+
let angleClick = angleDegreesClickColors.floatValue
|
|
715
|
+
let holdClick = holdUntilClickColors.floatValue
|
|
716
|
+
|
|
717
|
+
var parsedBlockLoaderCustomProperties: [String: Any] = [:]
|
|
718
|
+
|
|
719
|
+
if let data = blockLoaderCustomProperties.data(using: .utf8) {
|
|
720
|
+
do {
|
|
721
|
+
if let dict = try JSONSerialization.jsonObject(with: data, options: []) as? [String: Any] {
|
|
722
|
+
parsedBlockLoaderCustomProperties = dict
|
|
723
|
+
}
|
|
724
|
+
} catch {
|
|
725
|
+
print("Failed to parse blockLoaderCustomProperties: \(error)")
|
|
726
|
+
}
|
|
727
|
+
}
|
|
728
|
+
|
|
729
|
+
let tag = "FlowActivity"
|
|
730
|
+
|
|
731
|
+
print("\(tag) ===== Received Extras =====")
|
|
732
|
+
print("\(tag) logoUrl: \(logoUrl)")
|
|
733
|
+
print("\(tag) svgBackgroundImageUrl: \(svgBackgroundImageUrl)")
|
|
734
|
+
print("\(tag) textColor: \(textColor)")
|
|
735
|
+
print("\(tag) secondaryTextColor: \(secondaryTextColor)")
|
|
736
|
+
print("\(tag) backgroundCardColor: \(backgroundCardColor)")
|
|
737
|
+
print("\(tag) accentColor: \(accentColor)")
|
|
738
|
+
print("\(tag) backgroundType: \(backgroundType)")
|
|
739
|
+
print("\(tag) backgroundColors: \(backgroundColors)")
|
|
740
|
+
print("\(tag) angleDegreesBackgroundColors: \(angleBg)")
|
|
741
|
+
print("\(tag) holdUntilBackgroundColors: \(holdBg)")
|
|
742
|
+
print("\(tag) clickColors: \(clickColors)")
|
|
743
|
+
print("\(tag) angleDegreesClickColors: \(angleClick)")
|
|
744
|
+
print("\(tag) holdUntilClickColors: \(holdClick)")
|
|
745
|
+
print("\(tag) language: \(language)")
|
|
746
|
+
print("\(tag) enableNfc: \(enableNfc)")
|
|
747
|
+
print("\(tag) enableQr: \(enableQr)")
|
|
748
|
+
print("\(tag) clear: \(clear)")
|
|
749
|
+
print("\(tag) blockLoaderCustomProperties: \(parsedBlockLoaderCustomProperties)")
|
|
750
|
+
print("\(tag) =================================")
|
|
751
|
+
|
|
752
|
+
let bType: BackgroundType = {
|
|
753
|
+
switch backgroundType.lowercased() {
|
|
754
|
+
case "image":
|
|
755
|
+
return .image
|
|
756
|
+
case "color":
|
|
757
|
+
return .color
|
|
758
|
+
default:
|
|
759
|
+
return .color
|
|
760
|
+
}
|
|
761
|
+
}()
|
|
762
|
+
|
|
763
|
+
var backgroundColor: BackgroundStyle? = nil
|
|
764
|
+
var clickColor: BackgroundStyle? = nil
|
|
765
|
+
|
|
766
|
+
if !backgroundColors.isEmpty {
|
|
767
|
+
if backgroundColors.count >= 2 {
|
|
768
|
+
backgroundColor = .gradient(
|
|
769
|
+
colorsHex: backgroundColors,
|
|
770
|
+
angleDegrees: CGFloat(angleBg),
|
|
771
|
+
holdUntil: CGFloat(holdBg)
|
|
772
|
+
)
|
|
773
|
+
} else if let first = backgroundColors.first {
|
|
774
|
+
backgroundColor = .solid(hex: first)
|
|
775
|
+
}
|
|
776
|
+
}
|
|
777
|
+
|
|
778
|
+
if !clickColors.isEmpty {
|
|
779
|
+
if clickColors.count >= 2 {
|
|
780
|
+
clickColor = .gradient(
|
|
781
|
+
colorsHex: clickColors,
|
|
782
|
+
angleDegrees: CGFloat(angleClick),
|
|
783
|
+
holdUntil: CGFloat(holdClick)
|
|
784
|
+
)
|
|
785
|
+
} else if let first = clickColors.first {
|
|
786
|
+
clickColor = .solid(hex: first)
|
|
787
|
+
}
|
|
788
|
+
}
|
|
789
|
+
|
|
790
|
+
let flowEnvironmentalConditions = FlowEnvironmentalConditions(
|
|
791
|
+
backgroundType: bType,
|
|
792
|
+
logoUrl: logoUrl,
|
|
793
|
+
svgBackgroundImageUrl: svgBackgroundImageUrl,
|
|
794
|
+
textColor: textColor,
|
|
795
|
+
secondaryTextColor: secondaryTextColor,
|
|
796
|
+
backgroundCardColor: backgroundCardColor,
|
|
797
|
+
accentColor: accentColor,
|
|
798
|
+
backgroundColor: backgroundColor,
|
|
799
|
+
clickColor: clickColor,
|
|
800
|
+
language: language,
|
|
801
|
+
enableNfc: enableNfc,
|
|
802
|
+
enableQr: enableQr,
|
|
803
|
+
blockLoaderCustomProperties: parsedBlockLoaderCustomProperties
|
|
804
|
+
)
|
|
805
|
+
DispatchQueue.main.async {
|
|
806
|
+
if(clear){
|
|
807
|
+
self.assentifySdk!.clearFlow();
|
|
808
|
+
}
|
|
809
|
+
if let currentViewController = UIApplication.shared.keyWindow?.rootViewController {
|
|
810
|
+
|
|
811
|
+
self.assentifySdk!.startFlow(
|
|
812
|
+
from: currentViewController,
|
|
813
|
+
flowDelegate: self,
|
|
814
|
+
flowEnvironmentalConditions: flowEnvironmentalConditions
|
|
815
|
+
)
|
|
816
|
+
}
|
|
817
|
+
}
|
|
818
|
+
|
|
819
|
+
|
|
820
|
+
}
|
|
821
|
+
|
|
822
|
+
public func onFlowCompleted(flowData: [FlowCompletedModel]) {
|
|
823
|
+
DispatchQueue.main.async {
|
|
824
|
+
var eventData : [String: Any] = ["DataModel" : self.flowCompletedModelToJsonString(flowData)!,]
|
|
825
|
+
self.sendEvent(withName: "OnNativeFlowCompleted",body : eventData)
|
|
826
|
+
}
|
|
827
|
+
}
|
|
828
|
+
|
|
829
|
+
|
|
830
|
+
public func onStepCompleted(stepModel: FlowCompletedModel) {
|
|
831
|
+
DispatchQueue.main.async {
|
|
832
|
+
var eventData : [String: Any] = ["DataModel" : self.flowCompletedModelToJsonString([stepModel])!,]
|
|
833
|
+
self.sendEvent(withName: "OnNativeStepCompleted",body : eventData)
|
|
834
|
+
}
|
|
835
|
+
}
|
|
836
|
+
|
|
837
|
+
func flowCompletedModelToJsonString(_ models: [FlowCompletedModel]) -> String? {
|
|
838
|
+
do {
|
|
839
|
+
let encoder = JSONEncoder()
|
|
840
|
+
let data = try encoder.encode(models)
|
|
841
|
+
return String(data: data, encoding: .utf8)
|
|
842
|
+
} catch {
|
|
843
|
+
print("Encoding error: \(error)")
|
|
844
|
+
return nil
|
|
845
|
+
}
|
|
846
|
+
}
|
|
847
|
+
|
|
638
848
|
}
|
|
639
849
|
|
|
640
850
|
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?;
|