accurascan_kyc 1.1.6 → 1.1.7
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 +9 -7
- package/accurascan-kyc.podspec +5 -2
- package/android/build.gradle +1 -1
- package/android/src/main/java/com/accurascankyc/AccuraCardBorderView.java +0 -0
- package/android/src/main/java/com/accurascankyc/AccurascanKycModule.java +1 -1
- package/android/src/main/java/com/accurascankyc/OcrActivity.java +10 -0
- package/android/src/main/java/com/accurascankyc/OcrResultActivity.java +4 -4
- package/ios/AccurascanKyc.swift +3 -3
- package/ios/FMController.swift +43 -9
- package/ios/LVController.swift +49 -5
- package/ios/ViewController.swift +9 -0
- package/ios/resources/accuraScanLogo.png +0 -0
- package/ios/resources/icn_close.png +0 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -26,13 +26,15 @@ Import npm library into file.
|
|
|
26
26
|
|
|
27
27
|
```
|
|
28
28
|
allprojects {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
29
|
+
repositories {
|
|
30
|
+
google()
|
|
31
|
+
jcenter()
|
|
32
|
+
maven { url 'https://jitpack.io/' }
|
|
33
|
+
maven { url 'https://developer.huawei.com/repo/' } // Add Huawei Maven
|
|
34
|
+
maven {
|
|
35
|
+
url 'https://jitpack.io'
|
|
36
|
+
credentials { username 'jp_45kf9tvkijvd9c7cf34mehj1b6' }
|
|
37
|
+
}
|
|
36
38
|
}
|
|
37
39
|
}
|
|
38
40
|
```
|
package/accurascan-kyc.podspec
CHANGED
|
@@ -13,14 +13,17 @@ Pod::Spec.new do |s|
|
|
|
13
13
|
|
|
14
14
|
s.platforms = { :ios => "12.0" }
|
|
15
15
|
s.ios.deployment_target = '12.0'
|
|
16
|
-
s.source = { :git => "https://git.accurascan.com/Mahdi/hybrid-react-kyc.git, :tag => "#{s.version}"
|
|
16
|
+
s.source = { :git => "https://git.accurascan.com/Mahdi/hybrid-react-kyc.git, :tag => "#{s.version}"
|
|
17
|
+
}
|
|
17
18
|
|
|
18
19
|
s.source_files = "ios/**/*.{h,m,mm,swift}"
|
|
19
20
|
s.resources = "ios/**/*.{png,jpeg,jpg,xib,xcassets,imageset,gif,mp3,storyboard}"
|
|
20
21
|
|
|
21
22
|
s.dependency "React-Core"
|
|
22
23
|
s.static_framework = true
|
|
23
|
-
s.dependency "
|
|
24
|
+
# s.dependency "AccuraKYC","4.0.2"
|
|
25
|
+
s.dependency "AccuraKYC_Sim","4.0.3"
|
|
26
|
+
s.dependency "ProgressHUD"
|
|
24
27
|
# Don't install the dependencies when we run `pod install` in the old architecture.
|
|
25
28
|
if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
|
|
26
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
|
// For Accura OCR SDK
|
|
103
|
-
implementation 'com.github.accurascan:AccuraOCR:5.1.
|
|
103
|
+
implementation 'com.github.accurascan:AccuraOCR:5.1.4'
|
|
104
104
|
// For Accura Face match
|
|
105
105
|
implementation 'com.github.accurascan:AccuraFaceMatch:3.2.0'
|
|
106
106
|
// for liveness
|
|
File without changes
|
|
@@ -135,7 +135,7 @@ public class AccurascanKycModule extends ReactContextBaseJavaModule {
|
|
|
135
135
|
JSONObject results = new JSONObject();
|
|
136
136
|
RecogEngine.SDKModel sdkModel = recogEngine.initEngine(getReactApplicationContext());
|
|
137
137
|
if (sdkModel.i >= 0) {
|
|
138
|
-
AndroidNetworking.initialize(getReactApplicationContext(), UnsafeOkHttpClient.getUnsafeOkHttpClient());
|
|
138
|
+
// AndroidNetworking.initialize(getReactApplicationContext(), UnsafeOkHttpClient.getUnsafeOkHttpClient());
|
|
139
139
|
results.put("sdk_version", recogEngine.getVersion());
|
|
140
140
|
|
|
141
141
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && !isPermissionsGranted(getCurrentActivity())) {
|
|
@@ -261,6 +261,16 @@ public class OcrActivity extends SensorsActivity implements OcrCallback {
|
|
|
261
261
|
}
|
|
262
262
|
});
|
|
263
263
|
|
|
264
|
+
try {
|
|
265
|
+
if (accuraErrorConfg.has("CameraScreen_Label_Text_Size")){
|
|
266
|
+
tvTitle.setTextSize(accuraErrorConfg.getInt("CameraScreen_Label_Text_Size"));
|
|
267
|
+
tvScanMessage.setTextSize(accuraErrorConfg.getInt("CameraScreen_Label_Text_Size"));
|
|
268
|
+
}else{
|
|
269
|
+
}
|
|
270
|
+
} catch (JSONException e) {
|
|
271
|
+
e.printStackTrace();
|
|
272
|
+
}
|
|
273
|
+
|
|
264
274
|
try {
|
|
265
275
|
borderFrame.setBorderColor(Color.parseColor(accuraErrorConfg.getString("CameraScreen_Frame_Color")));
|
|
266
276
|
borderFrame.setBorderWidth(accuraErrorConfg.getInt("CameraScreen_Border_Width"));
|
|
@@ -58,7 +58,7 @@ public class OcrResultActivity extends Activity implements FaceCallback {
|
|
|
58
58
|
|
|
59
59
|
protected void onCreate(Bundle savedInstanceState) {
|
|
60
60
|
|
|
61
|
-
AndroidNetworking.initialize(this, getUnsafeOkHttpClient());
|
|
61
|
+
// AndroidNetworking.initialize(this, getUnsafeOkHttpClient());
|
|
62
62
|
|
|
63
63
|
faceHelper = new FaceHelper(this);
|
|
64
64
|
faceHelper.setFaceMatchCallBack(this);
|
|
@@ -442,7 +442,7 @@ public class OcrResultActivity extends Activity implements FaceCallback {
|
|
|
442
442
|
startActivityForResult(intent, 201);
|
|
443
443
|
}
|
|
444
444
|
|
|
445
|
-
private void openCamera()
|
|
445
|
+
private void openCamera() {
|
|
446
446
|
|
|
447
447
|
FMCameraScreenCustomization cameraScreenCustomization = new FMCameraScreenCustomization();
|
|
448
448
|
|
|
@@ -610,9 +610,9 @@ public class OcrResultActivity extends Activity implements FaceCallback {
|
|
|
610
610
|
}else{
|
|
611
611
|
cameraScreenCustomization.feedBackProcessingMessage = "Processing...";
|
|
612
612
|
}
|
|
613
|
-
if (faceConfig.has("
|
|
613
|
+
if (faceConfig.has("isShowLogo")){
|
|
614
614
|
try {
|
|
615
|
-
cameraScreenCustomization.showlogo = faceConfig.getInt("
|
|
615
|
+
cameraScreenCustomization.showlogo = faceConfig.getInt("isShowLogo"); // Set 0 if hide logo
|
|
616
616
|
} catch (JSONException e) {
|
|
617
617
|
e.printStackTrace();
|
|
618
618
|
}
|
package/ios/AccurascanKyc.swift
CHANGED
|
@@ -215,7 +215,7 @@ class AccurascanKyc: NSObject {
|
|
|
215
215
|
func setupAccuraConfig(_ argsNew: NSArray, callback: @escaping RCTResponseSenderBlock){
|
|
216
216
|
self.goNativeCallBack = callback
|
|
217
217
|
self.goNativeArgs = argsNew;
|
|
218
|
-
print("\(self.goNativeArgs)")
|
|
218
|
+
// print("\(self.goNativeArgs)")
|
|
219
219
|
let aaaaa = (goNativeArgs[0] as? NSDictionary)!
|
|
220
220
|
let bbbbb = goNativeArgs[1] as! NSDictionary
|
|
221
221
|
let ccccc = goNativeArgs[2] as! NSDictionary
|
|
@@ -368,7 +368,7 @@ class AccurascanKyc: NSObject {
|
|
|
368
368
|
}
|
|
369
369
|
let fmValue = EngineWrapper.getEngineInitValue() //get engineWrapper load status
|
|
370
370
|
if fmValue == -20{
|
|
371
|
-
self.goNativeCallBack!(["key
|
|
371
|
+
self.goNativeCallBack!(["key not found", NSNull()])
|
|
372
372
|
// sendError(msg: "key not found")
|
|
373
373
|
}else if fmValue == -15{
|
|
374
374
|
self.goNativeCallBack!(["License Invalid", NSNull()])
|
|
@@ -404,7 +404,7 @@ class AccurascanKyc: NSObject {
|
|
|
404
404
|
}
|
|
405
405
|
let fmValue = EngineWrapper.getEngineInitValue() //get engineWrapper load status
|
|
406
406
|
if fmValue == -20{
|
|
407
|
-
self.goNativeCallBack!(["key
|
|
407
|
+
self.goNativeCallBack!(["key not found", NSNull()])
|
|
408
408
|
// sendError(msg: "key not found")
|
|
409
409
|
}else if fmValue == -15{
|
|
410
410
|
self.goNativeCallBack!(["License Invalid", NSNull()])
|
package/ios/FMController.swift
CHANGED
|
@@ -70,13 +70,37 @@ class FMController: UIViewController, UIImagePickerControllerDelegate, UINavigat
|
|
|
70
70
|
|
|
71
71
|
override func viewWillAppear(_ animated: Bool) {
|
|
72
72
|
facematch = Facematch.init()
|
|
73
|
-
liveness = Liveness.init()
|
|
74
|
-
liveness.setBlurPercentage(80)
|
|
75
|
-
liveness.setGlarePercentage(-1,-1)
|
|
76
|
-
facematch.setBackGroundColor("#C4C4C5")
|
|
77
|
-
facematch.setCloseIconColor("#000000")
|
|
78
|
-
facematch.setFeedbackBackGroundColor("#C4C4C5")
|
|
79
|
-
facematch.setFeedbackTextColor("#000000")
|
|
73
|
+
// liveness = Liveness.init()
|
|
74
|
+
// liveness.setBlurPercentage(80)
|
|
75
|
+
// liveness.setGlarePercentage(-1,-1)
|
|
76
|
+
// facematch.setBackGroundColor("#C4C4C5")
|
|
77
|
+
// facematch.setCloseIconColor("#000000")
|
|
78
|
+
// facematch.setFeedbackBackGroundColor("#C4C4C5")
|
|
79
|
+
// facematch.setFeedbackTextColor("#000000")
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
if faceArgs["backGroundColor"] != nil{
|
|
83
|
+
facematch.setBackGroundColor(faceArgs["backGroundColor"] as! String)
|
|
84
|
+
}else{
|
|
85
|
+
facematch.setBackGroundColor("#C4C4C5")
|
|
86
|
+
}
|
|
87
|
+
if faceArgs["closeIconColor"] != nil{
|
|
88
|
+
facematch.setCloseIconColor(faceArgs["closeIconColor"] as! String)
|
|
89
|
+
}else{
|
|
90
|
+
facematch.setCloseIconColor("#000000")
|
|
91
|
+
}
|
|
92
|
+
if faceArgs["feedbackBackGroundColor"] != nil{
|
|
93
|
+
facematch.setFeedbackBackGroundColor(faceArgs["feedbackBackGroundColor"] as! String)
|
|
94
|
+
}else{
|
|
95
|
+
facematch.setFeedbackBackGroundColor("#C4C4C5")
|
|
96
|
+
}
|
|
97
|
+
if faceArgs["feedbackTextColor"] != nil{
|
|
98
|
+
facematch.setFeedbackTextColor(faceArgs["feedbackTextColor"] as! String)
|
|
99
|
+
}else{
|
|
100
|
+
facematch.setFeedbackTextColor("#000000")
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
|
|
80
104
|
if faceArgs["setFeedbackTextSize"] != nil {
|
|
81
105
|
facematch.setFeedbackTextSize((faceArgs["setFeedbackTextSize"] as? Float)!)
|
|
82
106
|
}else{
|
|
@@ -144,8 +168,18 @@ class FMController: UIViewController, UIImagePickerControllerDelegate, UINavigat
|
|
|
144
168
|
facematch.setGlarePercentage(-1, -1)
|
|
145
169
|
}
|
|
146
170
|
|
|
147
|
-
|
|
148
|
-
|
|
171
|
+
// print("test:- \(faceArgs["isShowLogo"])")
|
|
172
|
+
if faceArgs["isShowLogo"] != nil &&
|
|
173
|
+
faceArgs["isShowLogo"] as! Int == 0{
|
|
174
|
+
facematch.hideLogo(true)
|
|
175
|
+
}else{
|
|
176
|
+
facematch.hideLogo(false)
|
|
177
|
+
}
|
|
178
|
+
// facematch.setBackGroundColor("#C4C4C5")
|
|
179
|
+
// facematch.setCloseIconColor("#000000")
|
|
180
|
+
// facematch.setFeedbackBackGroundColor("#C4C4C5")
|
|
181
|
+
// facematch.setFeedbackTextColor("#000000")
|
|
182
|
+
|
|
149
183
|
// facematch.setFeedbackTextSize(Float(18.0))
|
|
150
184
|
// facematch.setFeedBackframeMessage("Frame Your Face")
|
|
151
185
|
// facematch.setFeedBackAwayMessage("Move Phone Away")
|
package/ios/LVController.swift
CHANGED
|
@@ -3,6 +3,7 @@ import AccuraOCR
|
|
|
3
3
|
|
|
4
4
|
class LVController: UIViewController,LivenessData,FacematchData
|
|
5
5
|
{
|
|
6
|
+
|
|
6
7
|
@IBOutlet var mainView: UIView!
|
|
7
8
|
var callBack: RCTResponseSenderBlock? = nil
|
|
8
9
|
var liveness = Liveness()
|
|
@@ -33,6 +34,7 @@ class LVController: UIViewController,LivenessData,FacematchData
|
|
|
33
34
|
super.viewWillAppear(animated)
|
|
34
35
|
|
|
35
36
|
if isLiveness{
|
|
37
|
+
|
|
36
38
|
if livenessConfig["backGroundColor"] != nil{
|
|
37
39
|
liveness.setBackGroundColor(livenessConfig["backGroundColor"] as! String)
|
|
38
40
|
}
|
|
@@ -50,12 +52,20 @@ class LVController: UIViewController,LivenessData,FacematchData
|
|
|
50
52
|
liveness.setApiKey(livenessConfig["setApiKey"] as! String)
|
|
51
53
|
}else{
|
|
52
54
|
liveness.setApiKey("")
|
|
53
|
-
|
|
55
|
+
|
|
54
56
|
}
|
|
55
|
-
if livenessConfig["setLivenessURL"] != nil {
|
|
56
|
-
|
|
57
|
-
liveness.setLivenessURL(livenessConfig["setLivenessURL"] as! String)
|
|
57
|
+
// if livenessConfig["setLivenessURL"] != nil {
|
|
58
|
+
//// print("\(livenessConfig["setLivenessURL"])")
|
|
59
|
+
// liveness.setLivenessURL(livenessConfig["setLivenessURL"] as! String)
|
|
60
|
+
// }
|
|
61
|
+
|
|
62
|
+
if livenessConfig["isShowLogo"] != nil &&
|
|
63
|
+
livenessConfig["isShowLogo"] as! Int == 0{
|
|
64
|
+
liveness.hideLogo(true)
|
|
65
|
+
}else{
|
|
66
|
+
liveness.hideLogo(false)
|
|
58
67
|
}
|
|
68
|
+
|
|
59
69
|
if livenessConfig["setFeedbackTextSize"] != nil {
|
|
60
70
|
liveness.setFeedbackTextSize((livenessConfig["setFeedbackTextSize"] as? Float)!)
|
|
61
71
|
}else{
|
|
@@ -128,7 +138,7 @@ class LVController: UIViewController,LivenessData,FacematchData
|
|
|
128
138
|
}
|
|
129
139
|
|
|
130
140
|
|
|
131
|
-
|
|
141
|
+
liveness.setDefaultText("Keep Face In Frame\nFace Must Be Near To Camera")
|
|
132
142
|
// 0 for clean face and 100 for Blurry face
|
|
133
143
|
|
|
134
144
|
// Set min and max percentage for glare
|
|
@@ -225,6 +235,8 @@ class LVController: UIViewController,LivenessData,FacematchData
|
|
|
225
235
|
}else{
|
|
226
236
|
facematch.setGlarePercentage(-1, -1)
|
|
227
237
|
}
|
|
238
|
+
|
|
239
|
+
facematch.setDefaultText("Keep Face In Frame\nFace Must Be Near To Camera")
|
|
228
240
|
// 0 for clean face and 100 for Blurry face
|
|
229
241
|
|
|
230
242
|
// Set min and max percentage for glare
|
|
@@ -285,6 +297,38 @@ class LVController: UIViewController,LivenessData,FacematchData
|
|
|
285
297
|
closeMe()
|
|
286
298
|
}
|
|
287
299
|
|
|
300
|
+
func livenessData(_ livenessImage: UIImage!) {
|
|
301
|
+
var results:[String: Any] = [:]
|
|
302
|
+
|
|
303
|
+
if (faceRegion != nil)
|
|
304
|
+
{
|
|
305
|
+
let face2 = EngineWrapper.detectTargetFaces(livenessImage, feature1: faceRegion?.feature)
|
|
306
|
+
// let face11 = faceRegion?.image
|
|
307
|
+
let fm_Score = EngineWrapper.identify(faceRegion?.feature, featurebuff2: face2?.feature)
|
|
308
|
+
if(fm_Score != 0.0){
|
|
309
|
+
let data = face2?.bound
|
|
310
|
+
let image = self.resizeImage(image: livenessImage, targetSize: data!)
|
|
311
|
+
results["detect"] = AccurascanKyc.getImageUri(img: image, name: nil)
|
|
312
|
+
results["fm_score"] = AccurascanKyc.getImageUri(img: faceImage!, name: nil)
|
|
313
|
+
let twoDecimalPlaces = String(format: "%.2f", fm_Score*100) //Face Match score convert to float value
|
|
314
|
+
// results["score"] = stLivenessValue.replacingOccurrences(of: " %", with: "")
|
|
315
|
+
results["face_score"] = twoDecimalPlaces
|
|
316
|
+
faceImage = nil
|
|
317
|
+
self.callBack!([NSNull(),AccurascanKyc.convertJSONString(results:results)])
|
|
318
|
+
// print(twoDecimalPlaces)
|
|
319
|
+
EngineWrapper.faceEngineClose()
|
|
320
|
+
closeMe()
|
|
321
|
+
}
|
|
322
|
+
}else{
|
|
323
|
+
results["detect"] = AccurascanKyc.getImageUri(img: livenessImage, name: nil)
|
|
324
|
+
// results["score"] = stLivenessValue.replacingOccurrences(of: " %", with: "")
|
|
325
|
+
self.callBack!([NSNull(),AccurascanKyc.convertJSONString(results:results)])
|
|
326
|
+
// callBack!(["Failed to get liveness. Please try again", NSNull()])
|
|
327
|
+
EngineWrapper.faceEngineClose()
|
|
328
|
+
closeMe()
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
|
|
288
332
|
func livenessData(_ stLivenessValue: String!, livenessImage: UIImage!, status: Bool) {
|
|
289
333
|
isLiveness = false
|
|
290
334
|
var results:[String: Any] = [:]
|
package/ios/ViewController.swift
CHANGED
|
@@ -169,6 +169,15 @@ class ViewController: UIViewController {
|
|
|
169
169
|
_lblTitle.attributedText = NSAttributedString(string: " ", attributes: strokeTextAttributes)
|
|
170
170
|
lblOCRMsg.attributedText = NSAttributedString(string: " ", attributes: strokeTextAttributes)
|
|
171
171
|
}
|
|
172
|
+
// font size
|
|
173
|
+
if let lblTextSize = accuraErrorCode["CameraScreen_Label_Text_Size"] as? Int {
|
|
174
|
+
_lblTitle.font = UIFont.systemFont(ofSize: CGFloat(lblTextSize))
|
|
175
|
+
lblOCRMsg.font = UIFont.systemFont(ofSize: CGFloat(lblTextSize))
|
|
176
|
+
}else{
|
|
177
|
+
_lblTitle.font = UIFont.systemFont(ofSize: CGFloat(16.0))
|
|
178
|
+
lblOCRMsg.font = UIFont.systemFont(ofSize: CGFloat(16.0))
|
|
179
|
+
}
|
|
180
|
+
|
|
172
181
|
|
|
173
182
|
if(accuraErrorCode["CameraScreen_Color"] as! String == ""){
|
|
174
183
|
cameraView1.backgroundColor = .clear
|
|
File without changes
|
|
File without changes
|