uqudosdk-react-native 2.5.4 → 2.6.0-1

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/CHANGELOG.md CHANGED
@@ -1,3 +1,14 @@
1
+ ## 2.6.0-1
2
+
3
+ * Fixed bug in the flutter plugin that prevent ios app to build successfully. The bug was introduced in version 2.6.0.
4
+
5
+ ## 2.6.0
6
+
7
+ * Added new feature "Lookup Flow". The "Lookp Flow" it's the same as the "Enrollment Flow" with the only difference that the first step is not the automatic scanning of a document through the camera phone but the user is asked to manually type in some information of the document that can be used to perform the lookup on the government database. Only one document at the time is supported. Other features like facial recognition and background check can be enabled in the same way as per the "Enrollment Flow". Please check the integration documentation https://docs.uqudo.com/docs/uqudo-sdk/integration for details
8
+ * Improved document detection during scanning
9
+ * Improved id photo quality detection during scanning
10
+ * Minor improvements and minor bug fixes
11
+
1
12
  ## 2.5.4
2
13
 
3
14
  * Fixed bug that was introduced in version 2.5.3 related to the reading module (NFC) for GHA ID
@@ -33,5 +33,5 @@ android {
33
33
 
34
34
  dependencies {
35
35
  implementation 'com.facebook.react:react-native:+'
36
- implementation 'io.uqudo.sdk:Uqudo:2.5.4'
36
+ implementation 'io.uqudo.sdk:Uqudo:2.6.0'
37
37
  }
@@ -18,8 +18,11 @@ import com.facebook.react.modules.core.DeviceEventManagerModule;
18
18
  import org.jetbrains.annotations.NotNull;
19
19
  import org.json.JSONArray;
20
20
  import org.json.JSONObject;
21
+
21
22
  import java.util.UUID;
23
+
22
24
  import org.json.JSONException;
25
+
23
26
  import java.util.ArrayList;
24
27
  import java.util.Arrays;
25
28
  import java.util.List;
@@ -38,6 +41,8 @@ import io.uqudo.sdk.core.builder.ReadingConfigurationBuilder;
38
41
  import io.uqudo.sdk.core.domain.model.BackgroundCheckType;
39
42
  import io.uqudo.sdk.core.domain.model.Document;
40
43
  import io.uqudo.sdk.core.domain.model.DocumentType;
44
+ import java.text.SimpleDateFormat;
45
+ import java.util.TimeZone;
41
46
 
42
47
  public class UqudoIdModule extends ReactContextBaseJavaModule implements ActivityEventListener {
43
48
 
@@ -46,6 +51,7 @@ public class UqudoIdModule extends ReactContextBaseJavaModule implements Activit
46
51
  public static final int REQUEST_CODE_ENROLLMENT = 1001;
47
52
  public static final int REQUEST_CODE_ACCOUNT_RECOVERY = 1002;
48
53
  public static final int REQUEST_CODE_FACE_SESSION = 1003;
54
+ public static final int REQUEST_CODE_LOOKUP = 1004;
49
55
 
50
56
  public UqudoIdModule(ReactApplicationContext reactContext) {
51
57
  super(reactContext);
@@ -87,7 +93,9 @@ public class UqudoIdModule extends ReactContextBaseJavaModule implements Activit
87
93
  json.put("statusCode", trace.getStatusCode());
88
94
  json.put("status", trace.getStatus());
89
95
  json.put("message", trace.getStatusMessage());
90
- json.put("timestamp", trace.getTimestamp());
96
+ SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
97
+ dateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
98
+ json.put("timestamp", dateFormat.format(trace.getTimestamp()));
91
99
  json.put("documentType", trace.getDocumentType());
92
100
  String data = json.toString();
93
101
  context.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
@@ -112,9 +120,6 @@ public class UqudoIdModule extends ReactContextBaseJavaModule implements Activit
112
120
  if (json.has("isSecuredWindowsDisabled") && json.getBoolean("isSecuredWindowsDisabled")) {
113
121
  enrollment.disableSecureWindow();
114
122
  }
115
- if (json.has("isRootedDeviceAllowed") && json.getBoolean("isRootedDeviceAllowed")) {
116
- enrollment.enableRootedDeviceUsage();
117
- }
118
123
  if (json.has("nonce")) {
119
124
  enrollment.setNonce(json.getString("nonce"));
120
125
  }
@@ -145,24 +150,24 @@ public class UqudoIdModule extends ReactContextBaseJavaModule implements Activit
145
150
 
146
151
  enrollment.enableFacialRecognition(faceBuilder.build());
147
152
  }
148
- if (json.has("lookupConfiguration")) {
149
- JSONObject lookupObject = json.getJSONObject("lookupConfiguration");
150
- if (lookupObject.has("documentList")) {
151
- JSONArray lookupDocuments = lookupObject.getJSONArray("documentList");
152
- if (lookupDocuments.length() > 0) {
153
- DocumentType[] documents = new DocumentType[lookupDocuments.length()];
154
- for (int i = 0; i < lookupDocuments.length(); i++) {
155
- String parsedDocument = lookupDocuments.getString(i);
156
- documents[i] = DocumentType.valueOf(parsedDocument);
157
- }
158
- enrollment.enableLookup(documents);
159
- } else {
160
- enrollment.enableLookup();
161
- }
162
- } else {
163
- enrollment.enableLookup();
164
- }
165
- }
153
+ if (json.has("lookupConfiguration")) {
154
+ JSONObject lookupObject = json.getJSONObject("lookupConfiguration");
155
+ if (lookupObject.has("documentList")) {
156
+ JSONArray lookupDocuments = lookupObject.getJSONArray("documentList");
157
+ if (lookupDocuments.length() > 0) {
158
+ DocumentType[] documents = new DocumentType[lookupDocuments.length()];
159
+ for (int i = 0; i < lookupDocuments.length(); i++) {
160
+ String parsedDocument = lookupDocuments.getString(i);
161
+ documents[i] = DocumentType.valueOf(parsedDocument);
162
+ }
163
+ enrollment.enableLookup(documents);
164
+ } else {
165
+ enrollment.enableLookup();
166
+ }
167
+ } else {
168
+ enrollment.enableLookup();
169
+ }
170
+ }
166
171
  if (json.has("backgroundCheckConfiguration")) {
167
172
  BackgroundCheckConfigurationBuilder backgroundCheckConfigurationBuilder = new BackgroundCheckConfigurationBuilder();
168
173
  JSONObject backgroundObject = json.getJSONObject("backgroundCheckConfiguration");
@@ -241,7 +246,7 @@ public class UqudoIdModule extends ReactContextBaseJavaModule implements Activit
241
246
  } else if ("SYSTEM".equals(json.getString("appearanceMode"))) {
242
247
  AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM);
243
248
  }
244
- }else{
249
+ } else {
245
250
  AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM);
