assentify-sdk-react-native 0.0.6 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -0
- package/android/build.gradle +1 -1
- package/android/src/main/java/com/assentifysdk/AssentifySdkModule.kt +0 -4
- package/android/src/main/java/com/assentifysdk/FaceMatchActivity.kt +58 -9
- package/android/src/main/java/com/assentifysdk/ScanIDActivity.kt +23 -16
- package/android/src/main/java/com/assentifysdk/ScanOtherActivity.kt +23 -16
- package/android/src/main/java/com/assentifysdk/ScanPassportActivity.kt +23 -15
- package/assentify-sdk.podspec +1 -1
- package/ios/NativeAssentifySdk.swift +36 -39
- package/ios/View/FaceMatchController.swift +86 -37
- package/ios/View/IDCardController.swift +69 -60
- package/ios/View/OtherController.swift +65 -56
- package/ios/View/PassportController.swift +67 -58
- package/package.json +1 -1
|
@@ -19,7 +19,7 @@ class FaceMAtchController: UIViewController ,FaceMatchDelegate
|
|
|
19
19
|
private var holdHandColor: String;
|
|
20
20
|
private var processingColor: String;
|
|
21
21
|
private var showCountDown: Bool = true;
|
|
22
|
-
|
|
22
|
+
|
|
23
23
|
init(assentifySdk: AssentifySdk, nativeAssentifySdk:NativeAssentifySdk?,holdHandColor: String,processingColor: String,secondImage:String,showCountDown:Bool) {
|
|
24
24
|
self.assentifySdk = assentifySdk
|
|
25
25
|
self.holdHandColor = holdHandColor
|
|
@@ -29,8 +29,8 @@ class FaceMAtchController: UIViewController ,FaceMatchDelegate
|
|
|
29
29
|
self.showCountDown = showCountDown
|
|
30
30
|
super.init(nibName: nil, bundle: nil)
|
|
31
31
|
}
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
|
|
33
|
+
|
|
34
34
|
|
|
35
35
|
required init?(coder: NSCoder) {
|
|
36
36
|
fatalError("init(coder:) has not been implemented")
|
|
@@ -65,15 +65,15 @@ class FaceMAtchController: UIViewController ,FaceMatchDelegate
|
|
|
65
65
|
self.dismiss(animated: false)
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
|
-
|
|
68
|
+
|
|
69
69
|
func dismissParentViewController() {
|
|
70
70
|
triggerEvent(eventName:"onBackClick",dataModel:nil)
|
|
71
71
|
DispatchQueue.main.async {
|
|
72
72
|
self.dismiss(animated: false)
|
|
73
73
|
}
|
|
74
|
-
|
|
74
|
+
|
|
75
75
|
}
|
|
76
|
-
|
|
76
|
+
|
|
77
77
|
@objc func dismissPopUpMessage() {
|
|
78
78
|
DispatchQueue.main.async {
|
|
79
79
|
if(!self.start){
|
|
@@ -81,9 +81,9 @@ class FaceMAtchController: UIViewController ,FaceMatchDelegate
|
|
|
81
81
|
(self.infoLabel, self.infoImage) = showInfo(view: self.view, text: "Please face within circle",initialTextColorHex:self.processingColor,initialBackgroundColorHex:self.holdHandColor,initialImageName:"info_icon")
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
|
-
|
|
84
|
+
|
|
85
85
|
}
|
|
86
|
-
|
|
86
|
+
|
|
87
87
|
func onSend() {
|
|
88
88
|
triggerEvent(eventName:"onSend",dataModel:nil)
|
|
89
89
|
DispatchQueue.main.async {
|
|
@@ -94,7 +94,7 @@ class FaceMAtchController: UIViewController ,FaceMatchDelegate
|
|
|
94
94
|
self.popUpMessage = showPopUpMessage(view: self.view, title: "Transmitting", subTitle: "",initialTextColorHex:self.processingColor,initialBackgroundColorHex:self.holdHandColor, iconName: "sending", isGif: false,target: self, action: #selector(self.dismissPopUpMessage))
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
|
-
|
|
97
|
+
|
|
98
98
|
func onError(dataModel: RemoteProcessingModel) {
|
|
99
99
|
triggerEvent(eventName:"onError",dataModel:dataModel)
|
|
100
100
|
DispatchQueue.main.async {
|
|
@@ -103,8 +103,8 @@ class FaceMAtchController: UIViewController ,FaceMatchDelegate
|
|
|
103
103
|
self.popUpMessage = showPopUpMessage(view: self.view, title: "Unable to Match", subTitle: "Let's try again",initialTextColorHex:self.processingColor,initialBackgroundColorHex:self.holdHandColor, iconName: "warning", isGif: false,target: self, action: #selector(self.dismissPopUpMessage))
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
|
-
|
|
107
|
-
|
|
106
|
+
|
|
107
|
+
|
|
108
108
|
func onRetry(dataModel: RemoteProcessingModel) {
|
|
109
109
|
triggerEvent(eventName:"onRetry",dataModel:dataModel)
|
|
110
110
|
DispatchQueue.main.async {
|
|
@@ -113,7 +113,7 @@ class FaceMAtchController: UIViewController ,FaceMatchDelegate
|
|
|
113
113
|
self.popUpMessage = showPopUpMessage(view: self.view, title: "Unable to Match", subTitle: "Let's try again",initialTextColorHex:self.processingColor,initialBackgroundColorHex:self.holdHandColor, iconName: "warning", isGif: false,target: self, action: #selector(self.dismissPopUpMessage))
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
|
-
|
|
116
|
+
|
|
117
117
|
func onLivenessUpdate(dataModel: RemoteProcessingModel) {
|
|
118
118
|
triggerEvent(eventName:"onLivenessUpdate",dataModel:dataModel)
|
|
119
119
|
DispatchQueue.main.async {
|
|
@@ -122,7 +122,7 @@ class FaceMAtchController: UIViewController ,FaceMatchDelegate
|
|
|
122
122
|
self.popUpMessage = showPopUpMessage(view: self.view, title: "Liveness Failed", subTitle: "Let's try again",initialTextColorHex:self.processingColor,initialBackgroundColorHex:self.holdHandColor, iconName: "warning", isGif: false,target: self, action: #selector(self.dismissPopUpMessage))
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
|
-
|
|
125
|
+
|
|
126
126
|
|
|
127
127
|
func onClipPreparationComplete(dataModel: RemoteProcessingModel) {
|
|
128
128
|
triggerEvent(eventName:"onClipPreparationComplete",dataModel:dataModel)
|
|
@@ -136,7 +136,7 @@ class FaceMAtchController: UIViewController ,FaceMatchDelegate
|
|
|
136
136
|
triggerEvent(eventName:"onUpdated",dataModel:dataModel)
|
|
137
137
|
}
|
|
138
138
|
|
|
139
|
-
|
|
139
|
+
|
|
140
140
|
|
|
141
141
|
func onComplete(dataModel: FaceResponseModel) {
|
|
142
142
|
|
|
@@ -195,32 +195,81 @@ class FaceMAtchController: UIViewController ,FaceMatchDelegate
|
|
|
195
195
|
triggerEvent(eventName:"onUploadFailed",dataModel:dataModel)
|
|
196
196
|
}
|
|
197
197
|
|
|
198
|
-
|
|
198
|
+
func onEnvironmentalConditionsChange(brightnessEvents: BrightnessEvents,motion: MotionType,faceEvents: FaceEvents,zoom: ZoomType) {
|
|
199
199
|
DispatchQueue.main.async {
|
|
200
|
-
if
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
200
|
+
if self.start == false {
|
|
201
|
+
// Zoom Type Handling
|
|
202
|
+
if (zoom != ZoomType.SENDING && zoom != ZoomType.NO_DETECT) {
|
|
203
|
+
if (zoom == ZoomType.ZOOM_IN) {
|
|
204
|
+
self.infoLabel?.text = "Please Move Closer"
|
|
205
|
+
self.infoImage!.image = UIImage(named: "zoom_in")
|
|
206
|
+
}
|
|
207
|
+
if (zoom == ZoomType.ZOOM_OUT) {
|
|
208
|
+
self.infoLabel?.text = "Please Move Further"
|
|
209
|
+
self.infoImage!.image = UIImage(named: "zoom_out")
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
// Motion Type Handling
|
|
213
|
+
else if (motion != MotionType.SENDING && motion != MotionType.NO_DETECT) {
|
|
214
|
+
self.infoLabel?.text = "Please Hold Your Hand"
|
|
215
|
+
self.infoImage!.image = UIImage(named: "info_icon")
|
|
216
|
+
}
|
|
217
|
+
// Brightness Events Handling
|
|
218
|
+
else if (brightnessEvents != BrightnessEvents.Good) {
|
|
219
|
+
if (brightnessEvents == BrightnessEvents.TooDark) {
|
|
220
|
+
self.infoLabel?.text = "Please increase the lighting"
|
|
221
|
+
self.infoImage!.image = UIImage(named: "info_icon")
|
|
222
|
+
}
|
|
223
|
+
if (brightnessEvents == BrightnessEvents.TooBright) {
|
|
224
|
+
self.infoLabel?.text = "Please reduce the lighting"
|
|
225
|
+
self.infoImage!.image = UIImage(named: "info_icon")
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
// Face Events Handling
|
|
229
|
+
else if (faceEvents != FaceEvents.GOOD && faceEvents != FaceEvents.NO_DETECT) {
|
|
230
|
+
if (faceEvents == FaceEvents.ROLL_LEFT) {
|
|
231
|
+
self.infoLabel?.text = "Please tilt your head to the right"
|
|
232
|
+
self.infoImage!.image = UIImage(named: "info_icon")
|
|
233
|
+
}
|
|
234
|
+
if (faceEvents == FaceEvents.ROLL_RIGHT) {
|
|
235
|
+
self.infoLabel?.text = "Please tilt your head to the left"
|
|
236
|
+
self.infoImage!.image = UIImage(named: "info_icon")
|
|
237
|
+
}
|
|
238
|
+
if (faceEvents == FaceEvents.YAW_LEFT) {
|
|
239
|
+
self.infoLabel?.text = "Please turn your head to the right"
|
|
240
|
+
self.infoImage!.image = UIImage(named: "info_icon")
|
|
241
|
+
}
|
|
242
|
+
if (faceEvents == FaceEvents.YAW_RIGHT) {
|
|
243
|
+
self.infoLabel?.text = "Please turn your head to the left"
|
|
244
|
+
self.infoImage!.image = UIImage(named: "info_icon")
|
|
245
|
+
}
|
|
246
|
+
if (faceEvents == FaceEvents.PITCH_UP) {
|
|
247
|
+
self.infoLabel?.text = "Please lower your head"
|
|
248
|
+
self.infoImage!.image = UIImage(named: "info_icon")
|
|
249
|
+
}
|
|
250
|
+
if (faceEvents == FaceEvents.PITCH_DOWN) {
|
|
251
|
+
self.infoLabel?.text = "Please raise your head"
|
|
252
|
+
self.infoImage!.image = UIImage(named: "info_icon")
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
// Final Conditions
|
|
256
|
+
else {
|
|
257
|
+
if (motion == MotionType.SENDING && zoom == ZoomType.SENDING && brightnessEvents == BrightnessEvents.Good && faceEvents == FaceEvents.GOOD) {
|
|
258
|
+
self.infoLabel?.text = "Hold Steady"
|
|
259
|
+
self.infoImage!.image = UIImage(named: "info_icon")
|
|
260
|
+
}
|
|
261
|
+
if (motion == MotionType.NO_DETECT && zoom == ZoomType.NO_DETECT && faceEvents == FaceEvents.NO_DETECT) {
|
|
262
|
+
self.infoLabel?.text = "Please face within circle"
|
|
263
|
+
self.infoImage!.image = UIImage(named: "info_icon")
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
} else {
|
|
267
|
+
self.infoLabel?.removeFromSuperview()
|
|
268
|
+
self.infoImage?.removeFromSuperview()
|
|
269
|
+
}
|
|
221
270
|
}
|
|
222
271
|
}
|
|
223
|
-
|
|
272
|
+
|
|
224
273
|
func onHasTemplates(templates: [TemplatesByCountry]){
|
|
225
274
|
}
|
|
226
275
|
|
|
@@ -24,9 +24,9 @@ class IDCardController: UIViewController ,ScanIDCardDelegate , ChildViewControll
|
|
|
24
24
|
private var nativeAssentifySdk:NativeAssentifySdk?;
|
|
25
25
|
private var outputResultProperties: [String: Any]? = [:];
|
|
26
26
|
|
|
27
|
-
|
|
28
27
|
|
|
29
|
-
|
|
28
|
+
|
|
29
|
+
|
|
30
30
|
init(assentifySdk: AssentifySdk,nativeAssentifySdk:NativeAssentifySdk,holdHandColor: String,processingColor: String,kycDocumentDetails:[KycDocumentDetails],language:String,flippingCard:Bool,titleID:String,showCountDown:Bool,apiKey:String) {
|
|
31
31
|
self.assentifySdk = assentifySdk
|
|
32
32
|
self.nativeAssentifySdk = nativeAssentifySdk
|
|
@@ -73,15 +73,15 @@ class IDCardController: UIViewController ,ScanIDCardDelegate , ChildViewControll
|
|
|
73
73
|
self.dismiss(animated: false)
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
|
-
|
|
76
|
+
|
|
77
77
|
func dismissParentViewController() {
|
|
78
78
|
triggerEvent(eventName:"onBackClick",dataModel:nil)
|
|
79
79
|
DispatchQueue.main.async {
|
|
80
80
|
self.dismiss(animated: false)
|
|
81
81
|
}
|
|
82
|
-
|
|
82
|
+
|
|
83
83
|
}
|
|
84
|
-
|
|
84
|
+
|
|
85
85
|
@objc func dismissPopUpMessage() {
|
|
86
86
|
DispatchQueue.main.async {
|
|
87
87
|
if(!self.start){
|
|
@@ -89,9 +89,9 @@ class IDCardController: UIViewController ,ScanIDCardDelegate , ChildViewControll
|
|
|
89
89
|
(self.infoLabel, self.infoImage) = showInfo(view: self.view, text: "Please Present Your ID",initialTextColorHex:self.processingColor,initialBackgroundColorHex:self.holdHandColor,initialImageName:"info_icon")
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
|
-
|
|
92
|
+
|
|
93
93
|
}
|
|
94
|
-
|
|
94
|
+
|
|
95
95
|
func onSend() {
|
|
96
96
|
triggerEvent(eventName:"onSend",dataModel:nil)
|
|
97
97
|
DispatchQueue.main.async {
|
|
@@ -102,7 +102,7 @@ class IDCardController: UIViewController ,ScanIDCardDelegate , ChildViewControll
|
|
|
102
102
|
self.popUpMessage = showPopUpMessage(view: self.view, title: "Transmitting", subTitle: "",initialTextColorHex:self.processingColor,initialBackgroundColorHex:self.holdHandColor, iconName: "id", isGif: true,target: self, action: #selector(self.dismissPopUpMessage))
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
|
-
|
|
105
|
+
|
|
106
106
|
func onError(dataModel: RemoteProcessingModel) {
|
|
107
107
|
triggerEvent(eventName:"onError",dataModel:dataModel)
|
|
108
108
|
DispatchQueue.main.async {
|
|
@@ -111,8 +111,8 @@ class IDCardController: UIViewController ,ScanIDCardDelegate , ChildViewControll
|
|
|
111
111
|
self.popUpMessage = showPopUpMessage(view: self.view, title: "Unable to extract", subTitle: "Let's try again",initialTextColorHex:self.processingColor,initialBackgroundColorHex:self.holdHandColor, iconName: "warning", isGif: false,target: self, action: #selector(self.dismissPopUpMessage))
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
|
-
|
|
115
|
-
|
|
114
|
+
|
|
115
|
+
|
|
116
116
|
func onRetry(dataModel: RemoteProcessingModel) {
|
|
117
117
|
triggerEvent(eventName:"onRetry",dataModel:dataModel)
|
|
118
118
|
DispatchQueue.main.async {
|
|
@@ -121,7 +121,7 @@ class IDCardController: UIViewController ,ScanIDCardDelegate , ChildViewControll
|
|
|
121
121
|
self.popUpMessage = showPopUpMessage(view: self.view, title: "Unable to extract", subTitle: "Let's try again",initialTextColorHex:self.processingColor,initialBackgroundColorHex:self.holdHandColor, iconName: "warning", isGif: false,target: self, action: #selector(self.dismissPopUpMessage))
|
|
122
122
|
}
|
|
123
123
|
}
|
|
124
|
-
|
|
124
|
+
|
|
125
125
|
func onLivenessUpdate(dataModel: RemoteProcessingModel) {
|
|
126
126
|
triggerEvent(eventName:"onLivenessUpdate",dataModel:dataModel)
|
|
127
127
|
DispatchQueue.main.async {
|
|
@@ -130,7 +130,7 @@ class IDCardController: UIViewController ,ScanIDCardDelegate , ChildViewControll
|
|
|
130
130
|
self.popUpMessage = showPopUpMessage(view: self.view, title: "Failed ID Check", subTitle: "Please real ID (Not copy)",initialTextColorHex:self.processingColor,initialBackgroundColorHex:self.holdHandColor, iconName: "id_warning", isGif: false,target: self, action: #selector(self.dismissPopUpMessage))
|
|
131
131
|
}
|
|
132
132
|
}
|
|
133
|
-
|
|
133
|
+
|
|
134
134
|
func onWrongTemplate(dataModel:RemoteProcessingModel) {
|
|
135
135
|
triggerEvent(eventName:"onWrongTemplate",dataModel:dataModel)
|
|
136
136
|
DispatchQueue.main.async {
|
|
@@ -158,16 +158,16 @@ class IDCardController: UIViewController ,ScanIDCardDelegate , ChildViewControll
|
|
|
158
158
|
self.triggerCompleteEvent(eventName:"onComplete",dataModel: dataModel.iDExtractedModel)
|
|
159
159
|
|
|
160
160
|
outputResultProperties!.merge((dataModel.iDExtractedModel?.transformedProperties)!) { (_, new) in new }
|
|
161
|
-
|
|
161
|
+
|
|
162
162
|
self.start = false
|
|
163
163
|
DispatchQueue.main.async {
|
|
164
164
|
self.popUpMessage!.removeFromSuperview();
|
|
165
165
|
(self.infoLabel, self.infoImage) = showInfo(view: self.view, text: "Please Present Your ID",initialTextColorHex:self.processingColor,initialBackgroundColorHex:self.holdHandColor,initialImageName:"info_icon")
|
|
166
|
-
|
|
166
|
+
|
|
167
167
|
if(self._kycDocumentDetails.count == 1){
|
|
168
168
|
self.imageUrl = dataModel.iDExtractedModel?.imageUrl;
|
|
169
169
|
}
|
|
170
|
-
|
|
170
|
+
|
|
171
171
|
if(order == self._kycDocumentDetails.count-1 ){
|
|
172
172
|
|
|
173
173
|
if let outputProperties = try? JSONSerialization.data(withJSONObject: self.outputResultProperties, options: []) {
|
|
@@ -176,8 +176,8 @@ class IDCardController: UIViewController ,ScanIDCardDelegate , ChildViewControll
|
|
|
176
176
|
DispatchQueue.main.async {
|
|
177
177
|
self.dismiss(animated: false)
|
|
178
178
|
}
|
|
179
|
-
|
|
180
|
-
|
|
179
|
+
|
|
180
|
+
|
|
181
181
|
}else{
|
|
182
182
|
if(self.flippingCard){
|
|
183
183
|
let flippingCardUI = showFlippingCard(view: self.view);
|
|
@@ -188,10 +188,10 @@ class IDCardController: UIViewController ,ScanIDCardDelegate , ChildViewControll
|
|
|
188
188
|
if(order == 0){
|
|
189
189
|
self.imageUrl = dataModel.iDExtractedModel?.imageUrl;
|
|
190
190
|
}
|
|
191
|
-
|
|
191
|
+
|
|
192
192
|
}
|
|
193
193
|
}
|
|
194
|
-
|
|
194
|
+
|
|
195
195
|
}
|
|
196
196
|
|
|
197
197
|
func onCardDetected(dataModel: RemoteProcessingModel) {
|
|
@@ -239,46 +239,55 @@ class IDCardController: UIViewController ,ScanIDCardDelegate , ChildViewControll
|
|
|
239
239
|
triggerEvent(eventName:"onUploadFailed",dataModel:dataModel)
|
|
240
240
|
}
|
|
241
241
|
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
242
|
+
func onEnvironmentalConditionsChange( brightnessEvents: BrightnessEvents,motion: MotionType,zoom: ZoomType) {
|
|
243
|
+
DispatchQueue.main.async {
|
|
244
|
+
if self.start == false {
|
|
245
|
+
if (zoom != ZoomType.SENDING && zoom != ZoomType.NO_DETECT) {
|
|
246
|
+
if (zoom == ZoomType.ZOOM_IN) {
|
|
247
|
+
self.start = false
|
|
248
|
+
self.infoLabel?.text = "Move ID Closer"
|
|
249
|
+
self.infoImage!.image = UIImage(named: "zoom_in")
|
|
250
|
+
}
|
|
251
|
+
if (zoom == ZoomType.ZOOM_OUT) {
|
|
252
|
+
self.start = false
|
|
253
|
+
self.infoLabel?.text = "Move ID Further"
|
|
254
|
+
self.infoImage!.image = UIImage(named: "zoom_out")
|
|
255
|
+
}
|
|
256
|
+
} else if (motion != MotionType.SENDING && motion != MotionType.NO_DETECT) {
|
|
257
|
+
self.start = false
|
|
258
|
+
self.infoLabel?.text = "Please Hold Your Hand"
|
|
259
|
+
self.infoImage!.image = UIImage(named: "info_icon")
|
|
260
|
+
} else if brightnessEvents != BrightnessEvents.Good {
|
|
261
|
+
if brightnessEvents == BrightnessEvents.TooDark {
|
|
262
|
+
self.start = false
|
|
263
|
+
self.infoLabel?.text = "Please increase the lighting"
|
|
264
|
+
self.infoImage!.image = UIImage(named: "info_icon")
|
|
265
|
+
}
|
|
266
|
+
if brightnessEvents == BrightnessEvents.TooBright {
|
|
267
|
+
self.start = false
|
|
268
|
+
self.infoLabel?.text = "Please reduce the lighting"
|
|
269
|
+
self.infoImage!.image = UIImage(named: "info_icon")
|
|
270
|
+
}
|
|
271
|
+
} else {
|
|
272
|
+
if (motion == MotionType.SENDING && zoom == ZoomType.SENDING && brightnessEvents == BrightnessEvents.Good) {
|
|
273
|
+
self.start = false
|
|
274
|
+
self.infoLabel?.text = "Hold Steady"
|
|
275
|
+
self.infoImage!.image = UIImage(named: "info_icon")
|
|
276
|
+
}
|
|
277
|
+
if (motion == MotionType.NO_DETECT && zoom == ZoomType.NO_DETECT) {
|
|
278
|
+
self.start = false
|
|
279
|
+
self.infoLabel?.text = "Please present ID"
|
|
280
|
+
self.infoImage!.image = UIImage(named: "info_icon")
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
} else {
|
|
284
|
+
self.infoLabel?.removeFromSuperview()
|
|
285
|
+
self.infoImage?.removeFromSuperview()
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
}
|
|
290
|
+
|
|
282
291
|
func triggerCompleteEvent(eventName:String, dataModel: IDExtractedModel?){
|
|
283
292
|
var eventResultMap: [String: Any] = [:]
|
|
284
293
|
if(dataModel != nil){
|
|
@@ -303,7 +312,7 @@ class IDCardController: UIViewController ,ScanIDCardDelegate , ChildViewControll
|
|
|
303
312
|
|
|
304
313
|
}
|
|
305
314
|
|
|
306
|
-
|
|
315
|
+
|
|
307
316
|
|
|
308
317
|
|
|
309
318
|
|
|
@@ -8,8 +8,8 @@ class OtherController: UIViewController ,ScanOtherDelegate , ChildViewController
|
|
|
8
8
|
{
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
|
|
12
|
+
|
|
13
13
|
private var isDone:Bool = false;
|
|
14
14
|
private var assentifySdk:AssentifySdk?;
|
|
15
15
|
private var start:Bool = false;
|
|
@@ -23,9 +23,9 @@ class OtherController: UIViewController ,ScanOtherDelegate , ChildViewController
|
|
|
23
23
|
private var apiKey: String;
|
|
24
24
|
private var nativeAssentifySdk:NativeAssentifySdk?;
|
|
25
25
|
|
|
26
|
-
|
|
27
26
|
|
|
28
|
-
|
|
27
|
+
|
|
28
|
+
|
|
29
29
|
init(assentifySdk: AssentifySdk,nativeAssentifySdk:NativeAssentifySdk,holdHandColor: String,processingColor: String, language: String,showCountDown:Bool,apiKey:String) {
|
|
30
30
|
self.assentifySdk = assentifySdk
|
|
31
31
|
self.nativeAssentifySdk = nativeAssentifySdk
|
|
@@ -41,7 +41,7 @@ class OtherController: UIViewController ,ScanOtherDelegate , ChildViewController
|
|
|
41
41
|
required init?(coder: NSCoder) {
|
|
42
42
|
fatalError("init(coder:) has not been implemented")
|
|
43
43
|
}
|
|
44
|
-
|
|
44
|
+
|
|
45
45
|
override var prefersStatusBarHidden: Bool {
|
|
46
46
|
return false
|
|
47
47
|
}
|
|
@@ -72,15 +72,15 @@ class OtherController: UIViewController ,ScanOtherDelegate , ChildViewController
|
|
|
72
72
|
self.dismiss(animated: false)
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
|
-
|
|
75
|
+
|
|
76
76
|
func dismissParentViewController() {
|
|
77
77
|
triggerEvent(eventName:"onBackClick",dataModel:nil)
|
|
78
78
|
DispatchQueue.main.async {
|
|
79
79
|
self.dismiss(animated: false)
|
|
80
80
|
}
|
|
81
|
-
|
|
81
|
+
|
|
82
82
|
}
|
|
83
|
-
|
|
83
|
+
|
|
84
84
|
@objc func dismissPopUpMessage() {
|
|
85
85
|
DispatchQueue.main.async {
|
|
86
86
|
if(!self.start){
|
|
@@ -88,9 +88,9 @@ class OtherController: UIViewController ,ScanOtherDelegate , ChildViewController
|
|
|
88
88
|
(self.infoLabel, self.infoImage) = showInfo(view: self.view, text: "Please Present Your ID",initialTextColorHex:self.processingColor,initialBackgroundColorHex:self.holdHandColor,initialImageName:"info_icon")
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
|
-
|
|
91
|
+
|
|
92
92
|
}
|
|
93
|
-
|
|
93
|
+
|
|
94
94
|
func onSend() {
|
|
95
95
|
triggerEvent(eventName:"onSend",dataModel:nil)
|
|
96
96
|
DispatchQueue.main.async {
|
|
@@ -101,7 +101,7 @@ class OtherController: UIViewController ,ScanOtherDelegate , ChildViewController
|
|
|
101
101
|
self.popUpMessage = showPopUpMessage(view: self.view, title: "Transmitting", subTitle: "",initialTextColorHex:self.processingColor,initialBackgroundColorHex:self.holdHandColor, iconName: "id", isGif: true,target: self, action: #selector(self.dismissPopUpMessage))
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
|
-
|
|
104
|
+
|
|
105
105
|
func onError(dataModel: RemoteProcessingModel) {
|
|
106
106
|
triggerEvent(eventName:"onError",dataModel:dataModel)
|
|
107
107
|
DispatchQueue.main.async {
|
|
@@ -110,8 +110,8 @@ class OtherController: UIViewController ,ScanOtherDelegate , ChildViewController
|
|
|
110
110
|
self.popUpMessage = showPopUpMessage(view: self.view, title: "Unable to extract", subTitle: "Let's try again",initialTextColorHex:self.processingColor,initialBackgroundColorHex:self.holdHandColor, iconName: "warning", isGif: false,target: self, action: #selector(self.dismissPopUpMessage))
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
|
-
|
|
114
|
-
|
|
113
|
+
|
|
114
|
+
|
|
115
115
|
func onRetry(dataModel: RemoteProcessingModel) {
|
|
116
116
|
triggerEvent(eventName:"onRetry",dataModel:dataModel)
|
|
117
117
|
DispatchQueue.main.async {
|
|
@@ -120,7 +120,7 @@ class OtherController: UIViewController ,ScanOtherDelegate , ChildViewController
|
|
|
120
120
|
self.popUpMessage = showPopUpMessage(view: self.view, title: "Unable to extract", subTitle: "Let's try again",initialTextColorHex:self.processingColor,initialBackgroundColorHex:self.holdHandColor, iconName: "warning", isGif: false,target: self, action: #selector(self.dismissPopUpMessage))
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
|
-
|
|
123
|
+
|
|
124
124
|
func onLivenessUpdate(dataModel: RemoteProcessingModel) {
|
|
125
125
|
triggerEvent(eventName:"onLivenessUpdate",dataModel:dataModel)
|
|
126
126
|
DispatchQueue.main.async {
|
|
@@ -129,7 +129,7 @@ class OtherController: UIViewController ,ScanOtherDelegate , ChildViewController
|
|
|
129
129
|
self.popUpMessage = showPopUpMessage(view: self.view, title: "Failed ID Check", subTitle: "Please real ID (Not copy)",initialTextColorHex:self.processingColor,initialBackgroundColorHex:self.holdHandColor, iconName: "id_warning", isGif: false,target: self, action: #selector(self.dismissPopUpMessage))
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
|
-
|
|
132
|
+
|
|
133
133
|
|
|
134
134
|
func onClipPreparationComplete(dataModel: RemoteProcessingModel) {
|
|
135
135
|
triggerEvent(eventName:"onClipPreparationComplete",dataModel:dataModel)
|
|
@@ -154,7 +154,7 @@ class OtherController: UIViewController ,ScanOtherDelegate , ChildViewController
|
|
|
154
154
|
DispatchQueue.main.async {
|
|
155
155
|
self.dismiss(animated: false)
|
|
156
156
|
}
|
|
157
|
-
|
|
157
|
+
|
|
158
158
|
}
|
|
159
159
|
|
|
160
160
|
|
|
@@ -205,45 +205,54 @@ class OtherController: UIViewController ,ScanOtherDelegate , ChildViewController
|
|
|
205
205
|
triggerEvent(eventName:"onUploadFailed",dataModel:dataModel)
|
|
206
206
|
}
|
|
207
207
|
|
|
208
|
-
func onEnvironmentalConditionsChange(
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
208
|
+
func onEnvironmentalConditionsChange( brightnessEvents: BrightnessEvents,motion: MotionType,zoom: ZoomType) {
|
|
209
|
+
DispatchQueue.main.async {
|
|
210
|
+
if self.start == false {
|
|
211
|
+
if (zoom != ZoomType.SENDING && zoom != ZoomType.NO_DETECT) {
|
|
212
|
+
if (zoom == ZoomType.ZOOM_IN) {
|
|
213
|
+
self.start = false
|
|
214
|
+
self.infoLabel?.text = "Move ID Closer"
|
|
215
|
+
self.infoImage!.image = UIImage(named: "zoom_in")
|
|
216
|
+
}
|
|
217
|
+
if (zoom == ZoomType.ZOOM_OUT) {
|
|
218
|
+
self.start = false
|
|
219
|
+
self.infoLabel?.text = "Move ID Further"
|
|
220
|
+
self.infoImage!.image = UIImage(named: "zoom_out")
|
|
221
|
+
}
|
|
222
|
+
} else if (motion != MotionType.SENDING && motion != MotionType.NO_DETECT) {
|
|
223
|
+
self.start = false
|
|
224
|
+
self.infoLabel?.text = "Please Hold Your Hand"
|
|
225
|
+
self.infoImage!.image = UIImage(named: "info_icon")
|
|
226
|
+
} else if brightnessEvents != BrightnessEvents.Good {
|
|
227
|
+
if brightnessEvents == BrightnessEvents.TooDark {
|
|
228
|
+
self.start = false
|
|
229
|
+
self.infoLabel?.text = "Please increase the lighting"
|
|
230
|
+
self.infoImage!.image = UIImage(named: "info_icon")
|
|
231
|
+
}
|
|
232
|
+
if brightnessEvents == BrightnessEvents.TooBright {
|
|
233
|
+
self.start = false
|
|
234
|
+
self.infoLabel?.text = "Please reduce the lighting"
|
|
235
|
+
self.infoImage!.image = UIImage(named: "info_icon")
|
|
236
|
+
}
|
|
237
|
+
} else {
|
|
238
|
+
if (motion == MotionType.SENDING && zoom == ZoomType.SENDING && brightnessEvents == BrightnessEvents.Good) {
|
|
239
|
+
self.start = false
|
|
240
|
+
self.infoLabel?.text = "Hold Steady"
|
|
241
|
+
self.infoImage!.image = UIImage(named: "info_icon")
|
|
242
|
+
}
|
|
243
|
+
if (motion == MotionType.NO_DETECT && zoom == ZoomType.NO_DETECT) {
|
|
244
|
+
self.start = false
|
|
245
|
+
self.infoLabel?.text = "Please present ID"
|
|
246
|
+
self.infoImage!.image = UIImage(named: "info_icon")
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
} else {
|
|
250
|
+
self.infoLabel?.removeFromSuperview()
|
|
251
|
+
self.infoImage?.removeFromSuperview()
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
}
|
|
247
256
|
|
|
248
257
|
|
|
249
258
|
|
|
@@ -274,7 +283,7 @@ class OtherController: UIViewController ,ScanOtherDelegate , ChildViewController
|
|
|
274
283
|
|
|
275
284
|
}
|
|
276
285
|
|
|
277
|
-
|
|
286
|
+
|
|
278
287
|
|
|
279
288
|
|
|
280
289
|
}
|