accurascan_kyc 1.0.3 → 1.0.5
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 +59 -91
- package/accurascan-kyc.podspec +0 -1
- package/android/build.gradle +1 -2
- package/android/src/main/java/com/accurascankyc/AccuraCardBorderView.java +100 -0
- package/android/src/main/java/com/accurascankyc/AccurascanKycModule.java +98 -4
- package/android/src/main/java/com/accurascankyc/OcrActivity.java +31 -12
- package/android/src/main/res/layout/custom_frame_layout.xml +2 -3
- package/android/src/main/res/layout-land/custom_frame_layout.xml +2 -3
- package/ios/AccurascanKyc.swift +124 -25
- package/ios/FMController.swift +0 -1
- package/ios/LVController.swift +4 -5
- package/ios/MainStoryboard_iPhone.storyboard +48 -0
- package/ios/ViewController.swift +139 -52
- package/package.json +4 -1
- package/ios/AccurascanKyc.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -4
package/README.md
CHANGED
|
@@ -11,21 +11,17 @@ Below steps to setup Accura Scan's SDK to your project.
|
|
|
11
11
|
## Note:-
|
|
12
12
|
|
|
13
13
|
`yarn add 'accurascan_kyc'`
|
|
14
|
+
|
|
15
|
+
OR
|
|
16
|
+
|
|
17
|
+
`npm i accurascan_kyc`
|
|
18
|
+
|
|
14
19
|
**Usage**
|
|
15
|
-
Import
|
|
20
|
+
Import npm library into file.
|
|
16
21
|
`import AccurascanKyc from 'accurascan_kyc';`
|
|
17
22
|
|
|
18
23
|
## 1.Setup Android
|
|
19
24
|
|
|
20
|
-
**Add this permissions into Android’s AndroidManifest.xml file.**
|
|
21
|
-
|
|
22
|
-
```
|
|
23
|
-
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
|
24
|
-
<uses-permission android:name="android.permission.CAMERA" />
|
|
25
|
-
<uses-feature android:name="android.hardware.camera" />
|
|
26
|
-
<uses-feature android:name="android.hardware.camera.autofocus" />
|
|
27
|
-
```
|
|
28
|
-
|
|
29
25
|
**Add it in your root build.gradle at the end of repositories.**
|
|
30
26
|
|
|
31
27
|
```
|
|
@@ -72,7 +68,35 @@ splits {
|
|
|
72
68
|
|
|
73
69
|
1.Install Git LFS using command install `git-lfs`
|
|
74
70
|
|
|
75
|
-
2.
|
|
71
|
+
2.Add the following in your podfile
|
|
72
|
+
`use_frameworks!` below `prepare_react_native_project!`
|
|
73
|
+
|
|
74
|
+
and if your xcode version is less than 14, add the following code
|
|
75
|
+
|
|
76
|
+
```
|
|
77
|
+
installer.pods_project.targets.each do |target|
|
|
78
|
+
target.build_configurations.each do |config|
|
|
79
|
+
# Bitcode is deprecated by Apple
|
|
80
|
+
config.build_settings['ENABLE_BITCODE'] = 'NO'
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
below
|
|
86
|
+
|
|
87
|
+
```
|
|
88
|
+
post_install do |installer|
|
|
89
|
+
react_native_post_install(
|
|
90
|
+
installer,
|
|
91
|
+
# Set `mac_catalyst_enabled` to `true` in order to apply patches
|
|
92
|
+
# necessary for Mac Catalyst builds
|
|
93
|
+
:mac_catalyst_enabled => false
|
|
94
|
+
)
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
take reference from [here](https://github.com/Anaslokhandwala/Accurascan_KYC/blob/master/ios/Podfile)
|
|
98
|
+
|
|
99
|
+
3.Run `pod install`
|
|
76
100
|
|
|
77
101
|
**Add this permissions into iOS Info.plist file.**
|
|
78
102
|
|
|
@@ -87,7 +111,8 @@ splits {
|
|
|
87
111
|
|
|
88
112
|
## 3.Setup Accura Scan licenses into your projects
|
|
89
113
|
|
|
90
|
-
Accura Scan has two license require for use full functionality of this library. Generate your own Accura license from here
|
|
114
|
+
Accura Scan has two license require for use full functionality of this library. Generate your own Accura license from [here](https://accurascan.com/developer/dashboard) using your bundle id.
|
|
115
|
+
|
|
91
116
|
**key.license**
|
|
92
117
|
|
|
93
118
|
This license is compulsory for this library to work. it will get all setup of accura SDK.
|
|
@@ -131,21 +156,13 @@ Place both the license in your project's Runner directory, and add the licenses
|
|
|
131
156
|
**Error:** String
|
|
132
157
|
|
|
133
158
|
**Success:** JSON String Response = {
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
**isOCREnable:** boolean,
|
|
142
|
-
|
|
143
|
-
**isBarcodeEnable:** boolean,
|
|
144
|
-
|
|
145
|
-
**isBankCardEnable:** boolean,
|
|
146
|
-
|
|
147
|
-
**isMRZEnable:** boolean
|
|
148
|
-
|
|
159
|
+
countries: Array[<CountryModels>],
|
|
160
|
+
barcodes: Array[],
|
|
161
|
+
isValid: boolean,
|
|
162
|
+
isOCREnable: boolean,
|
|
163
|
+
isBarcodeEnable: boolean,
|
|
164
|
+
isBankCardEnable: boolean,
|
|
165
|
+
isMRZEnable: boolean
|
|
149
166
|
}
|
|
150
167
|
|
|
151
168
|
### Setting up Configuration's,Error mssages and Scaning title messages
|
|
@@ -251,19 +268,12 @@ onPressMRZ = () => {
|
|
|
251
268
|
#### value: other_mrz or passport_mrz or id_mrz or visa_mrz<br></br>
|
|
252
269
|
|
|
253
270
|
**Success:** JSON Response {
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
**face:** URI?
|
|
262
|
-
|
|
263
|
-
**front_img:** URI?
|
|
264
|
-
|
|
265
|
-
**back_img:** URI?
|
|
266
|
-
|
|
271
|
+
front_data: JSONObjects?,
|
|
272
|
+
back_data: JSONObjects?,
|
|
273
|
+
type: Recognition Type,
|
|
274
|
+
face: URI?
|
|
275
|
+
front_img: URI?
|
|
276
|
+
back_img: URI?
|
|
267
277
|
}
|
|
268
278
|
|
|
269
279
|
**Error:** String
|
|
@@ -285,10 +295,10 @@ onPressOCR = () => {
|
|
|
285
295
|
|
|
286
296
|
if (isValid) {
|
|
287
297
|
let passArgs = [
|
|
288
|
-
this.countrySelected.id,
|
|
289
|
-
this.cardSelected.id,
|
|
290
|
-
this.cardSelected.name,
|
|
291
|
-
this.cardSelected.type,
|
|
298
|
+
this.countrySelected.id, //integer
|
|
299
|
+
this.cardSelected.id, //integer
|
|
300
|
+
this.cardSelected.name, //String
|
|
301
|
+
this.cardSelected.type, //integer
|
|
292
302
|
]; //[{"enableLogs":false},1,41,"Emirates National ID",0,"portrait-primary"]
|
|
293
303
|
//Method for start OCR scaning from native OS.
|
|
294
304
|
AccurascanKyc.startOcrWithCard(passArgs, (error, response) => {
|
|
@@ -302,25 +312,7 @@ onPressOCR = () => {
|
|
|
302
312
|
};
|
|
303
313
|
```
|
|
304
314
|
|
|
305
|
-
**
|
|
306
|
-
|
|
307
|
-
**value:** Id of selected country.
|
|
308
|
-
|
|
309
|
-
**CardId:** integer
|
|
310
|
-
|
|
311
|
-
**value:** Id of selected card.
|
|
312
|
-
|
|
313
|
-
**CardName:** String
|
|
314
|
-
|
|
315
|
-
**value:** Name of selected card.
|
|
316
|
-
|
|
317
|
-
**CardType:** integer
|
|
318
|
-
|
|
319
|
-
**value:** Type of selected card.
|
|
320
|
-
|
|
321
|
-
**Success:** JSON Response {
|
|
322
|
-
}
|
|
323
|
-
|
|
315
|
+
**Success:** JSON Response
|
|
324
316
|
**Error:** String
|
|
325
317
|
|
|
326
318
|
## 7.Method for scan barcode.
|
|
@@ -347,13 +339,7 @@ onPressBarcode = () => {
|
|
|
347
339
|
};
|
|
348
340
|
```
|
|
349
341
|
|
|
350
|
-
**
|
|
351
|
-
|
|
352
|
-
**value:** Type of barcode documents.
|
|
353
|
-
|
|
354
|
-
**Success:** JSON Response {
|
|
355
|
-
}
|
|
356
|
-
|
|
342
|
+
**Success:** JSON Response
|
|
357
343
|
**Error:** String
|
|
358
344
|
|
|
359
345
|
## 8.Method for scan bankcard.
|
|
@@ -370,9 +356,7 @@ onPressBankcard = () => {
|
|
|
370
356
|
};
|
|
371
357
|
```
|
|
372
358
|
|
|
373
|
-
**Success:** JSON Response
|
|
374
|
-
}
|
|
375
|
-
|
|
359
|
+
**Success:** JSON Response
|
|
376
360
|
**Error:** String
|
|
377
361
|
|
|
378
362
|
## 8.Method for get face match percentages between two face.
|
|
@@ -417,10 +401,6 @@ onPressFaceMatch = () => {
|
|
|
417
401
|
};
|
|
418
402
|
```
|
|
419
403
|
|
|
420
|
-
**accuraConfs:** JSON Object
|
|
421
|
-
|
|
422
|
-
**face_uri:** URI
|
|
423
|
-
|
|
424
404
|
**Success:** JSON Response {
|
|
425
405
|
detect: URI?
|
|
426
406
|
score: Float
|
|
@@ -475,18 +455,10 @@ onPressStartLiveness = () => {
|
|
|
475
455
|
};
|
|
476
456
|
```
|
|
477
457
|
|
|
478
|
-
**accuraConfs:** JSON Object
|
|
479
|
-
|
|
480
|
-
**face_uri:** 'uri of face'
|
|
481
|
-
|
|
482
458
|
**Success:** JSON Response {
|
|
483
|
-
|
|
484
459
|
detect: URI?,
|
|
485
|
-
|
|
486
460
|
Face_score: Float,
|
|
487
|
-
|
|
488
461
|
score: Float,
|
|
489
|
-
|
|
490
462
|
}
|
|
491
463
|
|
|
492
464
|
**Error:** String
|
|
@@ -622,16 +594,12 @@ _For Facematch 2_
|
|
|
622
594
|
```
|
|
623
595
|
|
|
624
596
|
**accuraConfs:** JSON Object
|
|
625
|
-
|
|
626
597
|
**Face1:** 'uri of face1'
|
|
627
|
-
|
|
628
598
|
**Face2:** ’uri of face2’
|
|
629
599
|
|
|
630
600
|
**Success:** JSON Response {
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
**score:** String,
|
|
601
|
+
Image: URI?,
|
|
602
|
+
score: String,
|
|
635
603
|
}
|
|
636
604
|
|
|
637
605
|
**Error:** String
|
package/accurascan-kyc.podspec
CHANGED
|
@@ -21,7 +21,6 @@ Pod::Spec.new do |s|
|
|
|
21
21
|
s.dependency "React-Core"
|
|
22
22
|
s.static_framework = true
|
|
23
23
|
s.dependency "AccuraKYC_Sim","3.2.2"
|
|
24
|
-
s.dependency "SVProgressHUD"
|
|
25
24
|
# Don't install the dependencies when we run `pod install` in the old architecture.
|
|
26
25
|
if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
|
|
27
26
|
s.compiler_flags = folly_compiler_flags + " -DRCT_NEW_ARCH_ENABLED=1"
|
package/android/build.gradle
CHANGED
|
@@ -96,9 +96,7 @@ dependencies {
|
|
|
96
96
|
// For > 0.71, this will be replaced by `com.facebook.react:react-android:$version` by react gradle plugin
|
|
97
97
|
//noinspection GradleDynamicVersion
|
|
98
98
|
implementation "com.facebook.react:react-native:+"
|
|
99
|
-
|
|
100
99
|
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
|
101
|
-
|
|
102
100
|
implementation 'androidx.appcompat:appcompat:1.6.0'
|
|
103
101
|
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
|
|
104
102
|
// For Accura OCR SDK
|
|
@@ -107,6 +105,7 @@ dependencies {
|
|
|
107
105
|
implementation 'com.github.accurascan:AccuraFaceMatch:3.2.0'
|
|
108
106
|
// for liveness
|
|
109
107
|
implementation 'com.github.accurascan:Liveness-Android:3.2.0'
|
|
108
|
+
implementation 'com.squareup.picasso:picasso:2.71828'
|
|
110
109
|
}
|
|
111
110
|
|
|
112
111
|
if (isNewArchitectureEnabled()) {
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
package com.accurascankyc;
|
|
2
|
+
|
|
3
|
+
import android.content.Context;
|
|
4
|
+
import android.graphics.Canvas;
|
|
5
|
+
import android.graphics.Paint;
|
|
6
|
+
import android.graphics.Path;
|
|
7
|
+
import android.util.AttributeSet;
|
|
8
|
+
import android.widget.RelativeLayout;
|
|
9
|
+
|
|
10
|
+
import androidx.annotation.NonNull;
|
|
11
|
+
import androidx.annotation.Nullable;
|
|
12
|
+
|
|
13
|
+
public class AccuraCardBorderView extends RelativeLayout {
|
|
14
|
+
|
|
15
|
+
private Paint mBorderPaint;
|
|
16
|
+
private boolean cornerBox = false;
|
|
17
|
+
private int mCornerWidth = 150;
|
|
18
|
+
private int mBorderColor = 0xFFCC0000;
|
|
19
|
+
private int mBorderWidth = 10;
|
|
20
|
+
|
|
21
|
+
public AccuraCardBorderView(@NonNull Context context) {
|
|
22
|
+
super(context);
|
|
23
|
+
init();
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
public AccuraCardBorderView(@NonNull Context context, @Nullable AttributeSet attrs) {
|
|
27
|
+
super(context, attrs);
|
|
28
|
+
init();
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
public AccuraCardBorderView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
|
|
32
|
+
super(context, attrs, defStyleAttr);
|
|
33
|
+
init();
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
private void init() {
|
|
37
|
+
mBorderPaint = new Paint(Paint.DITHER_FLAG);
|
|
38
|
+
mBorderPaint.setStyle(Paint.Style.STROKE);
|
|
39
|
+
mBorderPaint.setStrokeWidth(mBorderWidth);
|
|
40
|
+
mBorderPaint.setColor(mBorderColor);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
public void setCornerBox(boolean cornerBox) {
|
|
44
|
+
this.cornerBox = cornerBox;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
public void setCornerWidth(int mCornerWidth) {
|
|
48
|
+
this.mCornerWidth = mCornerWidth;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
public void setBorderColor(int mBorderColor) {
|
|
52
|
+
this.mBorderColor = mBorderColor;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
public void setBorderWidth(int mBorderWidth) {
|
|
56
|
+
this.mBorderWidth = mBorderWidth;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
@Override
|
|
60
|
+
protected void dispatchDraw(Canvas canvas) {
|
|
61
|
+
int count = canvas.save();
|
|
62
|
+
mBorderPaint.setStrokeWidth(mBorderWidth);
|
|
63
|
+
mBorderPaint.setColor(mBorderColor);
|
|
64
|
+
if (cornerBox) {
|
|
65
|
+
canvas.drawPath(createCornersPath(0, 0, getWidth(), getHeight(), mCornerWidth), mBorderPaint);
|
|
66
|
+
} else {
|
|
67
|
+
canvas.drawPath(createRectanglePath(0, 0, getWidth(), getHeight()), mBorderPaint);
|
|
68
|
+
}
|
|
69
|
+
super.dispatchDraw(canvas);
|
|
70
|
+
canvas.restoreToCount(count);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
private Path createCornersPath(int left, int top, int right, int bottom, int cornerWidth){
|
|
74
|
+
Path path = new Path();
|
|
75
|
+
|
|
76
|
+
path.moveTo(left, top + cornerWidth);
|
|
77
|
+
path.lineTo(left, top);
|
|
78
|
+
path.lineTo(left + cornerWidth, top);
|
|
79
|
+
|
|
80
|
+
path.moveTo(right - cornerWidth, top);
|
|
81
|
+
path.lineTo(right, top);
|
|
82
|
+
path.lineTo(right , top + cornerWidth);
|
|
83
|
+
|
|
84
|
+
path.moveTo(left, bottom - cornerWidth);
|
|
85
|
+
path.lineTo(left, bottom);
|
|
86
|
+
path.lineTo(left + cornerWidth, bottom);
|
|
87
|
+
|
|
88
|
+
path.moveTo(right - cornerWidth, bottom);
|
|
89
|
+
path.lineTo(right, bottom);
|
|
90
|
+
path.lineTo(right, bottom - cornerWidth);
|
|
91
|
+
|
|
92
|
+
return path;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
private Path createRectanglePath(int left, int top, int right, int bottom){
|
|
96
|
+
Path path = new Path();
|
|
97
|
+
path.addRect(left, top, right, bottom, Path.Direction.CW);
|
|
98
|
+
return path;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
@@ -3,6 +3,7 @@ package com.accurascankyc;
|
|
|
3
3
|
import androidx.annotation.NonNull;
|
|
4
4
|
import androidx.core.app.ActivityCompat;
|
|
5
5
|
|
|
6
|
+
|
|
6
7
|
import android.os.Build;
|
|
7
8
|
import android.content.Context;
|
|
8
9
|
import com.accurascan.ocr.mrz.model.BarcodeFormat;
|
|
@@ -19,6 +20,8 @@ import com.facebook.react.bridge.ReactMethod;
|
|
|
19
20
|
import com.facebook.react.bridge.ReadableArray;
|
|
20
21
|
import com.facebook.react.module.annotations.ReactModule;
|
|
21
22
|
import com.facebook.react.bridge.Callback;
|
|
23
|
+
import org.json.JSONException;
|
|
24
|
+
import org.json.JSONObject;
|
|
22
25
|
|
|
23
26
|
import android.Manifest;
|
|
24
27
|
import android.content.ContentResolver;
|
|
@@ -40,6 +43,7 @@ import java.io.IOException;
|
|
|
40
43
|
import java.io.InputStream;
|
|
41
44
|
import java.io.OutputStream;
|
|
42
45
|
import java.util.HashMap;
|
|
46
|
+
import java.util.Iterator;
|
|
43
47
|
import java.util.List;
|
|
44
48
|
import java.util.Map;
|
|
45
49
|
import java.util.Objects;
|
|
@@ -55,6 +59,10 @@ public class AccurascanKycModule extends ReactContextBaseJavaModule {
|
|
|
55
59
|
public static JSONObject accuraErrorConfg = new JSONObject();
|
|
56
60
|
public static JSONObject accuraTitleMsg = new JSONObject();
|
|
57
61
|
public static JSONObject accuraConfigs = new JSONObject();
|
|
62
|
+
public static JSONObject actualAccuraConfigs = new JSONObject();
|
|
63
|
+
public static JSONObject actualAccuraTitleMsg = new JSONObject();
|
|
64
|
+
public static JSONObject actualAccuraErrorConfg = new JSONObject();
|
|
65
|
+
|
|
58
66
|
private String bType;
|
|
59
67
|
|
|
60
68
|
public AccurascanKycModule(ReactApplicationContext reactContext) {
|
|
@@ -184,12 +192,98 @@ public class AccurascanKycModule extends ReactContextBaseJavaModule {
|
|
|
184
192
|
@ReactMethod
|
|
185
193
|
public boolean setupAccuraConfig(ReadableArray argsNew, Callback result) throws JSONException {
|
|
186
194
|
|
|
195
|
+
//Configs
|
|
196
|
+
actualAccuraConfigs.put("setFaceBlurPercentage",80);
|
|
197
|
+
actualAccuraConfigs.put("setHologramDetection",true);
|
|
198
|
+
actualAccuraConfigs.put("setLowLightTolerance",10);
|
|
199
|
+
actualAccuraConfigs.put("setMotionThreshold",25);
|
|
200
|
+
actualAccuraConfigs.put("setMinGlarePercentage",6);
|
|
201
|
+
actualAccuraConfigs.put("setMaxGlarePercentage",99);
|
|
202
|
+
actualAccuraConfigs.put("setBlurPercentage",60);
|
|
203
|
+
actualAccuraConfigs.put("setCameraFacing",0);
|
|
204
|
+
|
|
205
|
+
//Title messages
|
|
206
|
+
actualAccuraTitleMsg.put("SCAN_TITLE_OCR_FRONT","Scan Front side of ");
|
|
207
|
+
actualAccuraTitleMsg.put("SCAN_TITLE_OCR_BACK","Scan Back side of ");
|
|
208
|
+
actualAccuraTitleMsg.put("SCAN_TITLE_OCR","Scan ");
|
|
209
|
+
actualAccuraTitleMsg.put("SCAN_TITLE_MRZ_PDF417_FRONT","Scan Front Side of Document");
|
|
210
|
+
actualAccuraTitleMsg.put("SCAN_TITLE_MRZ_PDF417_BACK","Scan Back Side of Document");
|
|
211
|
+
actualAccuraTitleMsg.put("SCAN_TITLE_DLPLATE","Scan Number plate");
|
|
212
|
+
actualAccuraTitleMsg.put("SCAN_TITLE_BARCODE","Scan Barcode");
|
|
213
|
+
actualAccuraTitleMsg.put("SCAN_TITLE_BANKCARD","Scan BankCard");
|
|
214
|
+
|
|
215
|
+
//Error messages, Camera Screen Confige
|
|
216
|
+
actualAccuraErrorConfg.put("flipImage","");
|
|
217
|
+
actualAccuraErrorConfg.put("setCameraFacing",0);
|
|
218
|
+
actualAccuraErrorConfg.put("enableLogs",1);
|
|
219
|
+
actualAccuraErrorConfg.put("isShowLogo",1);
|
|
220
|
+
actualAccuraErrorConfg.put("isFlipImg",1);
|
|
221
|
+
actualAccuraErrorConfg.put("CameraScreen_Frame_Color","#D5323F");
|
|
222
|
+
actualAccuraErrorConfg.put("CameraScreen_Text_Color","#FFFFFF");
|
|
223
|
+
actualAccuraErrorConfg.put("CameraScreen_Text_Border_Color","#000000");
|
|
224
|
+
actualAccuraErrorConfg.put("CameraScreen_Color","#80000000");
|
|
225
|
+
actualAccuraErrorConfg.put("CameraScreen_Border_Width",10);
|
|
226
|
+
actualAccuraErrorConfg.put("CameraScreen_CornerBorder_Enable",false);
|
|
227
|
+
actualAccuraErrorConfg.put("CameraScreen_Back_Button",1);
|
|
228
|
+
actualAccuraErrorConfg.put("CameraScreen_Change_Button",1);
|
|
229
|
+
actualAccuraErrorConfg.put("ACCURA_ERROR_CODE_MOTION","Keep Document Steady");
|
|
230
|
+
actualAccuraErrorConfg.put("ACCURA_ERROR_CODE_DOCUMENT_IN_FRAME","Keep document in frame");
|
|
231
|
+
actualAccuraErrorConfg.put("ACCURA_ERROR_CODE_BRING_DOCUMENT_IN_FRAME","Bring card near to frame");
|
|
232
|
+
actualAccuraErrorConfg.put("ACCURA_ERROR_CODE_PROCESSING","Processing...");
|
|
233
|
+
actualAccuraErrorConfg.put("ACCURA_ERROR_CODE_BLUR_DOCUMENT","Blur detect in document");
|
|
234
|
+
actualAccuraErrorConfg.put("ACCURA_ERROR_CODE_FACE_BLUR","Blur detected over face");
|
|
235
|
+
actualAccuraErrorConfg.put("ACCURA_ERROR_CODE_GLARE_DOCUMENT","Glare detect in document");
|
|
236
|
+
actualAccuraErrorConfg.put("ACCURA_ERROR_CODE_HOLOGRAM","Hologram Detected");
|
|
237
|
+
actualAccuraErrorConfg.put("ACCURA_ERROR_CODE_DARK_DOCUMENT","Low lighting detected");
|
|
238
|
+
actualAccuraErrorConfg.put("ACCURA_ERROR_CODE_PHOTO_COPY_DOCUMENT","Can not accept Photo Copy Document");
|
|
239
|
+
actualAccuraErrorConfg.put("ACCURA_ERROR_CODE_FACE","Face not detected");
|
|
240
|
+
actualAccuraErrorConfg.put("ACCURA_ERROR_CODE_MRZ","MRZ not detected");
|
|
241
|
+
actualAccuraErrorConfg.put("ACCURA_ERROR_CODE_PASSPORT_MRZ","Passport MRZ not detected");
|
|
242
|
+
actualAccuraErrorConfg.put("ACCURA_ERROR_CODE_ID_MRZ","ID MRZ not detected");
|
|
243
|
+
actualAccuraErrorConfg.put("ACCURA_ERROR_CODE_VISA_MRZ","Visa MRZ not detected");
|
|
244
|
+
actualAccuraErrorConfg.put("ACCURA_ERROR_CODE_UPSIDE_DOWN_SIDE","Document is upside down. Place it properly");
|
|
245
|
+
actualAccuraErrorConfg.put("ACCURA_ERROR_CODE_WRONG_SIDE","Scanning wrong side of Document");
|
|
246
|
+
|
|
247
|
+
|
|
187
248
|
JSONArray args = ReactNativeJSON.convertArrayToJson(argsNew);
|
|
188
249
|
RecogEngine recogEngine = new RecogEngine();
|
|
189
250
|
|
|
190
|
-
accuraConfigs = args.getJSONObject(0);
|
|
191
|
-
|
|
192
|
-
|
|
251
|
+
// accuraConfigs = args.getJSONObject(0);
|
|
252
|
+
Iterator<String> keys1 = actualAccuraConfigs.keys();
|
|
253
|
+
while(keys1.hasNext()) {
|
|
254
|
+
String key = keys1.next();
|
|
255
|
+
accuraConfigs.put(key, actualAccuraConfigs.get(key));
|
|
256
|
+
}
|
|
257
|
+
Iterator<String> keys2 = args.getJSONObject(0).keys();
|
|
258
|
+
while(keys2.hasNext()) {
|
|
259
|
+
String key = keys2.next();
|
|
260
|
+
accuraConfigs.put(key, args.getJSONObject(0).get(key));
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
// accuraErrorConfg = args.getJSONObject(1);
|
|
264
|
+
Iterator<String> keys3 = actualAccuraErrorConfg.keys();
|
|
265
|
+
while(keys3.hasNext()) {
|
|
266
|
+
String key = keys3.next();
|
|
267
|
+
accuraErrorConfg.put(key, actualAccuraErrorConfg.get(key));
|
|
268
|
+
}
|
|
269
|
+
Iterator<String> keys4 = args.getJSONObject(1).keys();
|
|
270
|
+
while(keys4.hasNext()) {
|
|
271
|
+
String key = keys4.next();
|
|
272
|
+
accuraErrorConfg.put(key, args.getJSONObject(1).get(key));
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
// accuraTitleMsg = args.getJSONObject(2);
|
|
276
|
+
Iterator<String> keys5 = actualAccuraTitleMsg.keys();
|
|
277
|
+
while(keys5.hasNext()) {
|
|
278
|
+
String key = keys5.next();
|
|
279
|
+
accuraTitleMsg.put(key, actualAccuraTitleMsg.get(key));
|
|
280
|
+
}
|
|
281
|
+
Iterator<String> keys6 = args.getJSONObject(2).keys();
|
|
282
|
+
while(keys6.hasNext()) {
|
|
283
|
+
String key = keys6.next();
|
|
284
|
+
accuraTitleMsg.put(key, args.getJSONObject(2).get(key));
|
|
285
|
+
}
|
|
286
|
+
|
|
193
287
|
|
|
194
288
|
OcrActivity.accuraErrorConfg = accuraErrorConfg;
|
|
195
289
|
OcrActivity.accuraTitleMsg = accuraTitleMsg;
|
|
@@ -503,5 +597,5 @@ public class AccurascanKycModule extends ReactContextBaseJavaModule {
|
|
|
503
597
|
}
|
|
504
598
|
return resultOf;
|
|
505
599
|
}
|
|
506
|
-
|
|
600
|
+
|
|
507
601
|
}
|
|
@@ -10,6 +10,7 @@ import android.graphics.Rect;
|
|
|
10
10
|
import android.graphics.Color;
|
|
11
11
|
import android.graphics.Paint;
|
|
12
12
|
import android.graphics.drawable.GradientDrawable;
|
|
13
|
+
import android.net.Uri;
|
|
13
14
|
import android.os.Bundle;
|
|
14
15
|
import android.os.Handler;
|
|
15
16
|
import android.os.Message;
|
|
@@ -41,6 +42,7 @@ import com.accurascan.ocr.mrz.util.AccuraLog;
|
|
|
41
42
|
import com.docrecog.scan.MRZDocumentType;
|
|
42
43
|
import com.docrecog.scan.RecogEngine;
|
|
43
44
|
import com.docrecog.scan.RecogType;
|
|
45
|
+
import com.squareup.picasso.Picasso;
|
|
44
46
|
|
|
45
47
|
import org.json.JSONException;
|
|
46
48
|
import org.json.JSONObject;
|
|
@@ -69,7 +71,8 @@ public class OcrActivity extends SensorsActivity implements OcrCallback {
|
|
|
69
71
|
|
|
70
72
|
private static final String TAG = OcrActivity.class.getSimpleName();
|
|
71
73
|
private CameraView cameraView;
|
|
72
|
-
private View viewLeft, viewRight,
|
|
74
|
+
private View viewLeft, viewRight,logoImg,viewTop,viewBottom;
|
|
75
|
+
private AccuraCardBorderView borderFrame;
|
|
73
76
|
private BorderTextView tvTitle, tvScanMessage;
|
|
74
77
|
private ImageView imageFlip;
|
|
75
78
|
private int cardId;
|
|
@@ -249,15 +252,31 @@ public class OcrActivity extends SensorsActivity implements OcrCallback {
|
|
|
249
252
|
}
|
|
250
253
|
});
|
|
251
254
|
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
// }
|
|
255
|
+
try {
|
|
256
|
+
borderFrame.setBorderColor(Color.parseColor(accuraErrorConfg.getString("CameraScreen_Frame_Color")));
|
|
257
|
+
borderFrame.setBorderWidth(accuraErrorConfg.getInt("CameraScreen_Border_Width"));
|
|
258
|
+
borderFrame.setCornerBox(accuraErrorConfg.getBoolean("CameraScreen_CornerBorder_Enable"));
|
|
259
|
+
} catch (JSONException e) {
|
|
260
|
+
e.printStackTrace();
|
|
261
|
+
}
|
|
260
262
|
|
|
263
|
+
try {
|
|
264
|
+
if (accuraErrorConfg.getInt("CameraScreen_Change_Button") == 0){
|
|
265
|
+
btn_flip.setVisibility(View.GONE);
|
|
266
|
+
}else{
|
|
267
|
+
}
|
|
268
|
+
} catch (JSONException e) {
|
|
269
|
+
e.printStackTrace();
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
try {
|
|
273
|
+
if (!accuraErrorConfg.getString("flipImage").equals("")){
|
|
274
|
+
String aaa = accuraErrorConfg.getString("flipImage");
|
|
275
|
+
Picasso.get().load(aaa).into(imageFlip);
|
|
276
|
+
}
|
|
277
|
+
} catch (JSONException e) {
|
|
278
|
+
e.printStackTrace();
|
|
279
|
+
}
|
|
261
280
|
|
|
262
281
|
String screenColor = "#00000000";
|
|
263
282
|
try {
|
|
@@ -288,9 +307,9 @@ public class OcrActivity extends SensorsActivity implements OcrCallback {
|
|
|
288
307
|
} catch (JSONException e) {
|
|
289
308
|
e.printStackTrace();
|
|
290
309
|
}
|
|
291
|
-
GradientDrawable drawable = (GradientDrawable)borderFrame.getBackground();
|
|
292
|
-
drawable.mutate(); // only change this instance of the xml, not all components using this xml
|
|
293
|
-
drawable.setStroke(dp2Px(borderWidth), Color.parseColor(borderColor));
|
|
310
|
+
// GradientDrawable drawable = (GradientDrawable)borderFrame.getBackground();
|
|
311
|
+
// drawable.mutate(); // only change this instance of the xml, not all components using this xml
|
|
312
|
+
// drawable.setStroke(dp2Px(borderWidth), Color.parseColor(borderColor));
|
|
294
313
|
// drawable.setCornerRadius(dp2Px(borderCornerRadius));
|
|
295
314
|
|
|
296
315
|
String titleTextColor = "#ffffff";
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
|
|
84
84
|
</RelativeLayout>
|
|
85
85
|
|
|
86
|
-
<
|
|
86
|
+
<com.accurascankyc.AccuraCardBorderView
|
|
87
87
|
android:id="@+id/border_frame"
|
|
88
88
|
tools:layout_conversion_absoluteHeight="300dp"
|
|
89
89
|
tools:layout_conversion_absoluteWidth="98dp"
|
|
@@ -92,7 +92,6 @@
|
|
|
92
92
|
android:layout_width="match_parent"
|
|
93
93
|
android:layout_height="200dp"
|
|
94
94
|
android:layout_margin="10dp"
|
|
95
|
-
android:background="@drawable/border_red"
|
|
96
95
|
app:layout_constraintBottom_toBottomOf="parent"
|
|
97
96
|
app:layout_constraintLeft_toLeftOf="parent"
|
|
98
97
|
app:layout_constraintRight_toRightOf="parent"
|
|
@@ -138,7 +137,7 @@
|
|
|
138
137
|
/>
|
|
139
138
|
</LinearLayout>
|
|
140
139
|
|
|
141
|
-
</
|
|
140
|
+
</com.accurascankyc.AccuraCardBorderView>
|
|
142
141
|
|
|
143
142
|
|
|
144
143
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
|
|
84
84
|
</RelativeLayout>
|
|
85
85
|
|
|
86
|
-
<
|
|
86
|
+
<com.accurascankyc.AccuraCardBorderView
|
|
87
87
|
android:id="@+id/border_frame"
|
|
88
88
|
tools:layout_conversion_absoluteHeight="300dp"
|
|
89
89
|
tools:layout_conversion_absoluteWidth="98dp"
|
|
@@ -92,7 +92,6 @@
|
|
|
92
92
|
android:layout_width="match_parent"
|
|
93
93
|
android:layout_height="400dp"
|
|
94
94
|
android:layout_margin="10dp"
|
|
95
|
-
android:background="@drawable/border_red"
|
|
96
95
|
app:layout_constraintBottom_toBottomOf="parent"
|
|
97
96
|
app:layout_constraintLeft_toLeftOf="parent"
|
|
98
97
|
app:layout_constraintRight_toRightOf="parent"
|
|
@@ -138,7 +137,7 @@
|
|
|
138
137
|
/>
|
|
139
138
|
</LinearLayout>
|
|
140
139
|
|
|
141
|
-
</
|
|
140
|
+
</com.accurascankyc.AccuraCardBorderView>
|
|
142
141
|
|
|
143
142
|
|
|
144
143
|
</androidx.constraintlayout.widget.ConstraintLayout>
|