246
251
  }
247
252
  getReactApplicationContext().startActivityForResult(intent, REQUEST_CODE_ENROLLMENT, null);
@@ -266,9 +271,6 @@ public class UqudoIdModule extends ReactContextBaseJavaModule implements Activit
266
271
  if (json.has("nonce")) {
267
272
  recovery.setNonce(json.getString("nonce"));
268
273
  }
269
- if (json.has("isRootedDeviceAllowed")) {
270
- recovery.enableRootedDeviceUsage();
271
- }
272
274
  if (json.has("isSecuredWindowsDisabled")) {
273
275
  recovery.disableSecureWindow();
274
276
  }
@@ -281,7 +283,7 @@ public class UqudoIdModule extends ReactContextBaseJavaModule implements Activit
281
283
  if (json.has("isReturnDataForIncompleteSession") && json.getBoolean("isReturnDataForIncompleteSession")) {
282
284
  recovery.returnDataForIncompleteSession();
283
285
  }
284
- Intent intent = recovery.build(context);
286
+ Intent intent = recovery.build(context);
285
287
 
286
288
  if (json.has("appearanceMode")) {
287
289
  if ("LIGHT".equals(json.getString("appearanceMode"))) {
@@ -291,7 +293,7 @@ public class UqudoIdModule extends ReactContextBaseJavaModule implements Activit
291
293
  } else if ("SYSTEM".equals(json.getString("appearanceMode"))) {
292
294
  AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM);
293
295
  }
294
- }else{
296
+ } else {
295
297
  AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM);
296
298
  }
297
299
  getReactApplicationContext().startActivityForResult(intent, REQUEST_CODE_ACCOUNT_RECOVERY, null);
@@ -316,9 +318,6 @@ public class UqudoIdModule extends ReactContextBaseJavaModule implements Activit
316
318
  if (json.has("nonce")) {
317
319
  faceSession.setNonce(json.getString("nonce"));
318
320
  }
319
- if (json.has("isRootedDeviceAllowed")) {
320
- faceSession.enableRootedDeviceUsage();
321
- }
322
321
  if (json.has("isSecuredWindowsDisabled")) {
323
322
  faceSession.disableSecureWindow();
324
323
  }
@@ -340,7 +339,7 @@ public class UqudoIdModule extends ReactContextBaseJavaModule implements Activit
340
339
  } else if ("SYSTEM".equals(json.getString("appearanceMode"))) {
341
340
  AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM);
342
341
  }
