assentify-sdk-react-native 1.0.0-Beta.4 → 1.0.0-Beta.41

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.
Files changed (107) hide show
  1. package/Package.swift +172 -0
  2. package/README.md +124 -32
  3. package/android/build.gradle +1 -6
  4. package/android/src/main/java/com/assentifysdk/AssentifySdkModule.kt +48 -9
  5. package/android/src/main/java/com/assentifysdk/FlowActivity.kt +75 -7
  6. package/android/src/main/java/com/assentifysdk/ScanIDActivity.kt +67 -6
  7. package/android/src/main/java/com/assentifysdk/ScanPassportActivity.kt +53 -1
  8. package/android/src/main/res/layout/activity_scan.xml +45 -57
  9. package/ios/AssentifySdkBaseModule.swift +1 -0
  10. package/ios/NativeAssentifySdk.mm +19 -2
  11. package/ios/NativeAssentifySdk.swift +151 -25
  12. package/ios/UIComponents/RNPassportScanner.swift +4 -3
  13. package/ios/View/AssentifySdkEventEmitting.swift +10 -0
  14. package/ios/View/DataDecoder.swift +16 -16
  15. package/ios/View/FaceMatchController.swift +51 -51
  16. package/ios/View/IDCardController.swift +93 -37
  17. package/ios/View/OtherController.swift +33 -33
  18. package/ios/View/PassportController.swift +84 -36
  19. package/ios/View/QrController.swift +10 -10
  20. package/ios/View/UI.swift +77 -26
  21. package/lib/commonjs/AssentifyProvider.js +3 -0
  22. package/lib/commonjs/AssentifyProvider.js.map +1 -1
  23. package/lib/commonjs/AssentifyWrapper.js +4 -4
  24. package/lib/commonjs/AssentifyWrapper.js.map +1 -1
  25. package/lib/commonjs/ClickFontWeightType.js +14 -0
  26. package/lib/commonjs/ClickFontWeightType.js.map +1 -0
  27. package/lib/commonjs/FlowStepperType.js +11 -0
  28. package/lib/commonjs/FlowStepperType.js.map +1 -0
  29. package/lib/commonjs/Language.js +5 -1
  30. package/lib/commonjs/Language.js.map +1 -1
  31. package/lib/commonjs/ValidationStyleType.js +11 -0
  32. package/lib/commonjs/ValidationStyleType.js.map +1 -0
  33. package/lib/commonjs/index.js +36 -0
  34. package/lib/commonjs/index.js.map +1 -1
  35. package/lib/commonjs/types.js.map +1 -1
  36. package/lib/module/AssentifyProvider.js +4 -0
  37. package/lib/module/AssentifyProvider.js.map +1 -1
  38. package/lib/module/AssentifyWrapper.js +4 -4
  39. package/lib/module/AssentifyWrapper.js.map +1 -1
  40. package/lib/module/ClickFontWeightType.js +8 -0
  41. package/lib/module/ClickFontWeightType.js.map +1 -0
  42. package/lib/module/FlowStepperType.js +5 -0
  43. package/lib/module/FlowStepperType.js.map +1 -0
  44. package/lib/module/Language.js +4 -0
  45. package/lib/module/Language.js.map +1 -1
  46. package/lib/module/ValidationStyleType.js +5 -0
  47. package/lib/module/ValidationStyleType.js.map +1 -0
  48. package/lib/module/index.js +3 -0
  49. package/lib/module/index.js.map +1 -1
  50. package/lib/module/types.js.map +1 -1
  51. package/lib/typescript/babel.config.d.ts +0 -1
  52. package/lib/typescript/example/babel.config.d.ts +36 -5
  53. package/lib/typescript/example/babel.config.d.ts.map +1 -1
  54. package/lib/typescript/example/metro.config.d.ts +9 -1
  55. package/lib/typescript/example/metro.config.d.ts.map +1 -1
  56. package/lib/typescript/example/react-native.config.d.ts +34 -3
  57. package/lib/typescript/example/react-native.config.d.ts.map +1 -1
  58. package/lib/typescript/example/src/App.d.ts.map +1 -1
  59. package/lib/typescript/example/src/Home.d.ts.map +1 -1
  60. package/lib/typescript/lib/commonjs/AssentifyProvider.d.ts.map +1 -1
  61. package/lib/typescript/lib/commonjs/AssentifyWrapper.d.ts +2 -2
  62. package/lib/typescript/lib/commonjs/AssentifyWrapper.d.ts.map +1 -1
  63. package/lib/typescript/lib/commonjs/ClickFontWeightType.d.ts +9 -0
  64. package/lib/typescript/lib/commonjs/ClickFontWeightType.d.ts.map +1 -0
  65. package/lib/typescript/lib/commonjs/FlowStepperType.d.ts +6 -0
  66. package/lib/typescript/lib/commonjs/FlowStepperType.d.ts.map +1 -0
  67. package/lib/typescript/lib/commonjs/Language.d.ts +6 -0
  68. package/lib/typescript/lib/commonjs/ValidationStyleType.d.ts +6 -0
  69. package/lib/typescript/lib/commonjs/ValidationStyleType.d.ts.map +1 -0
  70. package/lib/typescript/lib/module/AssentifyProvider.d.ts.map +1 -1
  71. package/lib/typescript/lib/module/AssentifyWrapper.d.ts +2 -2
  72. package/lib/typescript/lib/module/AssentifyWrapper.d.ts.map +1 -1
  73. package/lib/typescript/lib/module/ClickFontWeightType.d.ts +8 -0
  74. package/lib/typescript/lib/module/ClickFontWeightType.d.ts.map +1 -0
  75. package/lib/typescript/lib/module/FlowStepperType.d.ts +5 -0
  76. package/lib/typescript/lib/module/FlowStepperType.d.ts.map +1 -0
  77. package/lib/typescript/lib/module/Language.d.ts +6 -0
  78. package/lib/typescript/lib/module/ValidationStyleType.d.ts +5 -0
  79. package/lib/typescript/lib/module/ValidationStyleType.d.ts.map +1 -0
  80. package/lib/typescript/lib/module/index.d.ts +5 -2
  81. package/lib/typescript/lib/module/index.d.ts.map +1 -1
  82. package/lib/typescript/src/AssentifyProvider.d.ts.map +1 -1
  83. package/lib/typescript/src/AssentifyWrapper.d.ts +6 -2
  84. package/lib/typescript/src/AssentifyWrapper.d.ts.map +1 -1
  85. package/lib/typescript/src/ClickFontWeightType.d.ts +9 -0
  86. package/lib/typescript/src/ClickFontWeightType.d.ts.map +1 -0
  87. package/lib/typescript/src/FlowStepperType.d.ts +6 -0
  88. package/lib/typescript/src/FlowStepperType.d.ts.map +1 -0
  89. package/lib/typescript/src/Language.d.ts +5 -0
  90. package/lib/typescript/src/Language.d.ts.map +1 -1
  91. package/lib/typescript/src/ValidationStyleType.d.ts +6 -0
  92. package/lib/typescript/src/ValidationStyleType.d.ts.map +1 -0
  93. package/lib/typescript/src/index.d.ts +5 -2
  94. package/lib/typescript/src/index.d.ts.map +1 -1
  95. package/lib/typescript/src/types.d.ts.map +1 -1
  96. package/package.json +63 -10
  97. package/src/AssentifyProvider.tsx +341 -305
  98. package/src/AssentifyWrapper.ts +47 -6
  99. package/src/ClickFontWeightType.ts +10 -0
  100. package/src/FlowStepperType.ts +7 -0
  101. package/src/Language.ts +7 -0
  102. package/src/ValidationStyleType.ts +7 -0
  103. package/src/index.ts +3 -0
  104. package/src/types.ts +1 -0
  105. package/assentify-sdk.podspec +0 -44
  106. package/lib/typescript/example/src/navigator.d.ts +0 -4
  107. package/lib/typescript/example/src/navigator.d.ts.map +0 -1
