assentify-sdk-react-native 0.0.32 → 0.0.34
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 +7 -0
- package/android/build.gradle +3 -1
- package/android/src/main/java/com/assentifysdk/AssentifySdkModule.kt +26 -3
- package/android/src/main/java/com/assentifysdk/FaceMatchActivity.kt +78 -20
- package/android/src/main/java/com/assentifysdk/ScanIDActivity.kt +194 -67
- package/android/src/main/java/com/assentifysdk/ScanOtherActivity.kt +80 -19
- package/android/src/main/java/com/assentifysdk/ScanPassportActivity.kt +79 -23
- package/android/src/main/res/drawable/button_rounded_background.xml +4 -4
- package/android/src/main/res/layout/activity_face_scan.xml +234 -219
- package/android/src/main/res/layout/activity_scan.xml +116 -0
- package/assentify-sdk.podspec +1 -1
- package/ios/NativeAssentifySdk.mm +6 -0
- package/ios/NativeAssentifySdk.swift +24 -7
- package/ios/UIComponents/RNPassportScanner.swift +4 -0
- package/ios/View/FaceMatchController.swift +49 -8
- package/ios/View/IDCardController.swift +104 -25
- package/ios/View/OtherController.swift +49 -11
- package/ios/View/PassportController.swift +57 -13
- package/ios/View/UI.swift +192 -36
- package/lib/commonjs/AssentifyProvider.js +12 -4
- package/lib/commonjs/AssentifyProvider.js.map +1 -1
- package/lib/commonjs/AssentifyWrapper.js +2 -2
- package/lib/commonjs/AssentifyWrapper.js.map +1 -1
- package/lib/commonjs/DoneFlags.js +14 -0
- package/lib/commonjs/DoneFlags.js.map +1 -0
- package/lib/commonjs/index.js +12 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/AssentifyProvider.js +12 -4
- package/lib/module/AssentifyProvider.js.map +1 -1
- package/lib/module/AssentifyWrapper.js +2 -2
- package/lib/module/AssentifyWrapper.js.map +1 -1
- package/lib/module/DoneFlags.js +8 -0
- package/lib/module/DoneFlags.js.map +1 -0
- package/lib/module/index.js +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/example/src/Home.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/AssentifyProvider.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/AssentifyWrapper.d.ts +1 -1
- package/lib/typescript/lib/commonjs/AssentifyWrapper.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/DoneFlags.d.ts +9 -0
- package/lib/typescript/lib/commonjs/DoneFlags.d.ts.map +1 -0
- package/lib/typescript/lib/module/AssentifyProvider.d.ts.map +1 -1
- package/lib/typescript/lib/module/AssentifyWrapper.d.ts +1 -1
- package/lib/typescript/lib/module/AssentifyWrapper.d.ts.map +1 -1
- package/lib/typescript/lib/module/DoneFlags.d.ts +8 -0
- package/lib/typescript/lib/module/DoneFlags.d.ts.map +1 -0
- package/lib/typescript/lib/module/index.d.ts +2 -1
- package/lib/typescript/lib/module/index.d.ts.map +1 -1
- package/lib/typescript/src/AssentifyProvider.d.ts.map +1 -1
- package/lib/typescript/src/AssentifyWrapper.d.ts +1 -1
- package/lib/typescript/src/AssentifyWrapper.d.ts.map +1 -1
- package/lib/typescript/src/DoneFlags.d.ts +9 -0
- package/lib/typescript/src/DoneFlags.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +2 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/AssentifyProvider.tsx +11 -4
- package/src/AssentifyWrapper.ts +13 -1
- package/src/DoneFlags.ts +11 -0
- package/src/index.ts +1 -0
|
@@ -14,6 +14,7 @@ class NativeAssentifySdk: RCTEventEmitter ,AssentifySdkDelegate , SubmitDataDel
|
|
|
14
14
|
private var configModel :ConfigModel?
|
|
15
15
|
private var timeStarted :String?
|
|
16
16
|
private var holdHandColor: String?;
|
|
17
|
+
private var manualClickColor: String?;
|
|
17
18
|
private var processingColor: String?;
|
|
18
19
|
private var templatesByCountry: [TemplatesByCountry]?;
|
|
19
20
|
private var apiKey:String?;
|
|
@@ -44,8 +45,13 @@ class NativeAssentifySdk: RCTEventEmitter ,AssentifySdkDelegate , SubmitDataDel
|
|
|
44
45
|
iOSBrightnessHighThreshold: NSNumber,
|
|
45
46
|
iOSBrightnessLowThreshold: NSNumber,
|
|
46
47
|
activeLiveType: String,
|
|
47
|
-
activeLivenessCheckCount:NSNumber
|
|
48
|
-
|
|
48
|
+
activeLivenessCheckCount:NSNumber,
|
|
49
|
+
retryCount:NSNumber,
|
|
50
|
+
faceLivenessRetryCount:NSNumber,
|
|
51
|
+
minRam:NSNumber,
|
|
52
|
+
iOSMinRam:NSNumber,
|
|
53
|
+
minCPUCores:NSNumber,
|
|
54
|
+
manualClickColor:String
|
|
49
55
|
) -> Void {
|
|
50
56
|
|
|
51
57
|
if(apiKey.isEmpty || tenantIdentifier.isEmpty || instanceHash.isEmpty ){
|
|
@@ -81,6 +87,12 @@ class NativeAssentifySdk: RCTEventEmitter ,AssentifySdkDelegate , SubmitDataDel
|
|
|
81
87
|
print("\(tag) iOSBrightnessLowThreshold: \(iOSBrightnessLowThreshold)")
|
|
82
88
|
print("\(tag) ActiveLiveType: \(activeLiveType)")
|
|
83
89
|
print("\(tag) ActiveLivenessCheckCount: \(activeLivenessCheckCount)")
|
|
90
|
+
print("\(tag) RetryCount: \(retryCount)")
|
|
91
|
+
print("\(tag) FaceLivenessRetryCount:\(faceLivenessRetryCount)")
|
|
92
|
+
print("\(tag) MinRam: \(minRam)")
|
|
93
|
+
print("\(tag) iOSMinRam:\(iOSMinRam)")
|
|
94
|
+
print("\(tag) MinCPUCores: \(minCPUCores)")
|
|
95
|
+
print("\(tag) ManualClickColor: \(manualClickColor)")
|
|
84
96
|
print("\(tag) ==============================================")
|
|
85
97
|
|
|
86
98
|
|
|
@@ -122,10 +134,15 @@ class NativeAssentifySdk: RCTEventEmitter ,AssentifySdkDelegate , SubmitDataDel
|
|
|
122
134
|
MotionLimit: iOSMotionCardsLimit.intValue,
|
|
123
135
|
MotionLimitFace: iOSMotionFaceLimit.intValue,
|
|
124
136
|
activeLiveType: typeActive,
|
|
125
|
-
activeLivenessCheckCount:activeLivenessCheckCount.intValue
|
|
137
|
+
activeLivenessCheckCount:activeLivenessCheckCount.intValue,
|
|
138
|
+
retryCount:retryCount.intValue,
|
|
139
|
+
faceLivenessRetryCount:faceLivenessRetryCount.intValue,
|
|
140
|
+
minRam:iOSMinRam.intValue,
|
|
141
|
+
minCPUCores:minCPUCores.intValue
|
|
126
142
|
)
|
|
127
143
|
|
|
128
144
|
self.holdHandColor = ENV_CustomColor;
|
|
145
|
+
self.manualClickColor = manualClickColor;
|
|
129
146
|
self.processingColor = "#ffffff";
|
|
130
147
|
|
|
131
148
|
|
|
@@ -223,7 +240,7 @@ class NativeAssentifySdk: RCTEventEmitter ,AssentifySdkDelegate , SubmitDataDel
|
|
|
223
240
|
self.timeStarted = self.getTimeUTC();
|
|
224
241
|
if let currentViewController = UIViewController.currentViewController {
|
|
225
242
|
let viewController = PassportController(assentifySdk: self.assentifySdk!,nativeAssentifySdk: self,holdHandColor:self.holdHandColor!,processingColor: self.processingColor!,language: language,showCountDown: true,apiKey: self.apiKey!,
|
|
226
|
-
stepID: stepID)
|
|
243
|
+
stepID: stepID,manualClickColor:self.manualClickColor!)
|
|
227
244
|
viewController.modalPresentationStyle = .fullScreen
|
|
228
245
|
currentViewController.present(viewController, animated: true, completion: nil)
|
|
229
246
|
}
|
|
@@ -236,7 +253,7 @@ class NativeAssentifySdk: RCTEventEmitter ,AssentifySdkDelegate , SubmitDataDel
|
|
|
236
253
|
self.timeStarted = self.getTimeUTC();
|
|
237
254
|
if let currentViewController = UIViewController.currentViewController {
|
|
238
255
|
let viewController = OtherController(assentifySdk: self.assentifySdk!,nativeAssentifySdk: self,holdHandColor:self.holdHandColor!,processingColor: self.processingColor!,language: language,showCountDown: true,apiKey: self.apiKey!,
|
|
239
|
-
stepID: stepID)
|
|
256
|
+
stepID: stepID,manualClickColor:self.manualClickColor!)
|
|
240
257
|
viewController.modalPresentationStyle = .fullScreen
|
|
241
258
|
currentViewController.present(viewController, animated: true, completion: nil)
|
|
242
259
|
}
|
|
@@ -254,7 +271,7 @@ class NativeAssentifySdk: RCTEventEmitter ,AssentifySdkDelegate , SubmitDataDel
|
|
|
254
271
|
self.timeStarted = self.getTimeUTC();
|
|
255
272
|
if let currentViewController = UIApplication.shared.keyWindow?.rootViewController {
|
|
256
273
|
let viewController = IDCardController(assentifySdk: self.assentifySdk!,nativeAssentifySdk: self,holdHandColor: self.holdHandColor!,processingColor: self.processingColor!,kycDocumentDetails: kycDocumentDetails,language:language,flippingCard: flippingCard,titleID:self.getIdTitle(kycDocumentDetails:kycDocumentDetails ), showCountDown: true,apiKey: self.apiKey!,
|
|
257
|
-
stepID: stepID)
|
|
274
|
+
stepID: stepID,manualClickColor:self.manualClickColor!)
|
|
258
275
|
viewController.modalPresentationStyle = .fullScreen
|
|
259
276
|
currentViewController.present(viewController, animated: true, completion: nil)
|
|
260
277
|
}
|
|
@@ -274,7 +291,7 @@ class NativeAssentifySdk: RCTEventEmitter ,AssentifySdkDelegate , SubmitDataDel
|
|
|
274
291
|
processingColor: self.processingColor!,
|
|
275
292
|
secondImage:base64String!,
|
|
276
293
|
showCountDown: showCountDown,
|
|
277
|
-
stepID: stepID
|
|
294
|
+
stepID: stepID,manualClickColor:self.manualClickColor!
|
|
278
295
|
)
|
|
279
296
|
viewController.modalPresentationStyle = .fullScreen
|
|
280
297
|
currentViewController.present(viewController, animated: true, completion: nil)
|
|
@@ -18,19 +18,22 @@ class FaceMAtchController: UIViewController ,FaceMatchDelegate
|
|
|
18
18
|
var popUpMessage : UIView?;
|
|
19
19
|
private var holdHandColor: String;
|
|
20
20
|
private var processingColor: String;
|
|
21
|
+
private var manualClickColor: String;
|
|
21
22
|
private var showCountDown: Bool = true;
|
|
22
23
|
private var faceMatch: FaceMatch?;
|
|
23
24
|
private var stepID:Int;
|
|
24
25
|
private var currentActiveLiveEvents: ActiveLiveEvents? = ActiveLiveEvents.GOOD;
|
|
26
|
+
private var takePhotoButton: UIButton?;
|
|
25
27
|
|
|
26
28
|
|
|
27
|
-
|
|
29
|
+
init(assentifySdk: AssentifySdk, nativeAssentifySdk:NativeAssentifySdk?,holdHandColor: String,processingColor: String,secondImage:String,showCountDown:Bool,stepID:Int,manualClickColor:String) {
|
|
28
30
|
self.assentifySdk = assentifySdk
|
|
29
31
|
self.holdHandColor = holdHandColor
|
|
30
32
|
self.processingColor = processingColor
|
|
31
33
|
self.secondImage = secondImage
|
|
32
34
|
self.nativeAssentifySdk = nativeAssentifySdk
|
|
33
35
|
self.showCountDown = showCountDown
|
|
36
|
+
self.manualClickColor = manualClickColor
|
|
34
37
|
self.stepID = stepID;
|
|
35
38
|
super.init(nibName: nil, bundle: nil)
|
|
36
39
|
}
|
|
@@ -60,10 +63,31 @@ class FaceMAtchController: UIViewController ,FaceMatchDelegate
|
|
|
60
63
|
self.faceMatch!.view.bottomAnchor.constraint(equalTo: self.view.bottomAnchor),
|
|
61
64
|
])
|
|
62
65
|
self.faceMatch!.didMove(toParent: self)
|
|
63
|
-
|
|
66
|
+
|
|
64
67
|
showNavigationBarWithBackArrow(view: self.view, target: self, action: #selector(self.backButtonTapped), initialTextColorHex:self.processingColor,initialBackgroundColorHex:self.holdHandColor,title: "Face Capture")
|
|
68
|
+
|
|
69
|
+
if(self.assentifySdk!.isManual()){
|
|
70
|
+
self.takePhotoButton = createTakePhotoButton(initialTextColorHex: self.manualClickColor, target: self, action: #selector(self.takePhoteTapped))
|
|
71
|
+
self.view.addSubview(self.takePhotoButton!)
|
|
72
|
+
|
|
73
|
+
NSLayoutConstraint.activate([
|
|
74
|
+
self.takePhotoButton!.centerXAnchor.constraint(equalTo: self.view.centerXAnchor),
|
|
75
|
+
self.takePhotoButton!.bottomAnchor.constraint(equalTo: self.view.safeAreaLayoutGuide.bottomAnchor, constant: -30),
|
|
76
|
+
self.takePhotoButton!.widthAnchor.constraint(equalToConstant: 300),
|
|
77
|
+
self.takePhotoButton!.heightAnchor.constraint(equalToConstant: 50)
|
|
78
|
+
])
|
|
79
|
+
|
|
80
|
+
}else{
|
|
81
|
+
(self.infoLabel, self.infoImage) = showInfo(view: self.view, text: "Please face within circle",initialTextColorHex:self.processingColor,initialBackgroundColorHex:self.holdHandColor,initialImageName:"info_icon")
|
|
82
|
+
}
|
|
65
83
|
}
|
|
66
84
|
}
|
|
85
|
+
|
|
86
|
+
@objc func takePhoteTapped() {
|
|
87
|
+
DispatchQueue.main.async {
|
|
88
|
+
self.faceMatch?.takePicture();
|
|
89
|
+
}
|
|
90
|
+
}
|
|
67
91
|
@objc func backButtonTapped() {
|
|
68
92
|
triggerEvent(eventName:"onBackClick",dataModel:nil)
|
|
69
93
|
DispatchQueue.main.async {
|
|
@@ -94,7 +118,9 @@ class FaceMAtchController: UIViewController ,FaceMatchDelegate
|
|
|
94
118
|
DispatchQueue.main.async {
|
|
95
119
|
if(!self.start){
|
|
96
120
|
self.popUpMessage!.removeFromSuperview();
|
|
121
|
+
if(!self.assentifySdk!.isManual()){
|
|
97
122
|
(self.infoLabel, self.infoImage) = showInfo(view: self.view, text: "Please face within circle",initialTextColorHex:self.processingColor,initialBackgroundColorHex:self.holdHandColor,initialImageName:"info_icon")
|
|
123
|
+
}
|
|
98
124
|
}
|
|
99
125
|
}
|
|
100
126
|
|
|
@@ -116,7 +142,7 @@ class FaceMAtchController: UIViewController ,FaceMatchDelegate
|
|
|
116
142
|
DispatchQueue.main.async {
|
|
117
143
|
self.start = false;
|
|
118
144
|
self.popUpMessage!.removeFromSuperview();
|
|
119
|
-
self.popUpMessage = showPopUpMessage(view: self.view, title: "Please check your
|
|
145
|
+
self.popUpMessage = showPopUpMessage(view: self.view, title: "Your internet connection seems unstable. Please check your connection and try again.", subTitle: "Let's try again",initialTextColorHex:self.processingColor,initialBackgroundColorHex:self.holdHandColor, iconName: "warning", isGif: false,target: self, action: #selector(self.dismissPopUpMessage))
|
|
120
146
|
}
|
|
121
147
|
}
|
|
122
148
|
|
|
@@ -125,7 +151,9 @@ class FaceMAtchController: UIViewController ,FaceMatchDelegate
|
|
|
125
151
|
triggerEvent(eventName:"onRetry",dataModel:dataModel)
|
|
126
152
|
DispatchQueue.main.async {
|
|
127
153
|
self.start = false;
|
|
154
|
+
if( self.popUpMessage != nil){
|
|
128
155
|
self.popUpMessage!.removeFromSuperview();
|
|
156
|
+
}
|
|
129
157
|
self.popUpMessage = showPopUpMessage(view: self.view, title: "We couldn't complete your request", subTitle: "Let's try again",initialTextColorHex:self.processingColor,initialBackgroundColorHex:self.holdHandColor, iconName: "warning", isGif: false,target: self, action: #selector(self.dismissPopUpMessage))
|
|
130
158
|
}
|
|
131
159
|
}
|
|
@@ -135,7 +163,7 @@ class FaceMAtchController: UIViewController ,FaceMatchDelegate
|
|
|
135
163
|
DispatchQueue.main.async {
|
|
136
164
|
self.start = false;
|
|
137
165
|
self.popUpMessage!.removeFromSuperview();
|
|
138
|
-
self.popUpMessage = showPopUpMessage(view: self.view, title: "
|
|
166
|
+
self.popUpMessage = showPopUpMessage(view: self.view, title: "Please make sure your face is well lit, look directly at the camera, and avoid using photos or videos.", subTitle: "Let's try again",initialTextColorHex:self.processingColor,initialBackgroundColorHex:self.holdHandColor, iconName: "warning", isGif: false,target: self, action: #selector(self.dismissPopUpMessage))
|
|
139
167
|
}
|
|
140
168
|
}
|
|
141
169
|
|
|
@@ -154,7 +182,7 @@ class FaceMAtchController: UIViewController ,FaceMatchDelegate
|
|
|
154
182
|
|
|
155
183
|
|
|
156
184
|
|
|
157
|
-
|
|
185
|
+
func onComplete(dataModel: FaceResponseModel,doneFlag:DoneFlags) {
|
|
158
186
|
|
|
159
187
|
if let outputProperties = try? JSONSerialization.data(withJSONObject: dataModel.faceExtractedModel?.outputProperties, options: []) {
|
|
160
188
|
if UserDefaults.standard.object(forKey: String(self.stepID)) != nil {
|
|
@@ -163,7 +191,7 @@ class FaceMAtchController: UIViewController ,FaceMatchDelegate
|
|
|
163
191
|
UserDefaults.standard.set(nil, forKey:String(self.stepID))
|
|
164
192
|
UserDefaults.standard.set(outputProperties, forKey: String(self.stepID))
|
|
165
193
|
}
|
|
166
|
-
triggerCompleteEvent(eventName:"onComplete",dataModel:dataModel.faceExtractedModel)
|
|
194
|
+
triggerCompleteEvent(eventName:"onComplete",dataModel:dataModel.faceExtractedModel,doneFlag:doneFlag)
|
|
167
195
|
|
|
168
196
|
DispatchQueue.main.async {
|
|
169
197
|
self.faceMatch?.stopScanning()
|
|
@@ -344,11 +372,24 @@ class FaceMAtchController: UIViewController ,FaceMatchDelegate
|
|
|
344
372
|
|
|
345
373
|
}
|
|
346
374
|
|
|
347
|
-
func triggerCompleteEvent(eventName:String, dataModel: FaceExtractedModel
|
|
375
|
+
func triggerCompleteEvent(eventName:String, dataModel: FaceExtractedModel?,doneFlag:DoneFlags){
|
|
348
376
|
var eventResultMap: [String: Any] = [:]
|
|
349
377
|
if(dataModel != nil){
|
|
350
378
|
|
|
351
|
-
|
|
379
|
+
var doneFlagValue = "";
|
|
380
|
+
switch doneFlag {
|
|
381
|
+
case .Success:
|
|
382
|
+
doneFlagValue = "Success";
|
|
383
|
+
case .LivenessFailed:
|
|
384
|
+
doneFlagValue = "LivenessFailed";
|
|
385
|
+
case .ExtractFailed:
|
|
386
|
+
doneFlagValue = "ExtractFailed";
|
|
387
|
+
case .MatchFailed:
|
|
388
|
+
doneFlagValue = "MatchFailed";
|
|
389
|
+
case .WrongTemplate:
|
|
390
|
+
doneFlagValue = "WrongTemplate";
|
|
391
|
+
}
|
|
392
|
+
eventResultMap = ["FaceMatchDataModel": faceModelToJsonString(dataModel: dataModel) as Any,"DoneFlag":doneFlagValue]
|
|
352
393
|
}
|
|
353
394
|
DispatchQueue.main.async {
|
|
354
395
|
self.nativeAssentifySdk?.sendEvent(withName: eventName, body: eventResultMap)
|
|
@@ -25,9 +25,11 @@ class IDCardController: UIViewController ,ScanIDCardDelegate , ChildViewControll
|
|
|
25
25
|
private var outputResultProperties: [String: Any]? = [:];
|
|
26
26
|
private var scanID:ScanIDCard?;
|
|
27
27
|
private var stepID:Int;
|
|
28
|
+
private var manualClickColor: String;
|
|
29
|
+
private var takePhotoButton: UIButton?;
|
|
30
|
+
private var backIDPage: UIView?;
|
|
28
31
|
|
|
29
|
-
|
|
30
|
-
init(assentifySdk: AssentifySdk,nativeAssentifySdk:NativeAssentifySdk,holdHandColor: String,processingColor: String,kycDocumentDetails:[KycDocumentDetails],language:String,flippingCard:Bool,titleID:String,showCountDown:Bool,apiKey:String,stepID:Int) {
|
|
32
|
+
init(assentifySdk: AssentifySdk,nativeAssentifySdk:NativeAssentifySdk,holdHandColor: String,processingColor: String,kycDocumentDetails:[KycDocumentDetails],language:String,flippingCard:Bool,titleID:String,showCountDown:Bool,apiKey:String,stepID:Int,manualClickColor:String) {
|
|
31
33
|
self.assentifySdk = assentifySdk
|
|
32
34
|
self.nativeAssentifySdk = nativeAssentifySdk
|
|
33
35
|
self.holdHandColor = holdHandColor
|
|
@@ -39,6 +41,7 @@ class IDCardController: UIViewController ,ScanIDCardDelegate , ChildViewControll
|
|
|
39
41
|
self.showCountDown = showCountDown
|
|
40
42
|
self.apiKey = apiKey
|
|
41
43
|
self.stepID = stepID;
|
|
44
|
+
self.manualClickColor = manualClickColor;
|
|
42
45
|
super.init(nibName: nil, bundle: nil)
|
|
43
46
|
}
|
|
44
47
|
required init?(coder: NSCoder) {
|
|
@@ -64,10 +67,32 @@ class IDCardController: UIViewController ,ScanIDCardDelegate , ChildViewControll
|
|
|
64
67
|
self.scanID!.view.bottomAnchor.constraint(equalTo: self.view.bottomAnchor),
|
|
65
68
|
])
|
|
66
69
|
self.scanID!.didMove(toParent: self)
|
|
67
|
-
|
|
70
|
+
|
|
68
71
|
showNavigationBarWithBackArrow(view: self.view, target: self, action: #selector(self.backButtonTapped), initialTextColorHex:self.processingColor,initialBackgroundColorHex:self.holdHandColor,title: self.titleID!)
|
|
72
|
+
if(self.assentifySdk!.isManual()){
|
|
73
|
+
self.takePhotoButton = createTakePhotoButton(initialTextColorHex: self.manualClickColor, target: self, action: #selector(self.takePhoteTapped))
|
|
74
|
+
self.view.addSubview(self.takePhotoButton!)
|
|
75
|
+
|
|
76
|
+
NSLayoutConstraint.activate([
|
|
77
|
+
self.takePhotoButton!.centerXAnchor.constraint(equalTo: self.view.centerXAnchor),
|
|
78
|
+
self.takePhotoButton!.bottomAnchor.constraint(equalTo: self.view.safeAreaLayoutGuide.bottomAnchor, constant: -30),
|
|
79
|
+
self.takePhotoButton!.widthAnchor.constraint(equalToConstant: 300),
|
|
80
|
+
self.takePhotoButton!.heightAnchor.constraint(equalToConstant: 50)
|
|
81
|
+
])
|
|
82
|
+
|
|
83
|
+
}else{
|
|
84
|
+
(self.infoLabel, self.infoImage) = showInfo(view: self.view, text: "Please Present Your ID",initialTextColorHex:self.processingColor,initialBackgroundColorHex:self.holdHandColor,initialImageName:"info_icon")
|
|
85
|
+
}
|
|
86
|
+
|
|
69
87
|
}
|
|
70
88
|
}
|
|
89
|
+
|
|
90
|
+
@objc func takePhoteTapped() {
|
|
91
|
+
DispatchQueue.main.async {
|
|
92
|
+
self.scanID?.takePicture();
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
71
96
|
@objc func backButtonTapped() {
|
|
72
97
|
triggerEvent(eventName:"onBackClick",dataModel:nil)
|
|
73
98
|
DispatchQueue.main.async {
|
|
@@ -100,7 +125,9 @@ class IDCardController: UIViewController ,ScanIDCardDelegate , ChildViewControll
|
|
|
100
125
|
DispatchQueue.main.async {
|
|
101
126
|
if(!self.start){
|
|
102
127
|
self.popUpMessage!.removeFromSuperview();
|
|
128
|
+
if(!self.assentifySdk!.isManual()){
|
|
103
129
|
(self.infoLabel, self.infoImage) = showInfo(view: self.view, text: "Please Present Your ID",initialTextColorHex:self.processingColor,initialBackgroundColorHex:self.holdHandColor,initialImageName:"info_icon")
|
|
130
|
+
}
|
|
104
131
|
}
|
|
105
132
|
}
|
|
106
133
|
|
|
@@ -122,7 +149,7 @@ class IDCardController: UIViewController ,ScanIDCardDelegate , ChildViewControll
|
|
|
122
149
|
DispatchQueue.main.async {
|
|
123
150
|
self.start = false;
|
|
124
151
|
self.popUpMessage!.removeFromSuperview();
|
|
125
|
-
self.popUpMessage = showPopUpMessage(view: self.view, title: "
|
|
152
|
+
self.popUpMessage = showPopUpMessage(view: self.view, title: "Your internet connection seems unstable. Please check your connection and try again.", subTitle: "Let's try again",initialTextColorHex:self.processingColor,initialBackgroundColorHex:self.holdHandColor, iconName: "warning", isGif: false,target: self, action: #selector(self.dismissPopUpMessage))
|
|
126
153
|
}
|
|
127
154
|
}
|
|
128
155
|
|
|
@@ -131,8 +158,10 @@ class IDCardController: UIViewController ,ScanIDCardDelegate , ChildViewControll
|
|
|
131
158
|
triggerEvent(eventName:"onRetry",dataModel:dataModel)
|
|
132
159
|
DispatchQueue.main.async {
|
|
133
160
|
self.start = false;
|
|
161
|
+
if( self.popUpMessage != nil){
|
|
134
162
|
self.popUpMessage!.removeFromSuperview();
|
|
135
|
-
|
|
163
|
+
}
|
|
164
|
+
self.popUpMessage = showPopUpMessage(view: self.view, title: "We couldn’t read your card. Try again in better lighting and make sure the card is clear and visible", subTitle: "Let's try again",initialTextColorHex:self.processingColor,initialBackgroundColorHex:self.holdHandColor, iconName: "warning", isGif: false,target: self, action: #selector(self.dismissPopUpMessage))
|
|
136
165
|
}
|
|
137
166
|
}
|
|
138
167
|
|
|
@@ -141,7 +170,7 @@ class IDCardController: UIViewController ,ScanIDCardDelegate , ChildViewControll
|
|
|
141
170
|
DispatchQueue.main.async {
|
|
142
171
|
self.start = false;
|
|
143
172
|
self.popUpMessage!.removeFromSuperview();
|
|
144
|
-
self.popUpMessage = showPopUpMessage(view: self.view, title: "
|
|
173
|
+
self.popUpMessage = showPopUpMessage(view: self.view, title: "Please use your original physical ID card, not a photo or copy.", subTitle: "Please real ID (Not copy)",initialTextColorHex:self.processingColor,initialBackgroundColorHex:self.holdHandColor, iconName: "id_warning", isGif: false,target: self, action: #selector(self.dismissPopUpMessage))
|
|
145
174
|
}
|
|
146
175
|
}
|
|
147
176
|
|
|
@@ -150,7 +179,7 @@ class IDCardController: UIViewController ,ScanIDCardDelegate , ChildViewControll
|
|
|
150
179
|
DispatchQueue.main.async {
|
|
151
180
|
self.start = false;
|
|
152
181
|
self.popUpMessage!.removeFromSuperview();
|
|
153
|
-
self.popUpMessage = showPopUpMessage(view: self.view, title: "
|
|
182
|
+
self.popUpMessage = showPopUpMessage(view: self.view, title: "Please double-check that you selected the correct ID type and are presenting this ID type.", subTitle: "Let's try again",initialTextColorHex:self.processingColor,initialBackgroundColorHex:self.holdHandColor, iconName: "id_warning", isGif: false,target: self, action: #selector(self.dismissPopUpMessage))
|
|
154
183
|
}
|
|
155
184
|
}
|
|
156
185
|
func onClipPreparationComplete(dataModel: RemoteProcessingModel) {
|
|
@@ -167,16 +196,17 @@ class IDCardController: UIViewController ,ScanIDCardDelegate , ChildViewControll
|
|
|
167
196
|
|
|
168
197
|
|
|
169
198
|
|
|
170
|
-
func onComplete(dataModel: IDResponseModel, order: Int) {
|
|
199
|
+
func onComplete(dataModel: IDResponseModel, order: Int,doneFlag:DoneFlags) {
|
|
171
200
|
|
|
172
|
-
|
|
201
|
+
self.triggerCompleteEvent(eventName:"onComplete",dataModel: dataModel.iDExtractedModel,doneFlag:doneFlag)
|
|
173
202
|
|
|
174
203
|
outputResultProperties!.merge((dataModel.iDExtractedModel?.transformedProperties)!) { (_, new) in new }
|
|
175
204
|
|
|
176
205
|
self.start = false
|
|
177
206
|
DispatchQueue.main.async {
|
|
178
207
|
self.popUpMessage!.removeFromSuperview();
|
|
179
|
-
|
|
208
|
+
|
|
209
|
+
|
|
180
210
|
|
|
181
211
|
if(self._kycDocumentDetails.count == 1){
|
|
182
212
|
self.imageUrl = dataModel.iDExtractedModel?.imageUrl;
|
|
@@ -184,13 +214,8 @@ class IDCardController: UIViewController ,ScanIDCardDelegate , ChildViewControll
|
|
|
184
214
|
|
|
185
215
|
if(order == self._kycDocumentDetails.count-1 ){
|
|
186
216
|
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
UserDefaults.standard.removeObject(forKey: String(self.stepID))
|
|
190
|
-
}
|
|
191
|
-
UserDefaults.standard.set(nil, forKey:String(self.stepID))
|
|
192
|
-
UserDefaults.standard.set(outputProperties, forKey: String(self.stepID))
|
|
193
|
-
}
|
|
217
|
+
self.mergeAndStoreOutputProperties(stepID: self.stepID, newProperties: self.outputResultProperties ?? [:])
|
|
218
|
+
|
|
194
219
|
DispatchQueue.main.async {
|
|
195
220
|
self.scanID?.stopScanning()
|
|
196
221
|
self.scanID?.willMove(toParent: nil)
|
|
@@ -203,10 +228,31 @@ class IDCardController: UIViewController ,ScanIDCardDelegate , ChildViewControll
|
|
|
203
228
|
|
|
204
229
|
}else{
|
|
205
230
|
if(self.flippingCard){
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
231
|
+
self.popUpMessage!.removeFromSuperview();
|
|
232
|
+
self.backIDPage = showBackIDPage(
|
|
233
|
+
on: self.view,
|
|
234
|
+
backgroundHex: self.holdHandColor,
|
|
235
|
+
buttonHex:self.manualClickColor,
|
|
236
|
+
title: "Please flip the card provided to take the back of the card.",
|
|
237
|
+
subtitle: "Expected Card Type",
|
|
238
|
+
buttonTitle: "Next",
|
|
239
|
+
imageURLString: (self._kycDocumentDetails.last?.templateSpecimen)!,
|
|
240
|
+
initialBackgroundColorHex:self.manualClickColor,
|
|
241
|
+
onBack: {
|
|
242
|
+
self.backButtonTapped()
|
|
243
|
+
},
|
|
244
|
+
onTap: {
|
|
245
|
+
if(!(self.assentifySdk?.isManual())!){
|
|
246
|
+
(self.infoLabel, self.infoImage) = showInfo(view: self.view, text: "Please Present Your ID",initialTextColorHex:self.processingColor,initialBackgroundColorHex:self.holdHandColor,initialImageName:"info_icon")
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
self.scanID?.changeTemplateId(templateId: (self._kycDocumentDetails.last?.templateProcessingKeyInformation)!)
|
|
250
|
+
self.backIDPage?.removeFromSuperview()
|
|
251
|
+
}
|
|
252
|
+
)
|
|
253
|
+
|
|
254
|
+
}else{
|
|
255
|
+
(self.infoLabel, self.infoImage) = showInfo(view: self.view, text: "Please Present Your ID",initialTextColorHex:self.processingColor,initialBackgroundColorHex:self.holdHandColor,initialImageName:"info_icon")
|
|
210
256
|
}
|
|
211
257
|
if(order == 0){
|
|
212
258
|
self.imageUrl = dataModel.iDExtractedModel?.imageUrl;
|
|
@@ -311,13 +357,25 @@ class IDCardController: UIViewController ,ScanIDCardDelegate , ChildViewControll
|
|
|
311
357
|
|
|
312
358
|
}
|
|
313
359
|
|
|
314
|
-
func triggerCompleteEvent(eventName:String, dataModel: IDExtractedModel
|
|
360
|
+
func triggerCompleteEvent(eventName:String, dataModel: IDExtractedModel?,doneFlag:DoneFlags){
|
|
315
361
|
var eventResultMap: [String: Any] = [:]
|
|
316
362
|
if(dataModel != nil){
|
|
317
|
-
|
|
363
|
+
var doneFlagValue = "";
|
|
364
|
+
switch doneFlag {
|
|
365
|
+
case .Success:
|
|
366
|
+
doneFlagValue = "Success";
|
|
367
|
+
case .LivenessFailed:
|
|
368
|
+
doneFlagValue = "LivenessFailed";
|
|
369
|
+
case .ExtractFailed:
|
|
370
|
+
doneFlagValue = "ExtractFailed";
|
|
371
|
+
case .MatchFailed:
|
|
372
|
+
doneFlagValue = "MatchFailed";
|
|
373
|
+
case .WrongTemplate:
|
|
374
|
+
doneFlagValue = "WrongTemplate";
|
|
375
|
+
}
|
|
376
|
+
eventResultMap = ["IdDataModel": iDModelToJsonString(dataModel:dataModel) as Any,"DoneFlag":doneFlagValue]
|
|
318
377
|
}
|
|
319
|
-
|
|
320
|
-
print(iDModelToJsonString(dataModel:dataModel))
|
|
378
|
+
|
|
321
379
|
DispatchQueue.main.async {
|
|
322
380
|
self.nativeAssentifySdk?.sendEvent(withName: eventName, body: eventResultMap)
|
|
323
381
|
}
|
|
@@ -383,6 +441,27 @@ class IDCardController: UIViewController ,ScanIDCardDelegate , ChildViewControll
|
|
|
383
441
|
}
|
|
384
442
|
}
|
|
385
443
|
|
|
444
|
+
func mergeAndStoreOutputProperties(stepID: Int, newProperties: [String: Any]) {
|
|
445
|
+
let key = String(stepID)
|
|
446
|
+
|
|
447
|
+
// Try to fetch old stored properties
|
|
448
|
+
var oldProperties: [String: Any] = [:]
|
|
449
|
+
if let data = UserDefaults.standard.data(forKey: key),
|
|
450
|
+
let storedDict = try? JSONSerialization.jsonObject(with: data, options: []) as? [String: Any] {
|
|
451
|
+
oldProperties = storedDict
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
// Merge: override existing keys, add new ones
|
|
455
|
+
var mergedProperties = oldProperties
|
|
456
|
+
for (k, v) in newProperties {
|
|
457
|
+
mergedProperties[k] = v
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
// Save back
|
|
461
|
+
if let mergedData = try? JSONSerialization.data(withJSONObject: mergedProperties, options: []) {
|
|
462
|
+
UserDefaults.standard.set(mergedData, forKey: key)
|
|
463
|
+
}
|
|
464
|
+
}
|
|
386
465
|
|
|
387
466
|
|
|
388
467
|
|
|
@@ -24,10 +24,10 @@ class OtherController: UIViewController ,ScanOtherDelegate , ChildViewController
|
|
|
24
24
|
private var nativeAssentifySdk:NativeAssentifySdk?;
|
|
25
25
|
private var scanOther:ScanOther?;
|
|
26
26
|
private var stepID:Int;
|
|
27
|
+
private var manualClickColor: String;
|
|
28
|
+
private var takePhotoButton: UIButton?;
|
|
27
29
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
init(assentifySdk: AssentifySdk,nativeAssentifySdk:NativeAssentifySdk,holdHandColor: String,processingColor: String, language: String,showCountDown:Bool,apiKey:String,stepID:Int) {
|
|
30
|
+
init(assentifySdk: AssentifySdk,nativeAssentifySdk:NativeAssentifySdk,holdHandColor: String,processingColor: String, language: String,showCountDown:Bool,apiKey:String,stepID:Int,manualClickColor:String) {
|
|
31
31
|
self.assentifySdk = assentifySdk
|
|
32
32
|
self.nativeAssentifySdk = nativeAssentifySdk
|
|
33
33
|
self.holdHandColor = holdHandColor
|
|
@@ -36,6 +36,7 @@ class OtherController: UIViewController ,ScanOtherDelegate , ChildViewController
|
|
|
36
36
|
self.showCountDown = showCountDown
|
|
37
37
|
self.apiKey = apiKey
|
|
38
38
|
self.stepID = stepID;
|
|
39
|
+
self.manualClickColor = manualClickColor;
|
|
39
40
|
super.init(nibName: nil, bundle: nil)
|
|
40
41
|
}
|
|
41
42
|
|
|
@@ -63,11 +64,31 @@ class OtherController: UIViewController ,ScanOtherDelegate , ChildViewController
|
|
|
63
64
|
self.scanOther!.view.bottomAnchor.constraint(equalTo: self.view.bottomAnchor),
|
|
64
65
|
])
|
|
65
66
|
self.scanOther!.didMove(toParent: self)
|
|
66
|
-
|
|
67
|
+
|
|
67
68
|
showNavigationBarWithBackArrow(view: self.view, target: self, action: #selector(self.backButtonTapped), initialTextColorHex:self.processingColor,initialBackgroundColorHex:self.holdHandColor,title: "ID Capture")
|
|
68
69
|
|
|
70
|
+
if(self.assentifySdk!.isManual()){
|
|
71
|
+
self.takePhotoButton = createTakePhotoButton(initialTextColorHex: self.manualClickColor, target: self, action: #selector(self.takePhoteTapped))
|
|
72
|
+
self.view.addSubview(self.takePhotoButton!)
|
|
73
|
+
NSLayoutConstraint.activate([
|
|
74
|
+
self.takePhotoButton!.centerXAnchor.constraint(equalTo: self.view.centerXAnchor),
|
|
75
|
+
self.takePhotoButton!.bottomAnchor.constraint(equalTo: self.view.safeAreaLayoutGuide.bottomAnchor, constant: -30),
|
|
76
|
+
self.takePhotoButton!.widthAnchor.constraint(equalToConstant: 300),
|
|
77
|
+
self.takePhotoButton!.heightAnchor.constraint(equalToConstant: 50)
|
|
78
|
+
])
|
|
79
|
+
|
|
80
|
+
}else{
|
|
81
|
+
(self.infoLabel, self.infoImage) = showInfo(view: self.view, text: "Please Present Your ID",initialTextColorHex:self.processingColor,initialBackgroundColorHex:self.holdHandColor,initialImageName:"info_icon")
|
|
82
|
+
}
|
|
69
83
|
}
|
|
70
84
|
}
|
|
85
|
+
|
|
86
|
+
@objc func takePhoteTapped() {
|
|
87
|
+
DispatchQueue.main.async {
|
|
88
|
+
self.scanOther?.takePicture();
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
71
92
|
@objc func backButtonTapped() {
|
|
72
93
|
triggerEvent(eventName:"onBackClick",dataModel:nil)
|
|
73
94
|
DispatchQueue.main.async {
|
|
@@ -99,7 +120,9 @@ class OtherController: UIViewController ,ScanOtherDelegate , ChildViewController
|
|
|
99
120
|
DispatchQueue.main.async {
|
|
100
121
|
if(!self.start){
|
|
101
122
|
self.popUpMessage!.removeFromSuperview();
|
|
123
|
+
if(!self.assentifySdk!.isManual()){
|
|
102
124
|
(self.infoLabel, self.infoImage) = showInfo(view: self.view, text: "Please Present Your ID",initialTextColorHex:self.processingColor,initialBackgroundColorHex:self.holdHandColor,initialImageName:"info_icon")
|
|
125
|
+
}
|
|
103
126
|
}
|
|
104
127
|
}
|
|
105
128
|
|
|
@@ -121,7 +144,7 @@ class OtherController: UIViewController ,ScanOtherDelegate , ChildViewController
|
|
|
121
144
|
DispatchQueue.main.async {
|
|
122
145
|
self.start = false;
|
|
123
146
|
self.popUpMessage!.removeFromSuperview();
|
|
124
|
-
self.popUpMessage = showPopUpMessage(view: self.view, title: "
|
|
147
|
+
self.popUpMessage = showPopUpMessage(view: self.view, title: "Your internet connection seems unstable. Please check your connection and try again.", subTitle: "Let's try again",initialTextColorHex:self.processingColor,initialBackgroundColorHex:self.holdHandColor, iconName: "warning", isGif: false,target: self, action: #selector(self.dismissPopUpMessage))
|
|
125
148
|
}
|
|
126
149
|
}
|
|
127
150
|
|
|
@@ -130,8 +153,10 @@ class OtherController: UIViewController ,ScanOtherDelegate , ChildViewController
|
|
|
130
153
|
triggerEvent(eventName:"onRetry",dataModel:dataModel)
|
|
131
154
|
DispatchQueue.main.async {
|
|
132
155
|
self.start = false;
|
|
156
|
+
if( self.popUpMessage != nil){
|
|
133
157
|
self.popUpMessage!.removeFromSuperview();
|
|
134
|
-
|
|
158
|
+
}
|
|
159
|
+
self.popUpMessage = showPopUpMessage(view: self.view, title: "We couldn’t read your card. Try again in better lighting and make sure the card is clear and visible.", subTitle: "Let's try again",initialTextColorHex:self.processingColor,initialBackgroundColorHex:self.holdHandColor, iconName: "warning", isGif: false,target: self, action: #selector(self.dismissPopUpMessage))
|
|
135
160
|
}
|
|
136
161
|
}
|
|
137
162
|
|
|
@@ -140,7 +165,7 @@ class OtherController: UIViewController ,ScanOtherDelegate , ChildViewController
|
|
|
140
165
|
DispatchQueue.main.async {
|
|
141
166
|
self.start = false;
|
|
142
167
|
self.popUpMessage!.removeFromSuperview();
|
|
143
|
-
self.popUpMessage = showPopUpMessage(view: self.view, title: "
|
|
168
|
+
self.popUpMessage = showPopUpMessage(view: self.view, title: "Please use your original physical ID card, not a photo or copy.", subTitle: "Please real ID (Not copy)",initialTextColorHex:self.processingColor,initialBackgroundColorHex:self.holdHandColor, iconName: "id_warning", isGif: false,target: self, action: #selector(self.dismissPopUpMessage))
|
|
144
169
|
}
|
|
145
170
|
}
|
|
146
171
|
|
|
@@ -158,7 +183,7 @@ class OtherController: UIViewController ,ScanOtherDelegate , ChildViewController
|
|
|
158
183
|
}
|
|
159
184
|
|
|
160
185
|
|
|
161
|
-
func onComplete(dataModel: OtherResponseModel) {
|
|
186
|
+
func onComplete(dataModel: OtherResponseModel,doneFlag:DoneFlags) {
|
|
162
187
|
if(!isDone){
|
|
163
188
|
isDone = true;
|
|
164
189
|
if let outputProperties = try? JSONSerialization.data(withJSONObject: dataModel.otherExtractedModel?.transformedProperties, options: []) {
|
|
@@ -168,7 +193,7 @@ class OtherController: UIViewController ,ScanOtherDelegate , ChildViewController
|
|
|
168
193
|
UserDefaults.standard.set(nil, forKey:String(self.stepID))
|
|
169
194
|
UserDefaults.standard.set(outputProperties, forKey: String(self.stepID))
|
|
170
195
|
}
|
|
171
|
-
|
|
196
|
+
triggerCompleteEvent(eventName:"onComplete",dataModel:dataModel.otherExtractedModel,doneFlag:doneFlag)
|
|
172
197
|
DispatchQueue.main.async {
|
|
173
198
|
self.scanOther?.stopScanning();
|
|
174
199
|
self.scanOther?.willMove(toParent: nil)
|
|
@@ -280,11 +305,24 @@ class OtherController: UIViewController ,ScanOtherDelegate , ChildViewController
|
|
|
280
305
|
|
|
281
306
|
|
|
282
307
|
|
|
283
|
-
func triggerCompleteEvent(eventName:String, dataModel: OtherExtractedModel
|
|
308
|
+
func triggerCompleteEvent(eventName:String, dataModel: OtherExtractedModel?,doneFlag:DoneFlags){
|
|
284
309
|
var eventResultMap: [String: Any] = [:]
|
|
285
310
|
if(dataModel != nil){
|
|
311
|
+
var doneFlagValue = "";
|
|
312
|
+
switch doneFlag {
|
|
313
|
+
case .Success:
|
|
314
|
+
doneFlagValue = "Success";
|
|
315
|
+
case .LivenessFailed:
|
|
316
|
+
doneFlagValue = "LivenessFailed";
|
|
317
|
+
case .ExtractFailed:
|
|
318
|
+
doneFlagValue = "ExtractFailed";
|
|
319
|
+
case .MatchFailed:
|
|
320
|
+
doneFlagValue = "MatchFailed";
|
|
321
|
+
case .WrongTemplate:
|
|
322
|
+
doneFlagValue = "WrongTemplate";
|
|
323
|
+
}
|
|
286
324
|
eventResultMap = [
|
|
287
|
-
"OtherDataModel": otherModelToJsonString(dataModel: dataModel) as Any
|
|
325
|
+
"OtherDataModel": otherModelToJsonString(dataModel: dataModel) as Any,"DoneFlag":doneFlagValue
|
|
288
326
|
]
|
|
289
327
|
}
|
|
290
328
|
DispatchQueue.main.async {
|