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.
@@ -21,11 +21,11 @@ class PassportController: UIViewController ,ScanPassportDelegate , ChildViewCont
21
21
  private var language: String;
22
22
  private var showCountDown: Bool = true;
23
23
  private var apiKey: String? = "";
24
-
25
-
26
-
27
-
28
-
24
+
25
+
26
+
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
@@ -44,8 +44,8 @@ class PassportController: UIViewController ,ScanPassportDelegate , ChildViewCont
44
44
  override var prefersStatusBarHidden: Bool {
45
45
  return false
46
46
  }
47
-
48
-
47
+
48
+
49
49
  override func viewDidLoad() {
50
50
  super.viewDidLoad()
51
51
  self.view.backgroundColor = .clear
@@ -73,15 +73,15 @@ class PassportController: UIViewController ,ScanPassportDelegate , ChildViewCont
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,7 +89,7 @@ class PassportController: UIViewController ,ScanPassportDelegate , ChildViewCont
89
89
  (self.infoLabel, self.infoImage) = showInfo(view: self.view, text: "Please Present Your Passport",initialTextColorHex:self.processingColor,initialBackgroundColorHex:self.holdHandColor,initialImageName:"info_icon")
90
90
  }
91
91
  }
92
-
92
+
93
93
  }
94
94
  func onSend() {
95
95
  triggerEvent(eventName:"onSend",dataModel:nil)
@@ -101,7 +101,7 @@ class PassportController: UIViewController ,ScanPassportDelegate , ChildViewCont
101
101
  self.popUpMessage = showPopUpMessage(view: self.view, title: "Transmitting", subTitle: "",initialTextColorHex:self.processingColor,initialBackgroundColorHex:self.holdHandColor, iconName: "passport", 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 PassportController: UIViewController ,ScanPassportDelegate , ChildViewCont
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 PassportController: UIViewController ,ScanPassportDelegate , ChildViewCont
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 {
@@ -142,12 +142,12 @@ class PassportController: UIViewController ,ScanPassportDelegate , ChildViewCont
142
142
  triggerEvent(eventName:"onUpdated",dataModel:dataModel)
143
143
  }
144
144
 
145
-
145
+
146
146
 
147
147
  func onComplete(dataModel: PassportResponseModel) {
148
148
  print("Passport onComplete: \(dataModel)")
149
-
150
-
149
+
150
+
151
151
  if let isExpired = dataModel.passportExtractedModel?.identificationDocumentCapture?.IsExpired, isExpired as! Bool {
152
152
  if(isExpired as! Bool == true){
153
153
  DispatchQueue.main.async {
@@ -230,45 +230,54 @@ class PassportController: UIViewController ,ScanPassportDelegate , ChildViewCont
230
230
  triggerEvent(eventName:"onUploadFailed",dataModel:dataModel)
231
231
  }
232
232
 
233
- func onEnvironmentalConditionsChange(brightness: Double, motion: MotionType, zoom: ZoomType) {
234
- DispatchQueue.main.async {
235
- if(self.start == false){
236
- if (zoom != ZoomType.SENDING && zoom != ZoomType.NO_DETECT) {
237
- if (zoom == ZoomType.ZOOM_IN) {
238
- self.start = false;
239
- self.infoLabel?.text = "Move Passport Closer"
240
- self.infoImage!.image = UIImage(named: "zoom_in")
241
- }
242
- if (zoom == ZoomType.ZOOM_OUT) {
243
- self.start = false;
244
- self.infoLabel?.text = "Move Passport Further"
245
- self.infoImage!.image = UIImage(named: "zoom_out")
246
- }
247
- } else if (motion == MotionType.HOLD_YOUR_HAND) {
248
- self.start = false;
249
- self.infoLabel?.text = "Please Hold Your Hand"
250
- self.infoImage!.image = UIImage(named: "info_icon")
251
- } else {
252
- if (motion == MotionType.SENDING && zoom == ZoomType.SENDING){
253
- self.start = false;
254
- self.infoLabel?.text = "Hold Steady"
255
- self.infoImage!.image = UIImage(named: "info_icon")
256
- }
257
- if (motion == MotionType.NO_DETECT && zoom == ZoomType.NO_DETECT){
258
- self.start = false;
259
- self.infoLabel?.text = "Please Present Your Passport"
260
- self.infoImage!.image = UIImage(named: "info_icon")
261
- }
262
-
263
- }
264
- }else {
265
- self.infoLabel?.removeFromSuperview()
266
- self.infoImage?.removeFromSuperview()
267
- }
268
-
269
- }
270
-
271
- }
233
+ func onEnvironmentalConditionsChange( brightnessEvents: BrightnessEvents,motion: MotionType,zoom: ZoomType) {
234
+ DispatchQueue.main.async {
235
+ if self.start == false {
236
+ if (zoom != ZoomType.SENDING && zoom != ZoomType.NO_DETECT) {
237
+ if (zoom == ZoomType.ZOOM_IN) {
238
+ self.start = false
239
+ self.infoLabel?.text = "Move Passport Closer"
240
+ self.infoImage!.image = UIImage(named: "zoom_in")
241
+ }
242
+ if (zoom == ZoomType.ZOOM_OUT) {
243
+ self.start = false
244
+ self.infoLabel?.text = "Move Passport Further"
245
+ self.infoImage!.image = UIImage(named: "zoom_out")
246
+ }
247
+ } else if (motion != MotionType.SENDING && motion != MotionType.NO_DETECT) {
248
+ self.start = false
249
+ self.infoLabel?.text = "Please Hold Your Hand"
250
+ self.infoImage!.image = UIImage(named: "info_icon")
251
+ } else if brightnessEvents != BrightnessEvents.Good {
252
+ if brightnessEvents == BrightnessEvents.TooDark {
253
+ self.start = false
254
+ self.infoLabel?.text = "Please increase the lighting"
255
+ self.infoImage!.image = UIImage(named: "info_icon")
256
+ }
257
+ if brightnessEvents == BrightnessEvents.TooBright {
258
+ self.start = false
259
+ self.infoLabel?.text = "Please reduce the lighting"
260
+ self.infoImage!.image = UIImage(named: "info_icon")
261
+ }
262
+ } else {
263
+ if (motion == MotionType.SENDING && zoom == ZoomType.SENDING && brightnessEvents == BrightnessEvents.Good) {
264
+ self.start = false
265
+ self.infoLabel?.text = "Hold Steady"
266
+ self.infoImage!.image = UIImage(named: "info_icon")
267
+ }
268
+ if (motion == MotionType.NO_DETECT && zoom == ZoomType.NO_DETECT) {
269
+ self.start = false
270
+ self.infoLabel?.text = "Please present passport"
271
+ self.infoImage!.image = UIImage(named: "info_icon")
272
+ }
273
+ }
274
+ } else {
275
+ self.infoLabel?.removeFromSuperview()
276
+ self.infoImage?.removeFromSuperview()
277
+ }
278
+ }
279
+
280
+ }
272
281
 
273
282
  func triggerCompleteEvent(eventName:String, dataModel: PassportExtractedModel?){
274
283
  var eventResultMap: [String: Any] = [:]
@@ -292,7 +301,7 @@ class PassportController: UIViewController ,ScanPassportDelegate , ChildViewCont
292
301
 
293
302
  }
294
303
 
295
-
304
+
296
305
 
297
306
 
298
307
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "assentify-sdk-react-native",
3
- "version": "0.0.6",
3
+ "version": "0.0.8",
4
4
  "description": "This package provides integration with Assentify's services, allowing developers to incorporate Assentify functionalities seamlessly into their applications.",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",