343
- }else{
342
+ } else {
344
343
  AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM);
345
344
  }
346
345
  getReactApplicationContext().startActivityForResult(intent, REQUEST_CODE_FACE_SESSION, null);
@@ -355,22 +354,126 @@ public class UqudoIdModule extends ReactContextBaseJavaModule implements Activit
355
354
  }
356
355
 
357
356
  @ReactMethod
358
- public void isReadingSupported(String documentType, Promise promise) {
357
+ public void lookup(String message, Promise promise) {
358
+ if (message != null && message.length() > 0) {
359
+ try {
360
+ JSONObject json = new JSONObject(message);
361
+ UqudoBuilder.Lookup lookupBuilder = new UqudoBuilder.Lookup();
362
+ if (json.has("isSecuredWindowsDisabled") && json.getBoolean("isSecuredWindowsDisabled")) {
363
+ lookupBuilder.disableSecureWindow();
364
+ }
365
+ if (json.has("nonce")) {
366
+ lookupBuilder.setNonce(json.getString("nonce"));
367
+ }
368
+ if (json.has("sessionId")) {
369
+ lookupBuilder.setSessionId(json.getString("sessionId"));
370
+ }
371
+ if (json.has("userIdentifier")) {
372
+ lookupBuilder.setUserIdentifier(UUID.fromString(json.getString("userIdentifier")));
373
+ }
374
+ if (json.has("isReturnDataForIncompleteSession") && json.getBoolean("isReturnDataForIncompleteSession")) {
375
+ lookupBuilder.returnDataForIncompleteSession();
376
+ }
377
+ if (json.has("facialRecognitionSpecification")) {
378
+ FacialRecognitionConfigurationBuilder faceBuilder = new FacialRecognitionConfigurationBuilder();
379
+ JSONObject faceObject = json.getJSONObject("facialRecognitionSpecification");
380
+ if (faceObject.has("enrollFace") && faceObject.getBoolean("enrollFace")) {
381
+ faceBuilder.enrollFace();
382
+ }
383
+ if (faceObject.has("lookupMinimumMatchLevel") && faceObject.getInt("lookupMinimumMatchLevel") > 0) {
384
+ faceBuilder.setLookupMinimumMatchLevel(faceObject.getInt("lookupMinimumMatchLevel"));
385
+ }
386
+ if (faceObject.has("maxAttempts") && faceObject.getInt("maxAttempts") > 0) {
387
+ faceBuilder.setMaxAttempts(faceObject.getInt("maxAttempts"));
388
+ }
389
+ lookupBuilder.enableFacialRecognition(faceBuilder.build());
390
+ }
391
+ if (json.has("backgroundCheckConfiguration")) {
392
+ BackgroundCheckConfigurationBuilder backgroundCheckConfigurationBuilder = new BackgroundCheckConfigurationBuilder();
393
+ JSONObject backgroundObject = json.getJSONObject("backgroundCheckConfiguration");
394
+ if (backgroundObject.has("disableConsent") && backgroundObject.getBoolean("disableConsent")) {
395
+ backgroundCheckConfigurationBuilder.disableConsent();
396
+ }
397
+ if (backgroundObject.has("backgroundCheckType")) {
398
+ backgroundCheckConfigurationBuilder.setBackgroundCheckType(BackgroundCheckType.valueOf(backgroundObject.getString("backgroundCheckType")));
399
+ }
400
+ if (backgroundObject.has("monitoringEnabled") && backgroundObject.getBoolean("monitoringEnabled")) {
401
+ backgroundCheckConfigurationBuilder.enableMonitoring();
402
+ }
403
+ if (backgroundObject.has("skipView") && backgroundObject.getBoolean("skipView")) {
404
+ backgroundCheckConfigurationBuilder.skipView();
405
+ }
406
+ lookupBuilder.enableBackgroundCheck(backgroundCheckConfigurationBuilder.build());
407
+ }
408
+ lookupBuilder.setToken(json.getString("authorizationToken"));
409
+ lookupBuilder.setDocumentType(DocumentType.valueOf(json.getString("documentType")));
410
+ Intent intent = lookupBuilder.build(context);
411
+ if (json.has("appearanceMode")) {
412
+ if ("LIGHT".equals(json.getString("appearanceMode"))) {
413
+ AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
414
+ } else if ("DARK".equals(json.getString("appearanceMode"))) {
415
+ AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
416
+ } else if ("SYSTEM".equals(json.getString("appearanceMode"))) {
417
+ AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM);
418
+ }
419
+ } else {
420
+ AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM);
421
+ }
422
+ getReactApplicationContext().startActivityForResult(intent, REQUEST_CODE_LOOKUP, null);
423
+ mPromises.put(REQUEST_CODE_LOOKUP, promise);
424
+ } catch (Exception e) {
425
+ Log.e("UqudoIdModule", e.getMessage(), e);
426
+ sendError(promise, SessionStatusCode.UNEXPECTED_ERROR.name(), e.getMessage(), null);
427
+ }
428
+ } else {
429
+ sendError(promise, SessionStatusCode.UNEXPECTED_ERROR.name(), "Expected lookup object as argument.", null);
430
+ }
431
+ }
432
+
433
+ @ReactMethod
434
+ public void isReadingSupported(String documentType, Promise promise) {
359
435
  try {
360
- promise.resolve(DocumentType.valueOf(documentType).getReadingSupported());
361
- } catch (Exception e) {
362
- sendError(promise, SessionStatusCode.UNEXPECTED_ERROR.name(), "Expected document type as argument", null);
363
- }
364
- }
436
+ promise.resolve(DocumentType.valueOf(documentType).getReadingSupported());
437
+ } catch (Exception e) {
438
+ sendError(promise, SessionStatusCode.UNEXPECTED_ERROR.name(), "Expected valid document type as argument", null);
439
+ }
440
+ }
441
+
442
+ @ReactMethod
443
+ public void isFacialRecognitionSupported(String documentType, Promise promise) {
444
+ try {
445
+ promise.resolve(DocumentType.valueOf(documentType).getFacialRecognitionSupported());
446
+ } catch (Exception e) {
447
+ sendError(promise, SessionStatusCode.UNEXPECTED_ERROR.name(), "Expected valid document type as argument", null);
448
+ }
449
+ }
365
450
 
