accurascan_kyc 1.3.1 → 1.3.3
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/accurascan-kyc.podspec +1 -1
- package/android/build.gradle +1 -1
- package/android/src/main/java/com/accurascankyc/AccurascanKycModule.java +40 -0
- package/android/src/main/java/com/accurascankyc/OcrActivity.java +88 -1
- package/ios/AccurascanKyc.swift +38 -0
- package/ios/ViewController.swift +12 -0
- package/package.json +2 -2
package/accurascan-kyc.podspec
CHANGED
|
@@ -23,7 +23,7 @@ Pod::Spec.new do |s|
|
|
|
23
23
|
s.static_framework = true
|
|
24
24
|
# s.dependency "AccuraKYC","4.0.2"
|
|
25
25
|
# s.dependency "AccuraKYC","4.0.4"
|
|
26
|
-
s.dependency '
|
|
26
|
+
s.dependency 'AccuraKYC_Enc', '4.1.3'
|
|
27
27
|
# Don't install the dependencies when we run `pod install` in the old architecture.
|
|
28
28
|
if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
|
|
29
29
|
s.compiler_flags = folly_compiler_flags + " -DRCT_NEW_ARCH_ENABLED=1"
|
package/android/build.gradle
CHANGED
|
@@ -100,7 +100,7 @@ dependencies {
|
|
|
100
100
|
implementation 'androidx.appcompat:appcompat:1.6.0'
|
|
101
101
|
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
|
|
102
102
|
// Update OCR
|
|
103
|
-
implementation 'com.github.accurascan:AccuraOCR:6.1.
|
|
103
|
+
implementation 'com.github.accurascan:AccuraOCR:6.1.6'
|
|
104
104
|
// FaceMatch has no issue
|
|
105
105
|
implementation 'com.github.accurascan:AccuraFaceMatch:3.2.5'
|
|
106
106
|
// Update Liveness
|
|
@@ -121,6 +121,23 @@ public class AccurascanKycModule extends ReactContextBaseJavaModule {
|
|
|
121
121
|
return "file://"+file.getAbsolutePath();
|
|
122
122
|
}
|
|
123
123
|
|
|
124
|
+
// Conversion Method from JSONObject to Map<String, String>
|
|
125
|
+
public static Map<String, String> jsonToMap(JSONObject jsonObj) {
|
|
126
|
+
Map<String, String> map = new HashMap<>();
|
|
127
|
+
Iterator<String> keys = jsonObj.keys();
|
|
128
|
+
|
|
129
|
+
while (keys.hasNext()) {
|
|
130
|
+
String key = keys.next();
|
|
131
|
+
try {
|
|
132
|
+
map.put(key, jsonObj.getString(key));
|
|
133
|
+
} catch (JSONException e) {
|
|
134
|
+
e.printStackTrace();
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
return map;
|
|
139
|
+
}
|
|
140
|
+
|
|
124
141
|
// Example method
|
|
125
142
|
// See https://reactnative.dev/docs/native-modules-android
|
|
126
143
|
@ReactMethod
|
|
@@ -416,6 +433,29 @@ public class AccurascanKycModule extends ReactContextBaseJavaModule {
|
|
|
416
433
|
recogEngine.setBlurPercentage(getCurrentActivity(), 62);
|
|
417
434
|
}
|
|
418
435
|
|
|
436
|
+
if (accuraConfigs.has("setIsDocEnable")){
|
|
437
|
+
OcrActivity.isDocLiveness = accuraConfigs.getBoolean("setIsDocEnable");
|
|
438
|
+
};
|
|
439
|
+
if (accuraConfigs.has("setDocUrl")){
|
|
440
|
+
OcrActivity.DocumentLivenessUrl = accuraConfigs.getString("setDocUrl");
|
|
441
|
+
};
|
|
442
|
+
if (accuraConfigs.has("setProgressMessage")){
|
|
443
|
+
OcrActivity.setProgressMessage = accuraConfigs.getString("setProgressMessage");
|
|
444
|
+
};
|
|
445
|
+
if (accuraConfigs.has("setHideProgressDialogue")){
|
|
446
|
+
OcrActivity.setHideProgressDialogue = accuraConfigs.getBoolean("setHideProgressDialogue");
|
|
447
|
+
};
|
|
448
|
+
if (accuraConfigs.has("setHeader")) {
|
|
449
|
+
JSONObject jsonHeader = accuraConfigs.optJSONObject("setHeader");
|
|
450
|
+
if (jsonHeader != null) {
|
|
451
|
+
OcrActivity.DocHeader = jsonToMap(jsonHeader);
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
if (accuraConfigs.has("setApiTimer")){
|
|
455
|
+
OcrActivity.setApiTimer = accuraConfigs.getInt("setApiTimer");
|
|
456
|
+
};
|
|
457
|
+
|
|
458
|
+
|
|
419
459
|
// recogEngine.isCheckPhotoCopy(getCurrentActivity(),accuraConfigs.getBoolean("isCheckPhotoCopy"));
|
|
420
460
|
result.invoke(null, "Configs setup sucessfully");
|
|
421
461
|
return true;
|
|
@@ -2,6 +2,7 @@ package com.accurascankyc;
|
|
|
2
2
|
|
|
3
3
|
import android.app.Activity;
|
|
4
4
|
import android.app.Dialog;
|
|
5
|
+
import android.app.ProgressDialog;
|
|
5
6
|
import android.content.Intent;
|
|
6
7
|
import android.content.pm.ActivityInfo;
|
|
7
8
|
import android.content.res.Resources;
|
|
@@ -56,7 +57,9 @@ import java.io.OutputStream;
|
|
|
56
57
|
import java.lang.ref.WeakReference;
|
|
57
58
|
import java.security.cert.CertificateException;
|
|
58
59
|
import java.util.Arrays;
|
|
60
|
+
import java.util.HashMap;
|
|
59
61
|
import java.util.List;
|
|
62
|
+
import java.util.Map;
|
|
60
63
|
|
|
61
64
|
import javax.net.ssl.HostnameVerifier;
|
|
62
65
|
import javax.net.ssl.SSLContext;
|
|
@@ -90,6 +93,15 @@ public class OcrActivity extends SensorsActivity implements OcrCallback {
|
|
|
90
93
|
private Bitmap frame;
|
|
91
94
|
private static Activity appActivity = null;
|
|
92
95
|
|
|
96
|
+
public static String DocumentLivenessUrl = "";
|
|
97
|
+
public static String setProgressMessage = "API Loading...";
|
|
98
|
+
public static boolean isDocLiveness = false;
|
|
99
|
+
public static Map<String,String> DocHeader = new HashMap<>();
|
|
100
|
+
public static int setApiTimer = 60;
|
|
101
|
+
public static boolean setHideProgressDialogue = true;
|
|
102
|
+
private ProgressDialog pd;
|
|
103
|
+
private boolean isBacksideAvail = false;
|
|
104
|
+
|
|
93
105
|
private static class MyHandler extends Handler {
|
|
94
106
|
|
|
95
107
|
private final WeakReference<OcrActivity> mActivity;
|
|
@@ -224,6 +236,12 @@ public class OcrActivity extends SensorsActivity implements OcrCallback {
|
|
|
224
236
|
cameraView.setMRZCountryCodeList("all");
|
|
225
237
|
}
|
|
226
238
|
|
|
239
|
+
cameraView
|
|
240
|
+
.enableDocLiveness(isDocLiveness)
|
|
241
|
+
.setServerUrl(DocumentLivenessUrl)
|
|
242
|
+
.setMaxTimeLimitInSeconds(setApiTimer)
|
|
243
|
+
.addApiHeaders(DocHeader);
|
|
244
|
+
|
|
227
245
|
cameraView.setRecogType(recogType)
|
|
228
246
|
.setView(linearLayout) // To add camera view
|
|
229
247
|
.setOcrCallback(this) // To get Update and Success Call back
|
|
@@ -599,7 +617,7 @@ public class OcrActivity extends SensorsActivity implements OcrCallback {
|
|
|
599
617
|
backUri = null;
|
|
600
618
|
recogResult = RecogResult.getRecogResult();
|
|
601
619
|
if (recogResult != null) {
|
|
602
|
-
mrzResult = setMRZData(recogResult);
|
|
620
|
+
// mrzResult = setMRZData(recogResult);
|
|
603
621
|
if (recogResult.faceBitmap != null) {
|
|
604
622
|
faceUri = AccurascanKycModule.getImageUri(recogResult.faceBitmap, "face", fileDir);
|
|
605
623
|
}
|
|
@@ -611,6 +629,13 @@ public class OcrActivity extends SensorsActivity implements OcrCallback {
|
|
|
611
629
|
}
|
|
612
630
|
}
|
|
613
631
|
|
|
632
|
+
if (backUri != null){
|
|
633
|
+
isBacksideAvail = true;
|
|
634
|
+
}else{
|
|
635
|
+
isBacksideAvail = false;
|
|
636
|
+
}
|
|
637
|
+
mrzResult = setMRZData(recogResult);
|
|
638
|
+
|
|
614
639
|
} else if (recogType == RecogType.BANKCARD) {
|
|
615
640
|
faceUri = null;
|
|
616
641
|
frontUri = null;
|
|
@@ -745,6 +770,13 @@ public class OcrActivity extends SensorsActivity implements OcrCallback {
|
|
|
745
770
|
OcrData.MapData frontData = data.getFrontData();
|
|
746
771
|
OcrData.MapData backData = data.getBackData();
|
|
747
772
|
if (frontData != null) {
|
|
773
|
+
if(isDocLiveness){
|
|
774
|
+
try {
|
|
775
|
+
frontResult.put("Document Liveness", frontData.docLiveness);
|
|
776
|
+
} catch (JSONException e) {
|
|
777
|
+
e.printStackTrace(); // Handle the exception here (e.g., log the error or notify the user)
|
|
778
|
+
}
|
|
779
|
+
}
|
|
748
780
|
List<OcrData.MapData.ScannedData> frontScanData = frontData.getOcr_data();
|
|
749
781
|
for (int i = 0; i < frontScanData.size(); i++) {
|
|
750
782
|
if (frontScanData.get(i).getKey() != null) {
|
|
@@ -769,6 +801,13 @@ public class OcrActivity extends SensorsActivity implements OcrCallback {
|
|
|
769
801
|
}
|
|
770
802
|
}
|
|
771
803
|
if (backData != null) {
|
|
804
|
+
if(isDocLiveness){
|
|
805
|
+
try {
|
|
806
|
+
backResult.put("Document Liveness", backData.docLiveness);
|
|
807
|
+
} catch (JSONException e) {
|
|
808
|
+
e.printStackTrace(); // Handle the exception here (e.g., log the error or notify the user)
|
|
809
|
+
}
|
|
810
|
+
}
|
|
772
811
|
List<OcrData.MapData.ScannedData> backScanData = backData.getOcr_data();
|
|
773
812
|
for (int i = 0; i < backScanData.size(); i++) {
|
|
774
813
|
if (backScanData.get(i).getKey() != null) {
|
|
@@ -1230,6 +1269,45 @@ public class OcrActivity extends SensorsActivity implements OcrCallback {
|
|
|
1230
1269
|
}
|
|
1231
1270
|
}
|
|
1232
1271
|
|
|
1272
|
+
@Override
|
|
1273
|
+
public void onAPIUpdate(int i, String s) {
|
|
1274
|
+
Runnable runnable = () -> {
|
|
1275
|
+
if (i == RecogEngine.ACCURA_API_DISPLAY_PROGRESS) {
|
|
1276
|
+
// Display your custom progress dialog
|
|
1277
|
+
if (pd == null) {
|
|
1278
|
+
pd = new ProgressDialog(OcrActivity.this);
|
|
1279
|
+
pd.setCancelable(false);
|
|
1280
|
+
pd.setCanceledOnTouchOutside(false);
|
|
1281
|
+
pd.setMessage(setProgressMessage);
|
|
1282
|
+
}
|
|
1283
|
+
try {
|
|
1284
|
+
// If setHideProgressDialogue is true, hide the progress dialog immediately
|
|
1285
|
+
if (setHideProgressDialogue) {
|
|
1286
|
+
if (pd.isShowing()) {
|
|
1287
|
+
pd.dismiss();
|
|
1288
|
+
}
|
|
1289
|
+
} else {
|
|
1290
|
+
// Otherwise, show or hide based on the value of `s`
|
|
1291
|
+
if (s.equals("Show") && !pd.isShowing()) {
|
|
1292
|
+
Message _message = new Message();
|
|
1293
|
+
_message.what = 1;
|
|
1294
|
+
_message.obj = "Please wait...";
|
|
1295
|
+
handler.sendMessage(_message);
|
|
1296
|
+
pd.show();
|
|
1297
|
+
} else if (s.equals("Hide") && pd.isShowing()) {
|
|
1298
|
+
pd.dismiss();
|
|
1299
|
+
}
|
|
1300
|
+
}
|
|
1301
|
+
} catch (Exception e) {
|
|
1302
|
+
e.printStackTrace();
|
|
1303
|
+
}
|
|
1304
|
+
} else if (i == RecogEngine.ACCURA_API_ERROR) {
|
|
1305
|
+
Toast.makeText(OcrActivity.this, "Api Error is" + s, Toast.LENGTH_LONG).show();
|
|
1306
|
+
}
|
|
1307
|
+
};
|
|
1308
|
+
runOnUiThread(runnable);
|
|
1309
|
+
}
|
|
1310
|
+
|
|
1233
1311
|
/**
|
|
1234
1312
|
* Set Barcode selection Dialog to Scan only selected barcode format
|
|
1235
1313
|
* See {@link BarcodeFormat} to get All Barcode format
|
|
@@ -1285,6 +1363,15 @@ public class OcrActivity extends SensorsActivity implements OcrCallback {
|
|
|
1285
1363
|
JSONObject frontResult = new JSONObject();
|
|
1286
1364
|
try {
|
|
1287
1365
|
frontResult.put("MRZ", recogResult.lines);
|
|
1366
|
+
|
|
1367
|
+
if(isDocLiveness && recogType == RecogType.MRZ){
|
|
1368
|
+
frontResult.put("Document Liveness Front", recogResult.docfrontliveness);
|
|
1369
|
+
|
|
1370
|
+
if(recogResult.docbackliveness != null && isBacksideAvail){
|
|
1371
|
+
frontResult.put("Document Liveness Back", recogResult.docbackliveness);
|
|
1372
|
+
}
|
|
1373
|
+
}
|
|
1374
|
+
|
|
1288
1375
|
frontResult.put("Document Type", recogResult.docType);
|
|
1289
1376
|
frontResult.put("First Name", recogResult.givenname);
|
|
1290
1377
|
frontResult.put("First Name", recogResult.givenname);
|
package/ios/AccurascanKyc.swift
CHANGED
|
@@ -391,6 +391,44 @@ class AccurascanKyc: NSObject {
|
|
|
391
391
|
}else{
|
|
392
392
|
self.accuraCameraWrapper?.setCameraFacing(.CAMERA_FACING_BACK)
|
|
393
393
|
}
|
|
394
|
+
|
|
395
|
+
|
|
396
|
+
if configs["setIsDocEnable"] != nil {
|
|
397
|
+
let val = (configs["setIsDocEnable"] as? Bool)!
|
|
398
|
+
self.accuraCameraWrapper?.isApiCallingEnable(val)
|
|
399
|
+
}else{
|
|
400
|
+
self.accuraCameraWrapper?.isApiCallingEnable(false)
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
if configs["setDocUrl"] != nil {
|
|
404
|
+
let val = (configs["setDocUrl"] as? String)!
|
|
405
|
+
self.accuraCameraWrapper?.apiurl(val)
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
if configs["setProgressMessage"] != nil {
|
|
409
|
+
let val = (configs["setProgressMessage"] as? String)
|
|
410
|
+
self.accuraCameraWrapper?.setProgressDialogue(val)
|
|
411
|
+
} else{
|
|
412
|
+
self.accuraCameraWrapper?.setProgressDialogue("API Calling...")
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
if configs["setHideProgressDialogue"] != nil {
|
|
416
|
+
let val = (configs["setHideProgressDialogue"] as? Bool)!
|
|
417
|
+
self.accuraCameraWrapper?.hideProgressDialogue(val)
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
|
|
421
|
+
if configs["setApiTimer"] != nil {
|
|
422
|
+
let val = (configs["setApiTimer"] as? Int32)!
|
|
423
|
+
self.accuraCameraWrapper?.apiTimer(Float(val))
|
|
424
|
+
}else{
|
|
425
|
+
self.accuraCameraWrapper?.apiTimer(100.0)
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
if configs["setHeader"] != nil {
|
|
429
|
+
let val = (configs["setHeader"] as? [String: String])!
|
|
430
|
+
self.accuraCameraWrapper?.apiheader((val))
|
|
431
|
+
}
|
|
394
432
|
// if accuraconfigs["enableLogs"] != nil {
|
|
395
433
|
// if accuraconfigs["enableLogs"] as? Int == 0 {
|
|
396
434
|
// accuraCameraWrapper?.showLogFile(true)
|
package/ios/ViewController.swift
CHANGED
|
@@ -1887,6 +1887,10 @@ class ViewController: UIViewController {
|
|
|
1887
1887
|
}
|
|
1888
1888
|
|
|
1889
1889
|
extension ViewController: VideoCameraWrapperDelegate {
|
|
1890
|
+
|
|
1891
|
+
func onAPIError(_ error: String!) {
|
|
1892
|
+
print(error ?? "")
|
|
1893
|
+
}
|
|
1890
1894
|
|
|
1891
1895
|
func isBothSideAvailable(_ isBothAvailable: Bool) {
|
|
1892
1896
|
isbothSideAvailable = isBothAvailable
|
|
@@ -2645,6 +2649,14 @@ extension ViewController: VideoCameraWrapperDelegate {
|
|
|
2645
2649
|
mrzData["MRZ"] = line
|
|
2646
2650
|
|
|
2647
2651
|
}
|
|
2652
|
+
|
|
2653
|
+
if let docLivenessFront = shareScanningListing["Document Liveness"] as? String {
|
|
2654
|
+
mrzData["Document Liveness Front"] = docLivenessFront
|
|
2655
|
+
}
|
|
2656
|
+
if let docLivenessBack = shareScanningListing["Document Back Liveness"] as? String {
|
|
2657
|
+
mrzData["Document Liveness Back"] = docLivenessBack
|
|
2658
|
+
}
|
|
2659
|
+
|
|
2648
2660
|
if let givenname = shareScanningListing["givenname"] as? String {
|
|
2649
2661
|
mrzData["First Name"] = givenname
|
|
2650
2662
|
} else if let givenname = shareScanningListing["givenNames"] as? String {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "accurascan_kyc",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.3",
|
|
4
4
|
"description": "Accura Scan",
|
|
5
5
|
"main": "lib/commonjs/index",
|
|
6
6
|
"module": "lib/module/index",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"android"
|
|
43
43
|
],
|
|
44
44
|
"repository": "https://github.com/accurascan/React-Native-AccuraScan-KYC",
|
|
45
|
-
"author": "Accura Scan <
|
|
45
|
+
"author": "Accura Scan <anas@accurascan.com> (https://github.com/accurascan/React-Native-AccuraScan-KYC)",
|
|
46
46
|
"license": "MIT",
|
|
47
47
|
"bugs": {
|
|
48
48
|
"url": "https://github.com/accurascan/React-Native-AccuraScan-KYC/issues"
|