@@ -4,11 +4,11 @@ import UIKit
4
4
  import AVFoundation
5
5
  import AssentifySdk
6
6
 
7
- class OtherController: UIViewController ,ScanOtherDelegate , ChildViewControllerDelegate
7
+ public class OtherController: UIViewController ,ScanOtherDelegate , ChildViewControllerDelegate
8
8
  {
9
9
 
10
10
 
11
- func onUploadingProgress(progress: Double) {
11
+ public func onUploadingProgress(progress: Double) {
12
12
  // NOTHING TODO
13
13
  }
14
14
 
@@ -24,13 +24,13 @@ class OtherController: UIViewController ,ScanOtherDelegate , ChildViewController
24
24
  private var processingColor: String;
25
25
  private var language: String;
26
26
  private var apiKey: String;
27
- private var nativeAssentifySdk:NativeAssentifySdk?;
27
+ private var nativeAssentifySdk:(any AssentifySdkEventEmitting)?;
28
28
  private var scanOther:ScanOther?;
29
29
  private var stepID:Int;
30
30
  private var manualClickColor: String;
31
31
  private var takePhotoButton: UIButton?;
32
32
 
33
- init(assentifySdk: AssentifySdk,nativeAssentifySdk:NativeAssentifySdk,holdHandColor: String,processingColor: String, language: String,showCountDown:Bool,apiKey:String,stepID:Int,manualClickColor:String) {
33
+ public init(assentifySdk: AssentifySdk,nativeAssentifySdk:any AssentifySdkEventEmitting,holdHandColor: String,processingColor: String, language: String,showCountDown:Bool,apiKey:String,stepID:Int,manualClickColor:String) {
34
34
  self.assentifySdk = assentifySdk
35
35
  self.nativeAssentifySdk = nativeAssentifySdk
36
36
  self.holdHandColor = holdHandColor
@@ -44,14 +44,14 @@ class OtherController: UIViewController ,ScanOtherDelegate , ChildViewController
44
44
  }
45
45
 
46
46
 
47
- required init?(coder: NSCoder) {
47
+ public required init?(coder: NSCoder) {
48
48
  fatalError("init(coder:) has not been implemented")
49
49
  }
50
50
 
51
- override var prefersStatusBarHidden: Bool {
51
+ public override var prefersStatusBarHidden: Bool {
52
52
  return false
53
53
  }
54
- override func viewDidLoad() {
54
+ public override func viewDidLoad() {
55
55
  super.viewDidLoad()
56
56
  self.view.backgroundColor = .clear
57
57
  UIApplication.shared.isStatusBarHidden = false;
@@ -131,7 +131,7 @@ class OtherController: UIViewController ,ScanOtherDelegate , ChildViewController
131
131
 
132
132
  }
133
133
 
134
- func onSend() {
134
+ public func onSend() {
135
135
  triggerEvent(eventName:"onSend",dataModel:nil)
136
136
  DispatchQueue.main.async {
137
137
  if(self.popUpMessage != nil){
@@ -142,7 +142,7 @@ class OtherController: UIViewController ,ScanOtherDelegate , ChildViewController
142
142
  }
143
143
  }
144
144
 
145
- func onError(dataModel: RemoteProcessingModel) {
145
+ public func onError(dataModel: RemoteProcessingModel) {
146
146
  triggerEvent(eventName:"onError",dataModel:dataModel)
147
147
  DispatchQueue.main.async {
148
148
  self.start = false;
@@ -152,7 +152,7 @@ class OtherController: UIViewController ,ScanOtherDelegate , ChildViewController
152
152
  }
153
153
 
154
154
 
155
- func onRetry(dataModel: RemoteProcessingModel) {
155
+ public func onRetry(dataModel: RemoteProcessingModel) {
156
156
  triggerEvent(eventName:"onRetry",dataModel:dataModel)
157
157
  DispatchQueue.main.async {
158
158
  self.start = false;
@@ -163,7 +163,7 @@ class OtherController: UIViewController ,ScanOtherDelegate , ChildViewController
163
163
  }
164
164
  }
165
165
 
166
- func onLivenessUpdate(dataModel: RemoteProcessingModel) {
166
+ public func onLivenessUpdate(dataModel: RemoteProcessingModel) {
167
167
  triggerEvent(eventName:"onLivenessUpdate",dataModel:dataModel)
168
168
  DispatchQueue.main.async {
169
169
  self.start = false;
@@ -173,20 +173,20 @@ class OtherController: UIViewController ,ScanOtherDelegate , ChildViewController
173
173
  }
174
174
 
175
175
 
176
- func onClipPreparationComplete(dataModel: RemoteProcessingModel) {
176
+ public func onClipPreparationComplete(dataModel: RemoteProcessingModel) {
177
177
  triggerEvent(eventName:"onClipPreparationComplete",dataModel:dataModel)
178
178
  }
179
179
 
180
- func onStatusUpdated(dataModel: RemoteProcessingModel) {
180
+ public func onStatusUpdated(dataModel: RemoteProcessingModel) {
181
181
  triggerEvent(eventName:"onStatusUpdated",dataModel:dataModel)
182
182
  }
183
183
 
184
- func onUpdated(dataModel: RemoteProcessingModel) {
184
+ public func onUpdated(dataModel: RemoteProcessingModel) {
185
185
  triggerEvent(eventName:"onUpdated",dataModel:dataModel)
186
186
  }
187
187
 
188
188
 
189
- func onComplete(dataModel: OtherResponseModel) {
189
+ public func onComplete(dataModel: OtherResponseModel) {
190
190
  if(!isDone){
191
191
  isDone = true;
192
192
  if let outputProperties = try? JSONSerialization.data(withJSONObject: dataModel.otherExtractedModel?.transformedProperties, options: []) {
@@ -211,48 +211,48 @@ class OtherController: UIViewController ,ScanOtherDelegate , ChildViewController
211
211
 
212
212
  }
213
213
 
214
- func onCardDetected(dataModel: RemoteProcessingModel) {
214
+ public func onCardDetected(dataModel: RemoteProcessingModel) {
215
215
  triggerEvent(eventName:"onCardDetected",dataModel:dataModel)
216
216
  }
217
217
 
218
- func onMrzExtracted(dataModel: RemoteProcessingModel) {
218
+ public func onMrzExtracted(dataModel: RemoteProcessingModel) {
219
219
  triggerEvent(eventName:"onMrzExtracted",dataModel:dataModel)
220
220
  }
221
221
 
222
- func onMrzDetected(dataModel: RemoteProcessingModel) {
222
+ public func onMrzDetected(dataModel: RemoteProcessingModel) {
223
223
  triggerEvent(eventName:"onMrzDetected",dataModel:dataModel)
224
224
  }
225
225
 
226
- func onNoMrzDetected(dataModel: RemoteProcessingModel) {
226
+ public func onNoMrzDetected(dataModel: RemoteProcessingModel) {
227
227
  triggerEvent(eventName:"onNoMrzDetected",dataModel:dataModel)
228
228
  }
229
229
 
230
230
 
231
- func onFaceDetected(dataModel: RemoteProcessingModel) {
231
+ public func onFaceDetected(dataModel: RemoteProcessingModel) {
232
232
  triggerEvent(eventName:"onFaceDetected",dataModel:dataModel)
233
233
  }
234
234
 
235
- func onNoFaceDetected(dataModel: RemoteProcessingModel) {
235
+ public func onNoFaceDetected(dataModel: RemoteProcessingModel) {
236
236
  triggerEvent(eventName:"onNoFaceDetected",dataModel:dataModel)
237
237
  }
238
238
 
239
- func onFaceExtracted(dataModel: RemoteProcessingModel) {
239
+ public func onFaceExtracted(dataModel: RemoteProcessingModel) {
240
240
  triggerEvent(eventName:"onFaceExtracted",dataModel:dataModel)
241
241
  }
242
242
 
243
- func onQualityCheckAvailable(dataModel: RemoteProcessingModel) {
243
+ public func onQualityCheckAvailable(dataModel: RemoteProcessingModel) {
244
244
  triggerEvent(eventName:"onQualityCheckAvailable",dataModel:dataModel)
245
245
  }
246
246
 
247
- func onDocumentCaptured(dataModel: RemoteProcessingModel) {
247
+ public func onDocumentCaptured(dataModel: RemoteProcessingModel) {
248
248
  triggerEvent(eventName:"onDocumentCaptured",dataModel:dataModel)
249
249
  }
250
250
 
251
- func onDocumentCropped(dataModel: RemoteProcessingModel) {
251
+ public func onDocumentCropped(dataModel: RemoteProcessingModel) {
252
252
  triggerEvent(eventName:"onDocumentCropped",dataModel:dataModel)
253
253
  }
254
254
 
255
- func onUploadFailed(dataModel: RemoteProcessingModel) {
255
+ public func onUploadFailed(dataModel: RemoteProcessingModel) {
256
256
  triggerEvent(eventName:"onUploadFailed",dataModel:dataModel)
257
257
  }
258
258
 
@@ -263,38 +263,38 @@ class OtherController: UIViewController ,ScanOtherDelegate , ChildViewController
263
263
  if (zoom == ZoomType.ZOOM_IN) {
264
264
  self.start = false
265
265
  self.infoLabel?.text = "Move ID Closer"
266
- self.infoImage!.image = UIImage(named: "zoom_in")
266
+ self.infoImage!.image = UIImage(named: "zoom_in", in: Bundle.module, compatibleWith: nil)
267
267
  }
268
268
  if (zoom == ZoomType.ZOOM_OUT) {
269
269
  self.start = false
270
270
  self.infoLabel?.text = "Move ID Further"
271
- self.infoImage!.image = UIImage(named: "zoom_out")
271
+ self.infoImage!.image = UIImage(named: "zoom_out", in: Bundle.module, compatibleWith: nil)
272
272
  }
273
273
  } else if (motion != MotionType.SENDING && motion != MotionType.NO_DETECT) {
274
274
  self.start = false
275
275
  self.infoLabel?.text = "Please Hold Your Hand"
276
- self.infoImage!.image = UIImage(named: "info_icon")
276
+ self.infoImage!.image = UIImage(named: "info_icon", in: Bundle.module, compatibleWith: nil)
277
277
  } else if brightnessEvents != BrightnessEvents.Good {
278
278
  if brightnessEvents == BrightnessEvents.TooDark {
279
279
  self.start = false
280
280
  self.infoLabel?.text = "Please increase the lighting"
281
- self.infoImage!.image = UIImage(named: "info_icon")
281
+ self.infoImage!.image = UIImage(named: "info_icon", in: Bundle.module, compatibleWith: nil)
282
282
  }
283
283
  if brightnessEvents == BrightnessEvents.TooBright {
284
284
  self.start = false
285
285
  self.infoLabel?.text = "Please reduce the lighting"
286
- self.infoImage!.image = UIImage(named: "info_icon")
286
+ self.infoImage!.image = UIImage(named: "info_icon", in: Bundle.module, compatibleWith: nil)
287
287
  }
288
288
  } else {
289
289
  if (motion == MotionType.SENDING && zoom == ZoomType.SENDING && brightnessEvents == BrightnessEvents.Good) {
290
290
  self.start = false
291
291
  self.infoLabel?.text = "Hold Steady"
292
- self.infoImage!.image = UIImage(named: "info_icon")
292
+ self.infoImage!.image = UIImage(named: "info_icon", in: Bundle.module, compatibleWith: nil)
293
293
  }
294
294
  if (motion == MotionType.NO_DETECT && zoom == ZoomType.NO_DETECT) {
295
295
  self.start = false
296
296
  self.infoLabel?.text = "Please present ID"
297
- self.infoImage!.image = UIImage(named: "info_icon")
297
+ self.infoImage!.image = UIImage(named: "info_icon", in: Bundle.module, compatibleWith: nil)
298
298
  }
299
299
  }
300
300
  } else {
@@ -4,17 +4,17 @@ import UIKit
4
4
  import AVFoundation
5
5
  import AssentifySdk
6
6
 
7
- class PassportController: UIViewController ,ScanPassportDelegate , ChildViewControllerDelegate
7
+ public class PassportController: UIViewController ,ScanPassportDelegate , ChildViewControllerDelegate
8
8
  {
9
9
 
10
10
 
11
- func onUploadingProgress(progress: Double) {
11
+ public func onUploadingProgress(progress: Double) {
12
12
  // NOTHING TODO
13
13
  }
14
14
 
15
15
 
16
16
  private var isDone:Bool = false;
17
- private var nativeAssentifySdk:NativeAssentifySdk?;
17
+ private var nativeAssentifySdk:(any AssentifySdkEventEmitting)?;
18
18
  private var assentifySdk:AssentifySdk?;
19
19
  private var start:Bool = false;
20
20
  var infoLabel : UILabel?;
@@ -32,7 +32,7 @@ class PassportController: UIViewController ,ScanPassportDelegate , ChildViewCont
32
32
 
33
33
 
34
34
 
35
- init(assentifySdk: AssentifySdk,nativeAssentifySdk:NativeAssentifySdk?,holdHandColor: String,processingColor: String,language:String,showCountDown:Bool,apiKey:String,stepID:Int,manualClickColor:String) {
35
+ public init(assentifySdk: AssentifySdk,nativeAssentifySdk:(any AssentifySdkEventEmitting)?,holdHandColor: String,processingColor: String,language:String,showCountDown:Bool,apiKey:String,stepID:Int,manualClickColor:String) {
36
36
  self.assentifySdk = assentifySdk
37
37
  self.nativeAssentifySdk = nativeAssentifySdk
38
38
  self.holdHandColor = holdHandColor
@@ -45,16 +45,16 @@ class PassportController: UIViewController ,ScanPassportDelegate , ChildViewCont
45
45
  super.init(nibName: nil, bundle: nil)
46
46
  }
47
47
 
48
- required init?(coder: NSCoder) {
48
+ public required init?(coder: NSCoder) {
49
49
  fatalError("init(coder:) has not been implemented")
50
50
  }
51
51
 
52
- override var prefersStatusBarHidden: Bool {
52
+ public override var prefersStatusBarHidden: Bool {
53
53
  return false
54
54
  }
55
55
 
56
56
 
57
- override func viewDidLoad() {
57
+ public override func viewDidLoad() {
58
58
  super.viewDidLoad()
59
59
  self.view.backgroundColor = .clear
60
60
  UIApplication.shared.isStatusBarHidden = false;
@@ -138,7 +138,7 @@ class PassportController: UIViewController ,ScanPassportDelegate , ChildViewCont
138
138
  }
139
139
 
140
140
  }
141
- func onSend() {
141
+ public func onSend() {
142
142
  triggerEvent(eventName:"onSend",dataModel:nil)
143
143
  DispatchQueue.main.async {
144
144
  if(self.popUpMessage != nil){
@@ -149,7 +149,7 @@ class PassportController: UIViewController ,ScanPassportDelegate , ChildViewCont
149
149
  }
150
150
  }
151
151
 
152
- func onError(dataModel: RemoteProcessingModel) {
152
+ public func onError(dataModel: RemoteProcessingModel) {
153
153
  triggerEvent(eventName:"onError",dataModel:dataModel)
154
154
  DispatchQueue.main.async {
155
155
  self.start = false;
@@ -159,7 +159,7 @@ class PassportController: UIViewController ,ScanPassportDelegate , ChildViewCont
159
159
  }
160
160
 
161
161
 
162
- func onRetry(dataModel: RemoteProcessingModel) {
162
+ public func onRetry(dataModel: RemoteProcessingModel) {
163
163
  triggerEvent(eventName:"onRetry",dataModel:dataModel)
164
164
  DispatchQueue.main.async {
165
165
  self.start = false;
@@ -171,16 +171,19 @@ class PassportController: UIViewController ,ScanPassportDelegate , ChildViewCont
171
171
  }
172
172
  }
173
173
 
174
- func onLivenessUpdate(dataModel: RemoteProcessingModel) {
174
+ public func onLivenessUpdate(dataModel: RemoteProcessingModel, image: UIImage?) {
175
175
  triggerEvent(eventName:"onLivenessUpdate",dataModel:dataModel)
176
176
  DispatchQueue.main.async {
177
+ self.scanPassport?.retryLiveness();
177
178
  self.start = false;
179
+ if( self.popUpMessage != nil){
178
180
  self.popUpMessage!.removeFromSuperview();
181
+ }
179
182
  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: "warning", isGif: false,target: self, action: #selector(self.dismissPopUpMessage))
180
183
  }
181
184
  }
182
185
 
183
- func onWrongTemplate(dataModel:RemoteProcessingModel) {
186
+ public func onWrongTemplate(dataModel:RemoteProcessingModel) {
184
187
  triggerEvent(eventName:"onWrongTemplate",dataModel:dataModel)
185
188
  DispatchQueue.main.async {
186
189
  self.start = false;
@@ -189,21 +192,21 @@ class PassportController: UIViewController ,ScanPassportDelegate , ChildViewCont
189
192
  }
190
193
  }
191
194
 
192
- func onClipPreparationComplete(dataModel: RemoteProcessingModel) {
195
+ public func onClipPreparationComplete(dataModel: RemoteProcessingModel) {
193
196
  triggerEvent(eventName:"onClipPreparationComplete",dataModel:dataModel)
194
197
  }
195
198
 
196
- func onStatusUpdated(dataModel: RemoteProcessingModel) {
199
+ public func onStatusUpdated(dataModel: RemoteProcessingModel) {
197
200
  triggerEvent(eventName:"onStatusUpdated",dataModel:dataModel)
198
201
  }
199
202
 
200
- func onUpdated(dataModel: RemoteProcessingModel) {
203
+ public func onUpdated(dataModel: RemoteProcessingModel) {
201
204
  triggerEvent(eventName:"onUpdated",dataModel:dataModel)
202
205
  }
203
206
 
204
207
 
205
208
 
206
- func onComplete(dataModel: PassportResponseModel) {
209
+ public func onComplete(dataModel: PassportResponseModel) {
207
210
 
208
211
  if(!isDone){
209
212
  isDone = true;
@@ -227,52 +230,97 @@ class PassportController: UIViewController ,ScanPassportDelegate , ChildViewCont
227
230
 
228
231
  }
229
232
 
230
- func onCardDetected(dataModel: RemoteProcessingModel) {
233
+ public func onCardDetected(dataModel: RemoteProcessingModel) {
231
234
  triggerEvent(eventName:"onCardDetected",dataModel:dataModel)
232
235
  }
233
236
 
234
- func onMrzExtracted(dataModel: RemoteProcessingModel) {
237
+ public func onMrzExtracted(dataModel: RemoteProcessingModel) {
235
238
  triggerEvent(eventName:"onMrzExtracted",dataModel:dataModel)
236
239
  }
237
240
 
238
- func onMrzDetected(dataModel: RemoteProcessingModel) {
241
+ public func onMrzDetected(dataModel: RemoteProcessingModel) {
239
242
  triggerEvent(eventName:"onMrzDetected",dataModel:dataModel)
240
243
  }
241
244
 
242
- func onNoMrzDetected(dataModel: RemoteProcessingModel) {
245
+ public func onNoMrzDetected(dataModel: RemoteProcessingModel) {
243
246
  triggerEvent(eventName:"onNoMrzDetected",dataModel:dataModel)
244
247
  }
245
248
 
246
249
 
247
- func onFaceDetected(dataModel: RemoteProcessingModel) {
250
+ public func onFaceDetected(dataModel: RemoteProcessingModel) {
248
251
  triggerEvent(eventName:"onFaceDetected",dataModel:dataModel)
249
252
  }
250
253
 
251
- func onNoFaceDetected(dataModel: RemoteProcessingModel) {
254
+ public func onNoFaceDetected(dataModel: RemoteProcessingModel) {
252
255
  triggerEvent(eventName:"onNoFaceDetected",dataModel:dataModel)
253
256
  }
254
257
 
255
- func onFaceExtracted(dataModel: RemoteProcessingModel) {
258
+ public func onFaceExtracted(dataModel: RemoteProcessingModel) {
256
259
  triggerEvent(eventName:"onFaceExtracted",dataModel:dataModel)
257
260
  }
258
261
 
259
- func onQualityCheckAvailable(dataModel: RemoteProcessingModel) {
262
+ public func onQualityCheckAvailable(dataModel: RemoteProcessingModel) {
260
263
  triggerEvent(eventName:"onQualityCheckAvailable",dataModel:dataModel)
261
264
  }
262
265
 
263
- func onDocumentCaptured(dataModel: RemoteProcessingModel) {
266
+ public func onDocumentCaptured(dataModel: RemoteProcessingModel) {
264
267
  triggerEvent(eventName:"onDocumentCaptured",dataModel:dataModel)
265
268
  }
266
269
 
267
- func onDocumentCropped(dataModel: RemoteProcessingModel) {
270
+ public func onDocumentCropped(dataModel: RemoteProcessingModel) {
268
271
  triggerEvent(eventName:"onDocumentCropped",dataModel:dataModel)
269
272
  }
270
273
 
271
- func onUploadFailed(dataModel: RemoteProcessingModel) {
274
+ public func onUploadFailed(dataModel: RemoteProcessingModel) {
272
275
  triggerEvent(eventName:"onUploadFailed",dataModel:dataModel)
273
276
  }
277
+
278
+
279
+ /// The liveness owns the message while it runs (not after "keep holding": the result is coming).
280
+ private var livenessActive = false
281
+
282
+ /// The liveness owns the message while it runs (not after "keep holding": the result is coming).
283
+
284
+ public func onLivenessInstruction(instruction: PassportLivenessInstruction, progress: Int) {
285
+ DispatchQueue.main.async {
286
+ self.livenessActive = instruction != .keepHolding
287
+
288
+ var text: String
289
+ switch instruction {
290
+ // ---------- position / flat hold / light ----------
291
+ case .placeDocument: text = "Place the photo page\nin the frame"
292
+ case .keepSteady, .keepFlat, .adjustPosition, .doNotMove:
293
+ text = "Keep it steady"
294
+ // ---------- tilt ----------
295
+ case .liftBottom: text = "Lift the bottom edge\ntoward you"
296
+ case .moveALittleMore: text = "A bit more\nand hold"
297
+ case .holdThere: text = "Hold it there"
298
+ case .otherSide: text = "Lift the bottom edge,\nnot the top"
299
+ case .holdItUp: text = "Hold the passport\nin your hand"
300
+ case .placeFlatAgain: text = "Place it flat again"
301
+ // ---------- done ----------
302
+ case .keepHolding: text = "Keep holding\nAlmost done"
303
+ // ---------- pauses (the SDK continues by itself after a few seconds) ----------
304
+ case .holdInHand: text = "Hold it in your hand\nnot on the table"
305
+ case .phoneTurned: text = "Keep the phone still\nTilt the passport"
306
+ case .tooBright: text = "Too much light\nMove to the shade"
307
+ @unknown default: text = ""
308
+ }
309
+
310
+ // the tilt progress (0..100), on its own line, only while the passport is being tilted
311
+ switch instruction {
312
+ case .liftBottom, .moveALittleMore, .holdThere, .otherSide, .holdItUp:
313
+ text += "\n\(progress)%"
314
+ default:
315
+ break
316
+ }
317
+
318
+ self.infoLabel?.text = text
319
+ self.infoImage?.image = UIImage(named: "info_icon", in: Bundle.module, compatibleWith: nil)
320
+ }
321
+ }
274
322
 
275
- func onEnvironmentalConditionsChange( brightnessEvents: BrightnessEvents,
323
+ public func onEnvironmentalConditionsChange( brightnessEvents: BrightnessEvents,
276
324
  motion: MotionType,
277
325
  zoom: ZoomType,
278
326
  isCentered:Bool) {
@@ -282,42 +330,42 @@ class PassportController: UIViewController ,ScanPassportDelegate , ChildViewCont
282
330
  if (zoom == ZoomType.ZOOM_IN) {
283
331
  self.start = false
284
332
  self.infoLabel?.text = "Move Passport Closer"
285
- self.infoImage!.image = UIImage(named: "zoom_in")
333
+ self.infoImage!.image = UIImage(named: "zoom_in", in: Bundle.module, compatibleWith: nil)
286
334
  }
287
335
  if (zoom == ZoomType.ZOOM_OUT) {
288
336
  self.start = false
289
337
  self.infoLabel?.text = "Move Passport Further"
290
- self.infoImage!.image = UIImage(named: "zoom_out")
338
+ self.infoImage!.image = UIImage(named: "zoom_out", in: Bundle.module, compatibleWith: nil)
291
339
  }
292
340
  } else if (motion != MotionType.SENDING && motion != MotionType.NO_DETECT) {
293
341
  self.start = false
294
342
  self.infoLabel?.text = "Please Hold Your Hand"
295
- self.infoImage!.image = UIImage(named: "info_icon")
343
+ self.infoImage!.image = UIImage(named: "info_icon", in: Bundle.module, compatibleWith: nil)
296
344
  } else if brightnessEvents != BrightnessEvents.Good {
297
345
  if brightnessEvents == BrightnessEvents.TooDark {
298
346
  self.start = false
299
347
  self.infoLabel?.text = "Please increase the lighting"
300
- self.infoImage!.image = UIImage(named: "info_icon")
348
+ self.infoImage!.image = UIImage(named: "info_icon", in: Bundle.module, compatibleWith: nil)
301
349
  }
302
350
  if brightnessEvents == BrightnessEvents.TooBright {
303
351
  self.start = false
304
352
  self.infoLabel?.text = "Please reduce the lighting"
305
- self.infoImage!.image = UIImage(named: "info_icon")
353
+ self.infoImage!.image = UIImage(named: "info_icon", in: Bundle.module, compatibleWith: nil)
306
354
  }
307
355
  } else {
308
356
  if (motion == MotionType.SENDING && zoom == ZoomType.SENDING && brightnessEvents == BrightnessEvents.Good) {
309
357
  self.start = false
310
358
  self.infoLabel?.text = "Hold Steady"
311
- self.infoImage!.image = UIImage(named: "info_icon")
359
+ self.infoImage!.image = UIImage(named: "info_icon", in: Bundle.module, compatibleWith: nil)
312
360
  }
313
361
  if (motion == MotionType.NO_DETECT && zoom == ZoomType.NO_DETECT) {
314
362
  self.start = false
315
363
  self.infoLabel?.text = "Please present passport"
316
- self.infoImage!.image = UIImage(named: "info_icon")
364
+ self.infoImage!.image = UIImage(named: "info_icon", in: Bundle.module, compatibleWith: nil)
317
365
  } else if(!isCentered){
318
366
  self.start = false
319
367
  self.infoLabel?.text = " Please center your card"
320
- self.infoImage!.image = UIImage(named: "info_icon")
368
+ self.infoImage!.image = UIImage(named: "info_icon", in: Bundle.module, compatibleWith: nil)
321
369
  }
322
370
 
323
371
  }
@@ -3,12 +3,12 @@ import UIKit
3
3
  import AVFoundation
4
4
  import AssentifySdk
5
5
 
6
- class QrController: UIViewController ,ScanQrDelegate , ChildViewControllerDelegate
6
+ public class QrController: UIViewController ,ScanQrDelegate , ChildViewControllerDelegate
7
7
  {
8
8
 
9
9
 
10
10
 
11
- func onUploadingProgress(progress: Double) {
11
+ public func onUploadingProgress(progress: Double) {
12
12
  // NOTHING TODO
13
13
  }
14
14
 
@@ -27,7 +27,7 @@ class QrController: UIViewController ,ScanQrDelegate , ChildViewControllerDelega
27
27
  private var showCountDown:Bool = true;
28
28
  private var templatesByCountry: TemplatesByCountry;
29
29
  private var titleID:String? = "";
30
- private var nativeAssentifySdk:NativeAssentifySdk?;
30
+ private var nativeAssentifySdk:(any AssentifySdkEventEmitting)?;
31
31
  private var outputResultProperties: [String: Any]? = [:];
32
32
  private var stepID:Int;
33
33
  private var manualClickColor: String;
@@ -35,7 +35,7 @@ class QrController: UIViewController ,ScanQrDelegate , ChildViewControllerDelega
35
35
  private var backIDPage: UIView?;
36
36
  private var scanQr:ScanQr?;
37
37
 
38
- init(assentifySdk: AssentifySdk,nativeAssentifySdk:NativeAssentifySdk,holdHandColor: String,processingColor: String,templatesByCountry: TemplatesByCountry,language:String,titleID:String,showCountDown:Bool,apiKey:String,stepID:Int,manualClickColor:String) {
38
+ public init(assentifySdk: AssentifySdk,nativeAssentifySdk:any AssentifySdkEventEmitting,holdHandColor: String,processingColor: String,templatesByCountry: TemplatesByCountry,language:String,titleID:String,showCountDown:Bool,apiKey:String,stepID:Int,manualClickColor:String) {
39
39
  self.assentifySdk = assentifySdk
40
40
  self.nativeAssentifySdk = nativeAssentifySdk
41
41
  self.holdHandColor = holdHandColor
@@ -50,14 +50,14 @@ class QrController: UIViewController ,ScanQrDelegate , ChildViewControllerDelega
50
50
  super.init(nibName: nil, bundle: nil)
51
51
  }
52
52
 
53
- required init?(coder: NSCoder) {
53
+ public required init?(coder: NSCoder) {
54
54
  fatalError("init(coder:) has not been implemented")
55
55
  }
56
56
 
57
- override var prefersStatusBarHidden: Bool {
57
+ public override var prefersStatusBarHidden: Bool {
58
58
  return false
59
59
  }
60
- override func viewDidLoad() {
60
+ public override func viewDidLoad() {
61
61
  super.viewDidLoad()
62
62
  self.view.backgroundColor = .clear
63
63
  UIApplication.shared.isStatusBarHidden = false;
@@ -135,7 +135,7 @@ class QrController: UIViewController ,ScanQrDelegate , ChildViewControllerDelega
135
135
 
136
136
  }
137
137
 
138
- func onStartQrScan() {
138
+ public func onStartQrScan() {
139
139
  triggerEvent(eventName:"onStartQrScan",dataModel:nil)
140
140
  DispatchQueue.main.async {
141
141
  if(self.popUpMessage != nil){
@@ -146,7 +146,7 @@ class QrController: UIViewController ,ScanQrDelegate , ChildViewControllerDelega
146
146
  }
147
147
  }
148
148
 
149
- func onErrorQrScan(message: String,dataModel: RemoteProcessingModel) {
149
+ public func onErrorQrScan(message: String,dataModel: RemoteProcessingModel) {
150
150
  triggerEvent(eventName:"onErrorQrScan",dataModel:nil)
151
151
  DispatchQueue.main.async {
152
152
  self.start = false;
@@ -155,7 +155,7 @@ class QrController: UIViewController ,ScanQrDelegate , ChildViewControllerDelega
155
155
  }
156
156
  }
157
157
 
158
- func onCompleteQrScan(dataModel: IDResponseModel) {
158
+ public func onCompleteQrScan(dataModel: IDResponseModel) {
159
159
  if let outputProperties = try? JSONSerialization.data(withJSONObject: dataModel.iDExtractedModel?.transformedProperties, options: []) {
160
160
  if UserDefaults.standard.object(forKey: String(self.stepID)) != nil {
161
161
  UserDefaults.standard.removeObject(forKey: String(self.stepID))