@regulaforensics/cordova-plugin-document-reader-api 6.7.5 → 6.8.0
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/example/config.xml +3 -4
- package/example/package.json +8 -12
- package/example/www/index.html +105 -105
- package/example/www/js/index.js +30 -22
- package/package.json +1 -1
- package/plugin.xml +7 -7
- package/src/android/DocumentReader.java +30 -0
- package/src/android/JSONConstructor.java +2 -0
- package/src/android/RegulaConfig.java +26 -0
- package/src/android/build.gradle +1 -1
- package/src/ios/RGLWDocumentReader.h +25 -0
- package/src/ios/{RGLDocumentReader.m → RGLWDocumentReader.m} +172 -147
- package/src/ios/RGLWJSONConstructor.h +1 -0
- package/src/ios/RGLWJSONConstructor.m +7 -0
- package/src/ios/{RegulaConfig.h → RGLWRegulaConfig.h} +3 -3
- package/src/ios/{RegulaConfig.m → RGLWRegulaConfig.m} +26 -4
- package/www/DocumentReader.js +118 -10
- package/src/ios/RGLDocumentReader.h +0 -19
package/example/config.xml
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<?xml version='1.0' encoding='utf-8'?>
|
|
2
|
-
<widget android-packageName="com.regula.documentreader" ios-CFBundleIdentifier="
|
|
2
|
+
<widget android-packageName="com.regula.documentreader" ios-CFBundleIdentifier="regula.DocumentReader" version="1.0.0" xmlns:android="http://schemas.android.com/apk/res/android" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
|
|
3
3
|
<name>DocumentReader</name>
|
|
4
4
|
<description>
|
|
5
5
|
A sample Regula Document Reader application for reading and validation of identification documents.
|
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
Regula Forensics Inc.
|
|
9
9
|
</author>
|
|
10
10
|
<content src="index.html" />
|
|
11
|
-
<plugin name="cordova-plugin-whitelist" spec="1" />
|
|
12
11
|
<access origin="*" />
|
|
13
12
|
<allow-intent href="http://*/*" />
|
|
14
13
|
<allow-intent href="https://*/*" />
|
|
@@ -20,8 +19,8 @@
|
|
|
20
19
|
<preference name="GradlePluginKotlinEnabled" value="true" />
|
|
21
20
|
<preference name="GradlePluginKotlinCodeStyle" value="official" />
|
|
22
21
|
<preference name="GradlePluginKotlinVersion" value="1.7.10" />
|
|
23
|
-
<preference name="android-minSdkVersion" value="
|
|
24
|
-
<preference name="android-targetSdkVersion" value="
|
|
22
|
+
<preference name="android-minSdkVersion" value="23" />
|
|
23
|
+
<preference name="android-targetSdkVersion" value="33" />
|
|
25
24
|
<preference name="AndroidXEnabled" value="true" />
|
|
26
25
|
<allow-intent href="market:*" />
|
|
27
26
|
<config-file parent="/manifest/application" target="AndroidManifest.xml">
|
package/example/package.json
CHANGED
|
@@ -13,15 +13,15 @@
|
|
|
13
13
|
"author": "Regula Forensics Inc.",
|
|
14
14
|
"license": "commercial",
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"cordova-android": "
|
|
17
|
-
"cordova-ios": "^6.
|
|
16
|
+
"cordova-android": "10.1.2",
|
|
17
|
+
"cordova-ios": "^6.3.0",
|
|
18
18
|
"cordova-plugin-add-swift-support": "^2.0.2",
|
|
19
|
-
"@regulaforensics/cordova-plugin-document-reader-api": "6.
|
|
20
|
-
"@regulaforensics/cordova-plugin-document-reader-core-fullrfid": "6.
|
|
21
|
-
"cordova-plugin-file": "^
|
|
22
|
-
"cordova-plugin-telerik-imagepicker": "^2.3.
|
|
23
|
-
"cordova-plugin-android-permissions": "1.1.
|
|
24
|
-
"cordova-plugin-advanced-http": "3.
|
|
19
|
+
"@regulaforensics/cordova-plugin-document-reader-api": "6.8.0",
|
|
20
|
+
"@regulaforensics/cordova-plugin-document-reader-core-fullrfid": "6.8.0",
|
|
21
|
+
"cordova-plugin-file": "^7.0.0",
|
|
22
|
+
"cordova-plugin-telerik-imagepicker": "^2.3.6",
|
|
23
|
+
"cordova-plugin-android-permissions": "1.1.5",
|
|
24
|
+
"cordova-plugin-advanced-http": "3.3.1",
|
|
25
25
|
"jetifier": "^2.0.0"
|
|
26
26
|
},
|
|
27
27
|
"cordova": {
|
|
@@ -35,7 +35,6 @@
|
|
|
35
35
|
"cordova-plugin-telerik-imagepicker": {
|
|
36
36
|
"PHOTO_LIBRARY_USAGE_DESCRIPTION": " "
|
|
37
37
|
},
|
|
38
|
-
"cordova-plugin-whitelist": {},
|
|
39
38
|
"cordova-plugin-android-permissions": {},
|
|
40
39
|
"cordova-plugin-advanced-http": {}
|
|
41
40
|
},
|
|
@@ -43,8 +42,5 @@
|
|
|
43
42
|
"android",
|
|
44
43
|
"ios"
|
|
45
44
|
]
|
|
46
|
-
},
|
|
47
|
-
"devDependencies": {
|
|
48
|
-
"cordova-plugin-whitelist": "^1.3.4"
|
|
49
45
|
}
|
|
50
46
|
}
|
package/example/www/index.html
CHANGED
|
@@ -1,113 +1,113 @@
|
|
|
1
1
|
<!DOCTYPE html>
|
|
2
2
|
<html>
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
3
|
+
|
|
4
|
+
<head>
|
|
5
|
+
<meta http-equiv="Content-Security-Policy"
|
|
6
|
+
content="default-src 'self' data: gap: https://ssl.gstatic.com 'unsafe-eval'; style-src 'self' 'unsafe-inline'; media-src *; img-src 'self' data: content:;">
|
|
7
|
+
<meta name="format-detection" content="telephone=no">
|
|
8
|
+
<meta name="msapplication-tap-highlight" content="no">
|
|
9
|
+
<meta name="viewport" content="initial-scale=1, width=device-width, viewport-fit=cover">
|
|
10
|
+
<link rel="stylesheet" type="text/css" href="css/index.css">
|
|
11
|
+
<link rel="icon" href="data:,">
|
|
12
|
+
<title>Document Reader</title>
|
|
13
|
+
</head>
|
|
14
|
+
|
|
15
|
+
<body>
|
|
16
|
+
<div id="rfidUI" style="text-align: center; background-color: #F5FCFF; height: 100%; width:100%; display: none;">
|
|
17
|
+
<div
|
|
18
|
+
style="position: absolute; top: 50%; left: 50%; width:100%; -ms-transform: translate(-50%, -50%); transform: translate(-50%, -50%); ">
|
|
19
|
+
<p id="rfidUIHeader">Reading RFID</p>
|
|
20
|
+
<p id="rfidDescription">Place your phone on top of the NFC tag</p>
|
|
21
|
+
<progress id="rfidProgress" value="0" max="100"></progress>
|
|
22
|
+
<br><br><br>
|
|
23
|
+
<button id="cancelButton">X</button>
|
|
24
|
+
</div>
|
|
25
|
+
</div>
|
|
26
|
+
<div id="mainUI" style="text-align: center;background-color: #F5FCFF;height: 100%;">
|
|
27
|
+
<div style="padding: 5px">
|
|
28
|
+
<div id="deviceready" style="padding-top: 12px; width: 100%; text-align: center;">
|
|
29
|
+
<p class="event listening">Connecting to Device</p>
|
|
30
|
+
<p id="status" class="event received">Ready</p>
|
|
31
|
+
</div>
|
|
32
|
+
<div style="align-items:center; text-align: center;display: inline-block;"><br><br>
|
|
33
|
+
<p style="margin-bottom: 5px">Portrait</p>
|
|
34
|
+
<img style="height: 133px; width: 100px" src="img/portrait.png" resizeMode="contain"
|
|
35
|
+
id="portraitImage" />
|
|
21
36
|
</div>
|
|
37
|
+
<div style="align-items: center; text-align: center; display: inline-block;"><br><br>
|
|
38
|
+
<p style="margin-bottom: 5px">Document</p>
|
|
39
|
+
<img style="height: 133px;" src="img/id.png" resizeMode="contain" id="documentImage" />
|
|
40
|
+
</div>
|
|
41
|
+
</div>
|
|
42
|
+
|
|
43
|
+
<div>
|
|
44
|
+
<div id="scenariosRadioGroup"
|
|
45
|
+
style="position: absolute; bottom: 130px; top: 300px; left: 75px; width:225px; padding: 5px; text-align:left; overflow: auto" />
|
|
22
46
|
</div>
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
</div>
|
|
29
|
-
<div style="align-items:center; text-align: center;display: inline-block;"><br><br>
|
|
30
|
-
<p style="margin-bottom: 5px">Portrait</p>
|
|
31
|
-
<img style="height: 133px; width: 100px" src="img/portrait.png" resizeMode="contain"
|
|
32
|
-
id="portraitImage"/>
|
|
33
|
-
</div>
|
|
34
|
-
<div style="align-items: center; text-align: center; display: inline-block;"><br><br>
|
|
35
|
-
<p style="margin-bottom: 5px">Document</p>
|
|
36
|
-
<img style="height: 133px;" src="img/id.png" resizeMode="contain" id="documentImage"/>
|
|
37
|
-
</div>
|
|
47
|
+
|
|
48
|
+
<div style="position: absolute; bottom: 0px; width: 100%;">
|
|
49
|
+
<div id="rfidDiv" style="flex-direction: row; padding: 5px">
|
|
50
|
+
<input id="rfidCheckbox" type="checkbox" name="rfid" disabled><span id="rfidCheckboxText"
|
|
51
|
+
style="color: lightgrey"> Process rfid reading(unavailable)</span><br>
|
|
38
52
|
</div>
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
style="position: absolute; bottom: 130px; top: 300px; left: 75px; width:225px; padding: 5px; text-align:left; overflow: auto"/>
|
|
53
|
+
<div id="encryptionDiv" style="flex-direction: row; padding: 5px">
|
|
54
|
+
<input id="encryptionCheckbox" type="checkbox" name="rfid" disabled><span id="encryptionCheckboxText"
|
|
55
|
+
style="color: lightgrey"> Data encryption(unavailable)</span><br>
|
|
43
56
|
</div>
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
<
|
|
47
|
-
<input id="rfidCheckbox" type="checkbox" name="rfid" disabled><span
|
|
48
|
-
id="rfidCheckboxText"
|
|
49
|
-
style="color: lightgrey"> Process rfid reading(unavailable)</span><br>
|
|
50
|
-
</div>
|
|
51
|
-
<div id="encryptionDiv" style="flex-direction: row; padding: 5px">
|
|
52
|
-
<input id="encryptionCheckbox" type="checkbox" name="rfid" disabled><span
|
|
53
|
-
id="encryptionCheckboxText"
|
|
54
|
-
style="color: lightgrey"> Data encryption(unavailable)</span><br>
|
|
55
|
-
</div>
|
|
56
|
-
<div style="flex-direction: row; padding: 10px">
|
|
57
|
-
<button id="showScannerButton" style="margin-right: 20px">scan doc</button>
|
|
58
|
-
<button id="showImagePicker" style="margin-left: 20px">scan image</button>
|
|
59
|
-
</div>
|
|
57
|
+
<div style="flex-direction: row; padding: 10px">
|
|
58
|
+
<button id="showScannerButton" style="margin-right: 20px">scan doc</button>
|
|
59
|
+
<button id="showImagePicker" style="margin-left: 20px">scan image</button>
|
|
60
60
|
</div>
|
|
61
61
|
</div>
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
</html>
|
|
62
|
+
</div>
|
|
63
|
+
|
|
64
|
+
<script type="text/javascript" src="cordova.js"></script>
|
|
65
|
+
<script type="text/javascript" src="js/index.js"></script>
|
|
66
|
+
|
|
67
|
+
<style type="text/css">
|
|
68
|
+
button {
|
|
69
|
+
width: 40%;
|
|
70
|
+
-moz-box-shadow: inset 0px -3px 7px 0px #29bbff;
|
|
71
|
+
-webkit-box-shadow: inset 0px -3px 7px 0px #29bbff;
|
|
72
|
+
box-shadow: inset 0px -3px 7px 0px #29bbff;
|
|
73
|
+
background: -webkit-gradient(linear, left top, left bottom, color-stop(0.05, #2dabf9), color-stop(1, #0688fa));
|
|
74
|
+
background: -moz-linear-gradient(top, #2dabf9 5%, #0688fa 100%);
|
|
75
|
+
background: -webkit-linear-gradient(top, #2dabf9 5%, #0688fa 100%);
|
|
76
|
+
background: -o-linear-gradient(top, #2dabf9 5%, #0688fa 100%);
|
|
77
|
+
background: -ms-linear-gradient(top, #2dabf9 5%, #0688fa 100%);
|
|
78
|
+
background: linear-gradient(to bottom, #2dabf9 5%, #0688fa 100%);
|
|
79
|
+
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#2dabf9', endColorstr='#0688fa', GradientType=0);
|
|
80
|
+
background-color: #2dabf9;
|
|
81
|
+
-moz-border-radius: 3px;
|
|
82
|
+
-webkit-border-radius: 3px;
|
|
83
|
+
border-radius: 3px;
|
|
84
|
+
border: 1px solid #0b0e07;
|
|
85
|
+
display: inline-block;
|
|
86
|
+
cursor: pointer;
|
|
87
|
+
color: #ffffff;
|
|
88
|
+
font-family: Arial;
|
|
89
|
+
font-size: 15px;
|
|
90
|
+
padding: 9px 23px;
|
|
91
|
+
text-decoration: none;
|
|
92
|
+
text-shadow: 0px 1px 0px #263666;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
button:hover {
|
|
96
|
+
background: -webkit-gradient(linear, left top, left bottom, color-stop(0.05, #0688fa), color-stop(1, #2dabf9));
|
|
97
|
+
background: -moz-linear-gradient(top, #0688fa 5%, #2dabf9 100%);
|
|
98
|
+
background: -webkit-linear-gradient(top, #0688fa 5%, #2dabf9 100%);
|
|
99
|
+
background: -o-linear-gradient(top, #0688fa 5%, #2dabf9 100%);
|
|
100
|
+
background: -ms-linear-gradient(top, #0688fa 5%, #2dabf9 100%);
|
|
101
|
+
background: linear-gradient(to bottom, #0688fa 5%, #2dabf9 100%);
|
|
102
|
+
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#0688fa', endColorstr='#2dabf9', GradientType=0);
|
|
103
|
+
background-color: #0688fa;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
button:active {
|
|
107
|
+
position: relative;
|
|
108
|
+
top: 1px;
|
|
109
|
+
}
|
|
110
|
+
</style>
|
|
111
|
+
</body>
|
|
112
|
+
|
|
113
|
+
</html>
|
package/example/www/js/index.js
CHANGED
|
@@ -8,9 +8,14 @@ var app = {
|
|
|
8
8
|
document.getElementById("status").innerHTML = "loading......"
|
|
9
9
|
document.getElementById("status").style.backgroundColor = "grey"
|
|
10
10
|
var http = cordova.plugin.http
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
var
|
|
11
|
+
|
|
12
|
+
// This way you can import any class declared in DocumentReaderPlugin
|
|
13
|
+
var DocumentReader = DocumentReaderPlugin.DocumentReader
|
|
14
|
+
var DocumentReaderResults = DocumentReaderPlugin.DocumentReaderResults
|
|
15
|
+
var DocumentReaderScenario = DocumentReaderPlugin.DocumentReaderScenario
|
|
16
|
+
var DocumentReaderCompletion = DocumentReaderPlugin.DocumentReaderCompletion
|
|
17
|
+
var Enum = DocumentReaderPlugin.Enum
|
|
18
|
+
|
|
14
19
|
var doRfid = false
|
|
15
20
|
var encryption = false
|
|
16
21
|
const ENCRYPTED_RESULT_SERVICE = "https://api.regulaforensics.com/api/process"
|
|
@@ -64,7 +69,7 @@ var app = {
|
|
|
64
69
|
|
|
65
70
|
function scan() {
|
|
66
71
|
DocumentReader.showScanner(function (m) {
|
|
67
|
-
handleCompletion(
|
|
72
|
+
handleCompletion(DocumentReaderCompletion.fromJson(JSON.parse(m)))
|
|
68
73
|
}, function (e) { })
|
|
69
74
|
}
|
|
70
75
|
|
|
@@ -93,7 +98,7 @@ var app = {
|
|
|
93
98
|
window.imagePicker.getPictures(function (images) {
|
|
94
99
|
document.getElementById("status").innerHTML = "processing image......"
|
|
95
100
|
document.getElementById("status").style.backgroundColor = "grey"
|
|
96
|
-
DocumentReader.recognizeImages(images, function (m) { handleCompletion(
|
|
101
|
+
DocumentReader.recognizeImages(images, function (m) { handleCompletion(DocumentReaderCompletion.fromJson(JSON.parse(m))) }, function (e) { })
|
|
97
102
|
}, function (e) { }, { maximumImagesCount: 10, outputType: window.imagePicker.OutputType.BASE64_STRING })
|
|
98
103
|
}
|
|
99
104
|
|
|
@@ -147,6 +152,7 @@ var app = {
|
|
|
147
152
|
}
|
|
148
153
|
|
|
149
154
|
function updateRfidUI(results) {
|
|
155
|
+
if (results.value == null) return
|
|
150
156
|
if (results.code === Enum.eRFID_NotificationCodes.RFID_NOTIFICATION_PCSC_READING_DATAGROUP) {
|
|
151
157
|
rfidDescription = Enum.eRFID_DataFile_Type.getTranslation(results.dataFileType)
|
|
152
158
|
document.getElementById("rfidDescription").innerHTML = rfidDescription
|
|
@@ -163,31 +169,33 @@ var app = {
|
|
|
163
169
|
|
|
164
170
|
function customRFID() {
|
|
165
171
|
showRfidUI()
|
|
166
|
-
DocumentReader.readRFID(function (m) {
|
|
172
|
+
DocumentReader.readRFID(function (m) { handleRfidCompletion(m) }, function (e) { })
|
|
167
173
|
}
|
|
168
174
|
|
|
169
175
|
function usualRFID() {
|
|
170
176
|
isReadingRfid = true
|
|
177
|
+
DocumentReader.startRFIDReader(function (m) { handleRfidCompletion(m) }, function (e) { })
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
function handleRfidCompletion(raw) {
|
|
171
181
|
var notification = "rfidNotificationCompletionEvent"
|
|
172
182
|
var paCert = "paCertificateCompletionEvent"
|
|
173
183
|
var taCert = "taCertificateCompletionEvent"
|
|
174
184
|
var taSig = "taSignatureCompletionEvent"
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
handleCompletion(DocumentReader.DocumentReaderCompletion.fromJson(JSON.parse(m)))
|
|
190
|
-
}, function (e) { })
|
|
185
|
+
if (raw.substring(0, notification.length) === notification) {
|
|
186
|
+
raw = raw.substring(notification.length, raw.length)
|
|
187
|
+
console.log(notification + ": " + raw)
|
|
188
|
+
} else if (raw.substring(0, paCert.length) === paCert) {
|
|
189
|
+
raw = raw.substring(paCert.length, raw.length)
|
|
190
|
+
console.log(paCert + ": " + raw)
|
|
191
|
+
} else if (raw.substring(0, taCert.length) === taCert) {
|
|
192
|
+
raw = raw.substring(taCert.length, raw.length)
|
|
193
|
+
console.log(taCert + ": " + raw)
|
|
194
|
+
} else if (raw.substring(0, taSig.length) === taSig) {
|
|
195
|
+
raw = raw.substring(taSig.length, raw.length)
|
|
196
|
+
console.log(taSig + ": " + raw)
|
|
197
|
+
} else
|
|
198
|
+
handleCompletion(DocumentReaderCompletion.fromJson(JSON.parse(raw)))
|
|
191
199
|
}
|
|
192
200
|
|
|
193
201
|
function handleResults(results) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@regulaforensics/cordova-plugin-document-reader-api",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.8.0",
|
|
4
4
|
"description": "Cordova plugin for reading and validation of identification documents (API framework)",
|
|
5
5
|
"cordova": {
|
|
6
6
|
"id": "@regulaforensics/cordova-plugin-document-reader-api",
|
package/plugin.xml
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<?xml version='1.0' encoding='utf-8'?>
|
|
2
|
-
<plugin id="cordova-plugin-document-reader-api" version="6.
|
|
2
|
+
<plugin id="cordova-plugin-document-reader-api" version="6.8.0"
|
|
3
3
|
xmlns="http://apache.org/cordova/ns/plugins/1.0">
|
|
4
4
|
<name>DocumentReaderApi</name>
|
|
5
5
|
<description>Cordova plugin Document reader api</description>
|
|
@@ -13,20 +13,20 @@
|
|
|
13
13
|
<platform name="ios">
|
|
14
14
|
<config-file target="config.xml" parent="/widget">
|
|
15
15
|
<feature name="DocumentReader">
|
|
16
|
-
<param name="ios-package" value="
|
|
16
|
+
<param name="ios-package" value="RGLWDocumentReader" />
|
|
17
17
|
</feature>
|
|
18
18
|
</config-file>
|
|
19
|
-
<header-file src="src/ios/
|
|
20
|
-
<source-file src="src/ios/
|
|
19
|
+
<header-file src="src/ios/RGLWDocumentReader.h" />
|
|
20
|
+
<source-file src="src/ios/RGLWDocumentReader.m" />
|
|
21
21
|
<header-file src="src/ios/RGLWJSONConstructor.h" />
|
|
22
22
|
<source-file src="src/ios/RGLWJSONConstructor.m" />
|
|
23
|
-
<header-file src="src/ios/
|
|
24
|
-
<source-file src="src/ios/
|
|
23
|
+
<header-file src="src/ios/RGLWRegulaConfig.h" />
|
|
24
|
+
<source-file src="src/ios/RGLWRegulaConfig.m" />
|
|
25
25
|
<podspec>
|
|
26
26
|
<config>
|
|
27
27
|
</config>
|
|
28
28
|
<pods>
|
|
29
|
-
<pod name="DocumentReader" spec="6.
|
|
29
|
+
<pod name="DocumentReader" spec="6.8.2981" />
|
|
30
30
|
</pods>
|
|
31
31
|
</podspec>
|
|
32
32
|
</platform>
|
|
@@ -6,6 +6,8 @@ import android.app.PendingIntent;
|
|
|
6
6
|
import android.content.Context;
|
|
7
7
|
import android.content.Intent;
|
|
8
8
|
import android.content.IntentFilter;
|
|
9
|
+
import android.content.res.Configuration;
|
|
10
|
+
import android.content.res.Resources;
|
|
9
11
|
import android.graphics.Bitmap;
|
|
10
12
|
import android.nfc.NfcAdapter;
|
|
11
13
|
import android.nfc.tech.IsoDep;
|
|
@@ -50,6 +52,7 @@ import java.io.IOException;
|
|
|
50
52
|
import java.io.InputStream;
|
|
51
53
|
import java.util.ArrayList;
|
|
52
54
|
import java.util.List;
|
|
55
|
+
import java.util.Locale;
|
|
53
56
|
|
|
54
57
|
import static com.regula.documentreader.api.DocumentReader.Instance;
|
|
55
58
|
|
|
@@ -168,6 +171,12 @@ public class DocumentReader extends CordovaPlugin {
|
|
|
168
171
|
callbackContext.sendPluginResult(pluginResult);
|
|
169
172
|
}
|
|
170
173
|
|
|
174
|
+
private void sendOnCustomButtonTappedEvent(int tag) {
|
|
175
|
+
PluginResult pluginResult = new PluginResult(PluginResult.Status.OK, tag);
|
|
176
|
+
pluginResult.setKeepCallback(true);
|
|
177
|
+
callbackContext.sendPluginResult(pluginResult);
|
|
178
|
+
}
|
|
179
|
+
|
|
171
180
|
|
|
172
181
|
@Override
|
|
173
182
|
public boolean execute(String action, JSONArray args, CallbackContext callbackContext) {
|
|
@@ -397,6 +406,12 @@ public class DocumentReader extends CordovaPlugin {
|
|
|
397
406
|
case "recognizeImagesWithImageInputs":
|
|
398
407
|
recognizeImagesWithImageInputs(callback, args(0));
|
|
399
408
|
break;
|
|
409
|
+
case "setOnCustomButtonTappedListener":
|
|
410
|
+
setOnCustomButtonTappedListener(callback);
|
|
411
|
+
break;
|
|
412
|
+
case "setLanguage":
|
|
413
|
+
setLanguage(callback, args(0));
|
|
414
|
+
break;
|
|
400
415
|
case "textFieldValueByType":
|
|
401
416
|
textFieldValueByType(callback, args(0), args(1));
|
|
402
417
|
break;
|
|
@@ -792,6 +807,21 @@ public class DocumentReader extends CordovaPlugin {
|
|
|
792
807
|
startForegroundDispatch(getActivity());
|
|
793
808
|
}
|
|
794
809
|
|
|
810
|
+
private void setOnCustomButtonTappedListener(Callback callback) {
|
|
811
|
+
Instance().setOnClickListener(view -> sendOnCustomButtonTappedEvent((int) view.getTag()));
|
|
812
|
+
callback.success();
|
|
813
|
+
}
|
|
814
|
+
|
|
815
|
+
private void setLanguage(Callback callback, String language) {
|
|
816
|
+
Locale locale = new Locale(language);
|
|
817
|
+
Locale.setDefault(locale);
|
|
818
|
+
Resources resources = getContext().getResources();
|
|
819
|
+
Configuration config = resources.getConfiguration();
|
|
820
|
+
config.setLocale(locale);
|
|
821
|
+
resources.updateConfiguration(config, resources.getDisplayMetrics());
|
|
822
|
+
callback.success();
|
|
823
|
+
}
|
|
824
|
+
|
|
795
825
|
private void providePACertificates(Callback callback, JSONArray certificatesJSON) throws JSONException {
|
|
796
826
|
if (paCertificateCompletion == null) {
|
|
797
827
|
callback.error("paCertificateCompletion is null");
|
|
@@ -423,6 +423,7 @@ class JSONConstructor {
|
|
|
423
423
|
result.put("fieldType", input.fieldType);
|
|
424
424
|
result.put("lightType", input.light);
|
|
425
425
|
result.put("pageIndex", input.pageIndex);
|
|
426
|
+
result.put("originalPageIndex", input.originalPageIndex);
|
|
426
427
|
result.put("fieldName", eGraphicFieldType.getTranslation(context, input.fieldType));
|
|
427
428
|
result.put("lightName", eRPRM_Lights.getTranslation(context, input.light));
|
|
428
429
|
result.put("value", input.imageBase64());
|
|
@@ -575,6 +576,7 @@ class JSONConstructor {
|
|
|
575
576
|
result.put("dType", input.dType);
|
|
576
577
|
result.put("dFormat", input.dFormat);
|
|
577
578
|
result.put("dMRZ", input.dMRZ);
|
|
579
|
+
result.put("isDeprecated", input.isDeprecated);
|
|
578
580
|
result.put("name", input.name);
|
|
579
581
|
result.put("ICAOCode", input.ICAOCode);
|
|
580
582
|
result.put("dDescription", input.dDescription);
|
|
@@ -10,6 +10,7 @@ import com.regula.documentreader.api.params.OnlineProcessingConfig;
|
|
|
10
10
|
import com.regula.documentreader.api.params.ParamsCustomization;
|
|
11
11
|
import com.regula.documentreader.api.params.Functionality;
|
|
12
12
|
import com.regula.documentreader.api.params.ProcessParam;
|
|
13
|
+
import com.regula.documentreader.api.params.rfid.RFIDParams;
|
|
13
14
|
import com.regula.documentreader.api.params.rfid.ReprocParams;
|
|
14
15
|
import com.regula.documentreader.api.params.rfid.dg.DataGroups;
|
|
15
16
|
|
|
@@ -229,6 +230,10 @@ class RegulaConfig {
|
|
|
229
230
|
processParams.splitNames = opts.getBoolean("splitNames");
|
|
230
231
|
if (opts.has("convertCase"))
|
|
231
232
|
processParams.convertCase = opts.getInt("convertCase");
|
|
233
|
+
if (opts.has("doFlipYAxis"))
|
|
234
|
+
processParams.doFlipYAxis = opts.getBoolean("doFlipYAxis");
|
|
235
|
+
if (opts.has("rfidParams"))
|
|
236
|
+
processParams.rfidParams = RFIDParamsFromJSON(opts.getJSONObject("rfidParams"));
|
|
232
237
|
}
|
|
233
238
|
|
|
234
239
|
private static void setCustomization(ParamsCustomization customization, JSONObject opts, Context context) throws JSONException {
|
|
@@ -251,6 +256,8 @@ class RegulaConfig {
|
|
|
251
256
|
editor.setMultipageButtonBackgroundColor(opts.getString("multipageButtonBackgroundColor"));
|
|
252
257
|
if (opts.has("tintColor"))
|
|
253
258
|
editor.setTintColor(opts.getString("tintColor"));
|
|
259
|
+
if (opts.has("cameraPreviewBackgroundColor"))
|
|
260
|
+
editor.setCameraPreviewBackgroundColor(opts.getString("cameraPreviewBackgroundColor"));
|
|
254
261
|
if (opts.has("activityIndicatorColor"))
|
|
255
262
|
editor.setActivityIndicatorColor(opts.getString("activityIndicatorColor"));
|
|
256
263
|
if (opts.has("showStatusMessages"))
|
|
@@ -351,6 +358,8 @@ class RegulaConfig {
|
|
|
351
358
|
editor.setHologramAnimationImageScaleType(ScaleType.valueOf(opts.getString("hologramAnimationImageScaleType")));
|
|
352
359
|
if (opts.has("uiCustomizationLayer"))
|
|
353
360
|
editor.setUiCustomizationLayer(opts.getJSONObject("uiCustomizationLayer"));
|
|
361
|
+
if (opts.has("activityIndicatorSize"))
|
|
362
|
+
editor.setActivityIndicatorSize(opts.getInt("activityIndicatorSize"));
|
|
354
363
|
|
|
355
364
|
editor.applyImmediately(context);
|
|
356
365
|
}
|
|
@@ -400,6 +409,7 @@ class RegulaConfig {
|
|
|
400
409
|
object.put("resultStatus", customization.getResultStatus());
|
|
401
410
|
object.put("cameraFrameDefaultColor", customization.getCameraFrameDefaultColor());
|
|
402
411
|
object.put("cameraFrameActiveColor", customization.getCameraFrameActiveColor());
|
|
412
|
+
object.put("cameraPreviewBackgroundColor", customization.getCameraPreviewBackgroundColor());
|
|
403
413
|
object.put("statusTextColor", customization.getStatusTextColor());
|
|
404
414
|
object.put("resultStatusTextColor", customization.getResultStatusTextColor());
|
|
405
415
|
object.put("resultStatusBackgroundColor", customization.getResultStatusBackgroundColor());
|
|
@@ -455,6 +465,7 @@ class RegulaConfig {
|
|
|
455
465
|
object.put("hologramAnimationImageMatrix", customization.getHologramAnimationImageMatrix());
|
|
456
466
|
object.put("hologramAnimationImageScaleType", customization.getHologramAnimationImageScaleType());
|
|
457
467
|
object.put("uiCustomizationLayer", customization.getUiCustomizationLayer());
|
|
468
|
+
object.put("activityIndicatorSize", customization.getActivityIndicatorSize());
|
|
458
469
|
|
|
459
470
|
return object;
|
|
460
471
|
}
|
|
@@ -519,6 +530,7 @@ class RegulaConfig {
|
|
|
519
530
|
object.put("respectImageQuality", processParams.respectImageQuality);
|
|
520
531
|
object.put("splitNames", processParams.splitNames);
|
|
521
532
|
object.put("convertCase", processParams.convertCase);
|
|
533
|
+
object.put("doFlipYAxis", processParams.doFlipYAxis);
|
|
522
534
|
|
|
523
535
|
return object;
|
|
524
536
|
}
|
|
@@ -713,4 +725,18 @@ class RegulaConfig {
|
|
|
713
725
|
}
|
|
714
726
|
return null;
|
|
715
727
|
}
|
|
728
|
+
|
|
729
|
+
private static RFIDParams RFIDParamsFromJSON(JSONObject input) {
|
|
730
|
+
try {
|
|
731
|
+
RFIDParams result = new RFIDParams();
|
|
732
|
+
|
|
733
|
+
if (input.has("paIgnoreNotificationCodes"))
|
|
734
|
+
result.setPaIgnoreNotificationCodes(JSONConstructor.intArrayFromJSON(input.getJSONArray("paIgnoreNotificationCodes")));
|
|
735
|
+
|
|
736
|
+
return result;
|
|
737
|
+
} catch (JSONException e) {
|
|
738
|
+
e.printStackTrace();
|
|
739
|
+
}
|
|
740
|
+
return null;
|
|
741
|
+
}
|
|
716
742
|
}
|
package/src/android/build.gradle
CHANGED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
#import <Cordova/CDVPlugin.h>
|
|
2
|
+
#import <Foundation/Foundation.h>
|
|
3
|
+
#import "RGLWJSONConstructor.h"
|
|
4
|
+
#import "RGLWRegulaConfig.h"
|
|
5
|
+
#import <DocumentReader/DocumentReader.h>
|
|
6
|
+
|
|
7
|
+
@class DocReader;
|
|
8
|
+
|
|
9
|
+
typedef void (^RGLWCallback)(NSString* _Nullable response);
|
|
10
|
+
|
|
11
|
+
@interface RGLWDocumentReader : CDVPlugin<RGLRecordScanningProcessDelegate,
|
|
12
|
+
RGLDocReaderRFIDDelegate,
|
|
13
|
+
RGLCustomizationActionDelegate>
|
|
14
|
+
|
|
15
|
+
@property (class) CDVInvokedUrlCommand* _Nullable command;
|
|
16
|
+
@property (class) NSNumber* _Nullable databasePercentageDownloaded;
|
|
17
|
+
|
|
18
|
+
- (void) sendEvent:(NSString*_Nullable)data :(NSString*_Nonnull)callbackId;
|
|
19
|
+
|
|
20
|
+
@end
|
|
21
|
+
|
|
22
|
+
typedef void (^RGLWRFIDSignatureCallback)(NSData * _Nonnull signature);
|
|
23
|
+
|
|
24
|
+
@interface RGLWRFIDDelegateNoPA : NSObject<RGLDocReaderRFIDDelegate>
|
|
25
|
+
@end
|