366
451
  @ReactMethod
367
- public void isFacialRecognitionSupported(String documentType, Promise promise) {
368
- try {
369
- promise.resolve(DocumentType.valueOf(documentType).getFacialRecognitionSupported());
370
- } catch (Exception e) {
371
- sendError(promise, SessionStatusCode.UNEXPECTED_ERROR.name(), "Expected document type as argument.", null);
372
- }
373
- }
452
+ public void isLookupSupported(String documentType, Promise promise) {
453
+ try {
454
+ promise.resolve(DocumentType.valueOf(documentType).getLookupSupported());
455
+ } catch (Exception e) {
456
+ sendError(promise, SessionStatusCode.UNEXPECTED_ERROR.name(), "Expected valid document type as argument", null);
457
+ }
458
+ }
459
+
460
+ @ReactMethod
461
+ public void isLookupFacialRecognitionSupported(String documentType, Promise promise) {
462
+ try {
463
+ promise.resolve(DocumentType.valueOf(documentType).getLookupFacialRecognitionSupported());
464
+ } catch (Exception e) {
465
+ sendError(promise, SessionStatusCode.UNEXPECTED_ERROR.name(), "Expected valid document type as argument", null);
466
+ }
467
+ }
468
+
469
+ @ReactMethod
470
+ public void isEnrollmentSupported(String documentType, Promise promise) {
471
+ try {
472
+ promise.resolve(DocumentType.valueOf(documentType).getEnrollmentSupported());
473
+ } catch (Exception e) {
474
+ sendError(promise, SessionStatusCode.UNEXPECTED_ERROR.name(), "Expected valid document type as argument", null);
475
+ }
476
+ }
374
477
 
375
478
  private void sendError(Promise promise, String code, String message, String task) {
376
479
  sendError(promise, code, message, task, null);
@@ -386,7 +489,7 @@ public class UqudoIdModule extends ReactContextBaseJavaModule implements Activit
386
489
  } catch (Exception e) {
387
490
  e.printStackTrace();
388
491
  }
389
- promise.reject(error.toString(),"");
492
+ promise.reject(error.toString(), "");
390
493
  }
391
494
 
392
495
  @Override
@@ -395,7 +498,7 @@ public class UqudoIdModule extends ReactContextBaseJavaModule implements Activit
395
498
  if (promise == null) {
396
499
  return;
397
500
  }
398
- if (requestCode == REQUEST_CODE_ENROLLMENT || requestCode == REQUEST_CODE_ACCOUNT_RECOVERY || requestCode == REQUEST_CODE_FACE_SESSION) {
501
+ if (requestCode == REQUEST_CODE_ENROLLMENT || requestCode == REQUEST_CODE_ACCOUNT_RECOVERY || requestCode == REQUEST_CODE_FACE_SESSION || requestCode == REQUEST_CODE_LOOKUP) {
399
502
  if (resultCode == Activity.RESULT_OK) {
400
503
  WritableMap map = Arguments.createMap();
401
504
  map.putString("result", data.getStringExtra("data"));