assentify-sdk-react-native 0.0.34 → 0.0.36

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 CHANGED
@@ -92,6 +92,14 @@ yarn add assentify-sdk-react-native
92
92
  ```
93
93
 
94
94
  ## Versions
95
+
96
+ **0.0.36**
97
+ - Face match improvements
98
+
99
+ **0.0.35**
100
+ - Callbacks Improvements
101
+ - Captured Image Improvements
102
+
95
103
  **0.0.34**
96
104
  - Ability to split the front and back scanning of the IDs
97
105
 
@@ -99,7 +99,7 @@ dependencies {
99
99
  implementation "com.facebook.react:react-native:+"
100
100
  implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
101
101
 
102
- implementation 'com.github.AssentifyLTD:Assentify.SDK.Android:0.0.85'
102
+ implementation 'com.github.AssentifyLTD:Assentify.SDK.Android:0.0.87'
103
103
 
104
104
  /* Assentify Sdk Dependencies */
105
105
  implementation 'com.google.code.gson:gson:2.8.9'
@@ -571,16 +571,18 @@ class AssentifySdkModule(context: ReactApplicationContext) :
571
571
  val kycDocumentDetails: List<KycDocumentDetails> =
572
572
  gson.fromJson(jsonStringKycDocumentDetails, listType)
573
573
 
574
- templatesByCountry.forEach { it ->
575
- it.templates.forEach { template ->
576
- if (template.kycDocumentDetails.isNotEmpty()) {
577
- if (kycDocumentDetails[0].templateProcessingKeyInformation == template.kycDocumentDetails[0].templateProcessingKeyInformation) {
578
- title = template.kycDocumentType;
579
- }
574
+ val key0 = kycDocumentDetails.firstOrNull()
575
+ ?.templateProcessingKeyInformation
576
+
577
+ title = if (key0 == null) title else
578
+ templatesByCountry
579
+ .asSequence()
580
+ .flatMap { it.templates.asSequence() }
581
+ .firstOrNull { t ->
582
+ t.kycDocumentDetails.any { kd -> kd.templateProcessingKeyInformation == key0 }
580
583
  }
584
+ ?.kycDocumentType ?: title
581
585
 
582
- }
583
- }
584
586
  return title;
585
587
  }
586
588
  }
@@ -315,12 +315,16 @@ private lateinit var assentifySdk: AssentifySdk
315
315
  brightnessEvents: BrightnessEvents,
316
316
  motion: MotionType,
317
317
  faceEvents: FaceEvents,
318
- zoomType: ZoomType
318
+ zoomType: ZoomType,
319
+ detectedFaces:Int
319
320
  ) {
320
321
  runOnUiThread {
321
322
  if(start == false && currentActiveLiveEvents == ActiveLiveEvents.Good){
322
323
  infoLayout.visibility = View.VISIBLE
323
- if (zoomType != ZoomType.SENDING && zoomType != ZoomType.NO_DETECT) {
324
+ if(detectedFaces > 1){
325
+ infoText.setText("We detected more than one face.Please keep just your face in view.")
326
+ infoIcon.setImageDrawable(getResources().getDrawable(R.drawable.zoom_in))
327
+ } else if (zoomType != ZoomType.SENDING && zoomType != ZoomType.NO_DETECT) {
324
328
  if (zoomType == ZoomType.ZOOM_IN) {
325
329
  infoText.setText("Please Move Closer")
326
330
  infoIcon.setImageDrawable(getResources().getDrawable(R.drawable.zoom_in))
@@ -277,6 +277,14 @@ class ScanPassportActivity : AppCompatActivity(),
277
277
  }
278
278
  }
279
279
 
280
+ override fun onWrongTemplate(dataModel: BaseResponseDataModel) {
281
+ triggerEvent("onWrongTemplate", dataModel);
282
+ runOnUiThread {
283
+ start = false;
284
+ showPopUpMessage(R.drawable.warning, "Please double-check that you selected the correct ID type and are presenting this ID type", "Let's try again", false)
285
+ }
286
+ }
287
+
280
288
  override fun onComplete(dataModel: PassportResponseModel,doneFlag: DoneFlags) {
281
289
 
282
290
  if (doneFlag == DoneFlags.Success && isExpired(dataModel.passportExtractedModel!!.identificationDocumentCapture!!.expiryDate.toString())) {
@@ -38,6 +38,6 @@ Pod::Spec.new do |s|
38
38
 
39
39
 
40
40
  s.dependency "React-Core"
41
- s.dependency "AssentifySdk", '0.0.70'
41
+ s.dependency "AssentifySdk", '0.0.72'
42
42
 
43
43
  end
@@ -488,7 +488,14 @@ class NativeAssentifySdk: RCTEventEmitter ,AssentifySdkDelegate , SubmitDataDel
488
488
  } else if let stringValue = value as? String {
489
489
  stringDict[key] = stringValue
490
490
  } else {
491
+ if(key.contains("OnBoardMe_FaceImageAcquisition_FaceAuthenticity") || key.contains("OnBoardMe_FaceImageAcquisition_IsSkippedStatus")){
492
+ if let boolValue = value as? Bool {
493
+ stringDict[key] = boolValue ? "true" : "false"
494
+ }
495
+ }else{
491
496
  stringDict[key] = "\(value)"
497
+ }
498
+
492
499
  }
493
500
  }
494
501
 
@@ -508,20 +515,24 @@ class NativeAssentifySdk: RCTEventEmitter ,AssentifySdkDelegate , SubmitDataDel
508
515
  }
509
516
 
510
517
  func getIdTitle(kycDocumentDetails: [KycDocumentDetails]) -> String {
511
- var title = ""
518
+ var title = ""
512
519
 
513
- for country in self.templatesByCountry ?? [] {
514
- for template in country.templates {
515
- if !template.kycDocumentDetails.isEmpty {
516
- if kycDocumentDetails[0].templateProcessingKeyInformation == template.kycDocumentDetails[0].templateProcessingKeyInformation {
517
- title = template.kycDocumentType
518
- }
519
- }
520
- }
521
- }
520
+ guard let key0 = kycDocumentDetails.first?.templateProcessingKeyInformation else {
521
+ return title
522
+ }
522
523
 
523
- return title
524
- }
524
+ if let matchedTemplate = templatesByCountry?
525
+ .flatMap({ $0.templates })
526
+ .first(where: { template in
527
+ template.kycDocumentDetails.contains { kd in
528
+ kd.templateProcessingKeyInformation == key0
529
+ }
530
+ }) {
531
+ title = matchedTemplate.kycDocumentType
532
+ }
533
+
534
+ return title
535
+ }
525
536
 
526
537
  func imageToBase64(from url: URL, completion: @escaping (String?) -> Void) {
527
538
 
@@ -2,6 +2,10 @@ import UIKit
2
2
  import AssentifySdk
3
3
 
4
4
  class PassportScannerView: UIView, ScanPassportDelegate {
5
+ func onWrongTemplate(dataModel: RemoteProcessingModel) {
6
+ //
7
+ }
8
+
5
9
  func onComplete(dataModel: PassportResponseModel, doneFlag: DoneFlags) {
6
10
 
7
11
  }
@@ -248,11 +248,16 @@ class FaceMAtchController: UIViewController ,FaceMatchDelegate
248
248
  triggerEvent(eventName:"onUploadFailed",dataModel:dataModel)
249
249
  }
250
250
 
251
- func onEnvironmentalConditionsChange(brightnessEvents: BrightnessEvents,motion: MotionType,faceEvents: FaceEvents,zoom: ZoomType) {
251
+ func onEnvironmentalConditionsChange(brightnessEvents: BrightnessEvents,motion: MotionType,faceEvents: FaceEvents,zoom: ZoomType, detectedFaces:Int) {
252
252
  DispatchQueue.main.async {
253
253
  if self.start == false && self.currentActiveLiveEvents == ActiveLiveEvents.GOOD {
254
+ // Detected Faces Handling
255
+ if (detectedFaces > 1 ) {
256
+ self.infoLabel?.text = "We detected more than one face.\nPlease keep just your face in view."
257
+ self.infoImage!.image = UIImage(named: "info_icon")
258
+ }
254
259
  // Zoom Type Handling
255
- if (zoom != ZoomType.SENDING && zoom != ZoomType.NO_DETECT) {
260
+ else if (zoom != ZoomType.SENDING && zoom != ZoomType.NO_DETECT) {
256
261
  if (zoom == ZoomType.ZOOM_IN) {
257
262
  self.infoLabel?.text = "Please Move Closer"
258
263
  self.infoImage!.image = UIImage(named: "zoom_in")
@@ -6,6 +6,8 @@ import AssentifySdk
6
6
 
7
7
  class PassportController: UIViewController ,ScanPassportDelegate , ChildViewControllerDelegate
8
8
  {
9
+
10
+
9
11
 
10
12
 
11
13
 
@@ -175,6 +177,15 @@ class PassportController: UIViewController ,ScanPassportDelegate , ChildViewCont
175
177
  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))
176
178
  }
177
179
  }
180
+
181
+ func onWrongTemplate(dataModel:RemoteProcessingModel) {
182
+ triggerEvent(eventName:"onWrongTemplate",dataModel:dataModel)
183
+ DispatchQueue.main.async {
184
+ self.start = false;
185
+ self.popUpMessage!.removeFromSuperview();
186
+ 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))
187
+ }
188
+ }
178
189
 
179
190
  func onClipPreparationComplete(dataModel: RemoteProcessingModel) {
180
191
  triggerEvent(eventName:"onClipPreparationComplete",dataModel:dataModel)
@@ -191,7 +202,6 @@ class PassportController: UIViewController ,ScanPassportDelegate , ChildViewCont
191
202
 
192
203
 
193
204
  func onComplete(dataModel: PassportResponseModel,doneFlag:DoneFlags) {
194
- print("Passport onComplete: \(dataModel)")
195
205
 
196
206
 
197
207
  if let isExpired = dataModel.passportExtractedModel?
@@ -1 +1 @@
1
- {"version":3,"file":"Home.d.ts","sourceRoot":"","sources":["../../../../example/src/Home.tsx"],"names":[],"mappings":"AACA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAsBnD,QAAA,MAAM,IAAI,yBAqST,CAAC;AAEF,eAAe,IAAI,CAAC"}
1
+ {"version":3,"file":"Home.d.ts","sourceRoot":"","sources":["../../../../example/src/Home.tsx"],"names":[],"mappings":"AACA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAsBnD,QAAA,MAAM,IAAI,yBAkST,CAAC;AAEF,eAAe,IAAI,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "assentify-sdk-react-native",
3
- "version": "0.0.34",
3
+ "version": "0.0.36",
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",