@regulaforensics/cordova-plugin-document-reader-api 7.4.620 → 7.5.19-rc
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 +1 -1
- package/example/config.xml +14 -12
- package/example/package.json +4 -4
- package/example/www/js/index.js +5 -0
- package/package.json +4 -8
- package/plugin.xml +6 -5
- package/src/android/BluetoothUtil.kt +95 -45
- package/src/android/Config.kt +43 -2
- package/src/android/DocumentReader.kt +36 -21
- package/src/android/JSONConstructor.kt +27 -13
- package/src/android/Utils.kt +7 -2
- package/src/android/build.gradle +2 -4
- package/src/ios/RGLWConfig.m +45 -7
- package/src/ios/RGLWDocumentReader.h +4 -1
- package/src/ios/RGLWDocumentReader.m +71 -21
- package/src/ios/RGLWJSONConstructor.h +3 -0
- package/src/ios/RGLWJSONConstructor.m +33 -2
- package/www/DocumentReader.js +83 -5
- package/.github/ISSUE_TEMPLATE/config.yml +0 -5
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@ This repository contains the source code of the Document Reader API, and the sam
|
|
|
8
8
|
|
|
9
9
|
## Documentation
|
|
10
10
|
|
|
11
|
-
You can find documentation [here](https://docs.regulaforensics.com/develop/doc-reader-sdk/mobile
|
|
11
|
+
You can find documentation [here](https://docs.regulaforensics.com/develop/doc-reader-sdk/mobile).
|
|
12
12
|
|
|
13
13
|
## License
|
|
14
14
|
|
package/example/config.xml
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
<allow-intent href="mailto:*" />
|
|
17
17
|
<allow-intent href="geo:*" />
|
|
18
18
|
<platform name="android">
|
|
19
|
-
<resource-file src="www/db.dat" target="app/src/main/assets/Regula/db.dat"/>
|
|
19
|
+
<resource-file src="www/db.dat" target="app/src/main/assets/Regula/db.dat" />
|
|
20
20
|
<preference name="android-minSdkVersion" value="23" />
|
|
21
21
|
<preference name="android-targetSdkVersion" value="34" />
|
|
22
22
|
<allow-intent href="market:*" />
|
|
@@ -26,11 +26,13 @@
|
|
|
26
26
|
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
|
|
27
27
|
<uses-permission android:name="android.permission.BLUETOOTH_SCAN" />
|
|
28
28
|
</config-file>
|
|
29
|
+
<preference name="orientation" value="portrait" />
|
|
29
30
|
</platform>
|
|
30
31
|
<platform name="ios">
|
|
31
32
|
<resource-file src="www/db.dat" />
|
|
32
33
|
<allow-intent href="itms:*" />
|
|
33
34
|
<allow-intent href="itms-apps:*" />
|
|
35
|
+
<preference name="orientation" value="portrait" />
|
|
34
36
|
<config-file target="*-Info.plist" parent="NSCameraUsageDescription">
|
|
35
37
|
<string>To use camera</string>
|
|
36
38
|
</config-file>
|
|
@@ -42,26 +44,26 @@
|
|
|
42
44
|
</config-file>
|
|
43
45
|
<config-file target="*-Info.plist" parent="com.apple.developer.nfc.readersession.iso7816.select-identifiers">
|
|
44
46
|
<array>
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
47
|
+
<string>A0000002471001</string>
|
|
48
|
+
<string>E80704007F00070302</string>
|
|
49
|
+
<string>A000000167455349474E</string>
|
|
50
|
+
<string>A0000002480100</string>
|
|
51
|
+
<string>A0000002480200</string>
|
|
52
|
+
<string>A0000002480300</string>
|
|
53
|
+
<string>A00000045645444C2D3031</string>
|
|
54
|
+
</array>
|
|
53
55
|
</config-file>
|
|
54
56
|
<config-file target="*-Debug.plist" parent="com.apple.developer.nfc.readersession.formats">
|
|
55
57
|
<array>
|
|
56
58
|
<string>NDEF</string>
|
|
57
|
-
|
|
59
|
+
<string>TAG</string>
|
|
58
60
|
</array>
|
|
59
61
|
</config-file>
|
|
60
62
|
<config-file target="*-Release.plist" parent="com.apple.developer.nfc.readersession.formats">
|
|
61
63
|
<array>
|
|
62
64
|
<string>NDEF</string>
|
|
63
|
-
|
|
65
|
+
<string>TAG</string>
|
|
64
66
|
</array>
|
|
65
67
|
</config-file>
|
|
66
68
|
</platform>
|
|
67
|
-
</widget>
|
|
69
|
+
</widget>
|
package/example/package.json
CHANGED
|
@@ -13,10 +13,10 @@
|
|
|
13
13
|
"author": "Regula Forensics Inc.",
|
|
14
14
|
"license": "commercial",
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@regulaforensics/cordova-plugin-document-reader-api": "7.
|
|
17
|
-
"@regulaforensics/cordova-plugin-document-reader-core-fullauthrfid": "7.
|
|
18
|
-
"cordova-android": "
|
|
19
|
-
"cordova-ios": "7.
|
|
16
|
+
"@regulaforensics/cordova-plugin-document-reader-api": "7.5.19-rc",
|
|
17
|
+
"@regulaforensics/cordova-plugin-document-reader-core-fullauthrfid": "7.5.15-beta",
|
|
18
|
+
"cordova-android": "13.0.0",
|
|
19
|
+
"cordova-ios": "7.1.1",
|
|
20
20
|
"cordova-plugin-add-swift-support": "2.0.2",
|
|
21
21
|
"cordova-plugin-advanced-http": "3.3.1",
|
|
22
22
|
"cordova-plugin-camera": "7.0.0",
|
package/example/www/js/index.js
CHANGED
|
@@ -238,6 +238,11 @@ var app = {
|
|
|
238
238
|
if (value != null)
|
|
239
239
|
document.getElementById("portraitImage").src = "data:image/png;base64," + value
|
|
240
240
|
}, function (error) { console.log(error) })
|
|
241
|
+
|
|
242
|
+
DocumentReader.graphicFieldImageByTypeSource(results, Enum.eGraphicFieldType.GF_PORTRAIT, Enum.eRPRM_ResultType.RFID_RESULT_TYPE_RFID_IMAGE_DATA, function (value) {
|
|
243
|
+
if (value != null)
|
|
244
|
+
document.getElementById("portraitImage").src = "data:image/png;base64," + value
|
|
245
|
+
}, function (error) { console.log(error) })
|
|
241
246
|
}
|
|
242
247
|
|
|
243
248
|
function clearResults() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@regulaforensics/cordova-plugin-document-reader-api",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.5.19-rc",
|
|
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",
|
|
@@ -11,17 +11,13 @@
|
|
|
11
11
|
},
|
|
12
12
|
"max_body_size": "1000mb",
|
|
13
13
|
"keywords": [
|
|
14
|
-
"cordova",
|
|
15
|
-
"documentreader",
|
|
16
|
-
"reader",
|
|
17
|
-
"scanner",
|
|
18
|
-
"regula"
|
|
14
|
+
"cordova", "documentreader", "reader", "scanner", "regula"
|
|
19
15
|
],
|
|
20
16
|
"author": "RegulaForensics",
|
|
21
17
|
"license": "commercial",
|
|
22
18
|
"repository": {
|
|
23
|
-
|
|
24
|
-
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "https://github.com/regulaforensics/DocumentReader-Cordova-Plugin.git"
|
|
25
21
|
},
|
|
26
22
|
"homepage": "https://mobile.regulaforensics.com",
|
|
27
23
|
"publishConfig": {
|
package/plugin.xml
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
<?xml version='1.0' encoding='utf-8'?>
|
|
2
|
-
<plugin id="cordova-plugin-document-reader-api" version="7.
|
|
3
|
-
xmlns="http://apache.org/cordova/ns/plugins/1.0">
|
|
2
|
+
<plugin id="@regulaforensics/cordova-plugin-document-reader-api" version="7.5.19-rc" xmlns="http://apache.org/cordova/ns/plugins/1.0">
|
|
4
3
|
<name>DocumentReaderApi</name>
|
|
5
4
|
<description>Cordova plugin Document reader api</description>
|
|
6
5
|
<license>commercial</license>
|
|
@@ -15,6 +14,7 @@
|
|
|
15
14
|
<feature name="DocumentReader">
|
|
16
15
|
<param name="ios-package" value="RGLWDocumentReader" />
|
|
17
16
|
</feature>
|
|
17
|
+
<preference name="deployment-target" value="12.0" />
|
|
18
18
|
</config-file>
|
|
19
19
|
<header-file src="src/ios/RGLWDocumentReader.h" />
|
|
20
20
|
<source-file src="src/ios/RGLWDocumentReader.m" />
|
|
@@ -23,16 +23,17 @@
|
|
|
23
23
|
<header-file src="src/ios/RGLWConfig.h" />
|
|
24
24
|
<source-file src="src/ios/RGLWConfig.m" />
|
|
25
25
|
<podspec>
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
<config>
|
|
27
|
+
</config>
|
|
28
28
|
<pods>
|
|
29
|
-
<pod name="
|
|
29
|
+
<pod name="DocumentReaderStage" spec="7.5.4216" />
|
|
30
30
|
</pods>
|
|
31
31
|
</podspec>
|
|
32
32
|
</platform>
|
|
33
33
|
|
|
34
34
|
<platform name="android">
|
|
35
35
|
<config-file parent="/*" target="res/xml/config.xml">
|
|
36
|
+
<preference name="GradlePluginKotlinEnabled" value="true" />
|
|
36
37
|
<feature name="DocumentReader">
|
|
37
38
|
<param name="android-package" value="cordova.plugin.documentreader.DocumentReader" />
|
|
38
39
|
</feature>
|
|
@@ -5,10 +5,13 @@
|
|
|
5
5
|
// Created by Pavel Masiuk on 21.09.2023.
|
|
6
6
|
// Copyright © 2023 Regula. All rights reserved.
|
|
7
7
|
//
|
|
8
|
+
@file:SuppressLint("MissingPermission")
|
|
8
9
|
|
|
9
10
|
package cordova.plugin.documentreader
|
|
10
11
|
|
|
11
|
-
import android.Manifest.permission
|
|
12
|
+
import android.Manifest.permission.ACCESS_FINE_LOCATION
|
|
13
|
+
import android.Manifest.permission.BLUETOOTH_CONNECT
|
|
14
|
+
import android.Manifest.permission.BLUETOOTH_SCAN
|
|
12
15
|
import android.annotation.SuppressLint
|
|
13
16
|
import android.app.Activity
|
|
14
17
|
import android.bluetooth.BluetoothAdapter
|
|
@@ -19,7 +22,6 @@ import android.content.pm.PackageManager.PERMISSION_GRANTED
|
|
|
19
22
|
import android.os.Build
|
|
20
23
|
import android.os.IBinder
|
|
21
24
|
import android.provider.Settings
|
|
22
|
-
import androidx.annotation.RequiresPermission
|
|
23
25
|
import androidx.core.app.ActivityCompat.requestPermissions
|
|
24
26
|
import androidx.core.content.ContextCompat.checkSelfPermission
|
|
25
27
|
import com.regula.documentreader.api.ble.BLEWrapper
|
|
@@ -28,37 +30,103 @@ import com.regula.documentreader.api.ble.RegulaBleService
|
|
|
28
30
|
import com.regula.documentreader.api.internal.permission.BluetoothPermissionHelper.BLE_ACCESS_PERMISSION
|
|
29
31
|
import com.regula.documentreader.api.internal.permission.BluetoothSettingsHelper.isBluetoothEnabled
|
|
30
32
|
import com.regula.documentreader.api.internal.permission.BluetoothSettingsHelper.isLocationServiceEnabled
|
|
33
|
+
import java.util.Timer
|
|
34
|
+
import java.util.TimerTask
|
|
31
35
|
|
|
32
|
-
const val
|
|
33
|
-
|
|
36
|
+
const val SEARCHING_TIMEOUT: Long = 7000
|
|
37
|
+
|
|
38
|
+
const val INTENT_REQUEST_ENABLE_LOCATION = 196
|
|
39
|
+
const val INTENT_REQUEST_ENABLE_BLUETOOTH = 197
|
|
34
40
|
|
|
35
41
|
@SuppressLint("StaticFieldLeak")
|
|
36
|
-
var
|
|
42
|
+
lateinit var bluetooth: BLEWrapper
|
|
43
|
+
lateinit var savedCallbackForPermissionResult: Callback
|
|
44
|
+
var deviceConnected = false
|
|
37
45
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
46
|
+
fun connectBluetoothDevice(callback: Callback) {
|
|
47
|
+
// return if already connected
|
|
48
|
+
if (deviceConnected) return
|
|
49
|
+
|
|
50
|
+
// If some of the bluetooth permissions/settings don't match the requirements,
|
|
51
|
+
// save callback for later and request the permissions/settings.
|
|
52
|
+
// Callback will then be used in onRequestPermissionsResult for permission requests
|
|
53
|
+
// and in onActivityResult for settings change requests.
|
|
54
|
+
if (!isBluetoothSettingsReady(activity)) {
|
|
55
|
+
savedCallbackForPermissionResult = callback
|
|
56
|
+
return
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// set searching timeout
|
|
60
|
+
val timer = object : TimerTask() {
|
|
61
|
+
override fun run() {
|
|
62
|
+
callback.success(false)
|
|
63
|
+
bluetooth.stopDeviceScan()
|
|
64
|
+
bluetooth.disconnect()
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
Timer().schedule(timer, SEARCHING_TIMEOUT)
|
|
68
|
+
|
|
69
|
+
// start searching devices
|
|
70
|
+
val bleIntent = Intent(activity, RegulaBleService::class.java)
|
|
71
|
+
activity.startService(bleIntent)
|
|
72
|
+
activity.bindService(bleIntent, object : ServiceConnection {
|
|
73
|
+
override fun onServiceConnected(name: ComponentName, service: IBinder) {
|
|
74
|
+
bluetooth = (service as RegulaBleService.LocalBinder).service.bleManager
|
|
75
|
+
bluetooth.addCallback(object : BleWrapperCallback() {
|
|
76
|
+
override fun onDeviceReady() {
|
|
77
|
+
timer.cancel()
|
|
78
|
+
bluetooth.removeCallback(this)
|
|
79
|
+
deviceConnected = true
|
|
80
|
+
callback.success(true)
|
|
81
|
+
}
|
|
82
|
+
})
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
override fun onServiceDisconnected(name: ComponentName) {}
|
|
86
|
+
}, 0)
|
|
42
87
|
}
|
|
43
88
|
|
|
44
|
-
fun
|
|
45
|
-
|
|
46
|
-
|
|
89
|
+
fun onRequestPermissionsResult(
|
|
90
|
+
requestCode: Int,
|
|
91
|
+
permissions: Array<out String>,
|
|
92
|
+
grantResults: IntArray
|
|
93
|
+
): Boolean {
|
|
94
|
+
if (requestCode != BLE_ACCESS_PERMISSION || permissions.isEmpty()) return false
|
|
95
|
+
if (grantResults.isEmpty() || grantResults[0] != PERMISSION_GRANTED) {
|
|
96
|
+
savedCallbackForPermissionResult.success(false)
|
|
97
|
+
return true
|
|
98
|
+
}
|
|
99
|
+
connectBluetoothDevice(savedCallbackForPermissionResult)
|
|
100
|
+
return true
|
|
47
101
|
}
|
|
48
102
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
103
|
+
fun onActivityResult(requestCode: Int, rc: Int, @Suppress("UNUSED_PARAMETER") data: Intent?): Boolean {
|
|
104
|
+
var resultCode = rc
|
|
105
|
+
if (requestCode == INTENT_REQUEST_ENABLE_LOCATION)
|
|
106
|
+
resultCode = if (isLocationServiceEnabled(activity)) Activity.RESULT_OK
|
|
107
|
+
else requestCode
|
|
108
|
+
|
|
109
|
+
if (requestCode == INTENT_REQUEST_ENABLE_BLUETOOTH || requestCode == INTENT_REQUEST_ENABLE_LOCATION) {
|
|
110
|
+
if (resultCode == Activity.RESULT_OK)
|
|
111
|
+
connectBluetoothDevice(savedCallbackForPermissionResult)
|
|
112
|
+
else
|
|
113
|
+
savedCallbackForPermissionResult.success(false)
|
|
114
|
+
return true
|
|
55
115
|
}
|
|
116
|
+
return false
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
fun isBluetoothSettingsReady(activity: Activity): Boolean {
|
|
56
120
|
deniedBluetoothPermissions(activity)?.let {
|
|
57
121
|
requestPermissions(activity, it, BLE_ACCESS_PERMISSION)
|
|
58
122
|
return false
|
|
59
123
|
}
|
|
60
124
|
if (!isBluetoothEnabled(activity)) {
|
|
61
|
-
|
|
125
|
+
requestEnableBluetooth(activity)
|
|
126
|
+
return false
|
|
127
|
+
}
|
|
128
|
+
if (!isLocationServiceEnabled(activity)) {
|
|
129
|
+
requestEnableLocationService(activity)
|
|
62
130
|
return false
|
|
63
131
|
}
|
|
64
132
|
return true
|
|
@@ -83,30 +151,12 @@ fun deniedBluetoothPermission(
|
|
|
83
151
|
return arrayOf()
|
|
84
152
|
}
|
|
85
153
|
|
|
86
|
-
fun
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
onReady: () -> Unit
|
|
91
|
-
) {
|
|
92
|
-
val bleIntent = Intent(activity, RegulaBleService::class.java)
|
|
93
|
-
activity.startService(bleIntent)
|
|
94
|
-
|
|
95
|
-
activity.bindService(bleIntent, object : ServiceConnection {
|
|
96
|
-
override fun onServiceConnected(name: ComponentName, service: IBinder) {
|
|
97
|
-
bleManager = (service as RegulaBleService.LocalBinder).service.bleManager
|
|
98
|
-
val isBleManagerConnected = bleManager?.isConnected == true
|
|
99
|
-
onConnected(isBleManagerConnected)
|
|
100
|
-
if (!isBleManagerConnected) {
|
|
101
|
-
bleManager?.addCallback(object : BleWrapperCallback() {
|
|
102
|
-
override fun onDeviceReady() {
|
|
103
|
-
bleManager!!.removeCallback(this)
|
|
104
|
-
onReady()
|
|
105
|
-
}
|
|
106
|
-
})
|
|
107
|
-
}
|
|
108
|
-
}
|
|
154
|
+
fun requestEnableBluetooth(activity: Activity) {
|
|
155
|
+
val enableIntent = Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE)
|
|
156
|
+
activity.startActivityForResult(enableIntent, INTENT_REQUEST_ENABLE_BLUETOOTH)
|
|
157
|
+
}
|
|
109
158
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
159
|
+
fun requestEnableLocationService(activity: Activity) {
|
|
160
|
+
val myIntent = Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS)
|
|
161
|
+
activity.startActivityForResult(myIntent, INTENT_REQUEST_ENABLE_LOCATION)
|
|
162
|
+
}
|
package/src/android/Config.kt
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//
|
|
2
|
-
// Config.
|
|
2
|
+
// Config.kt
|
|
3
3
|
// DocumentReader
|
|
4
4
|
//
|
|
5
5
|
// Created by Pavel Masiuk on 21.09.2023.
|
|
@@ -26,6 +26,7 @@ import com.regula.documentreader.api.params.LivenessParams
|
|
|
26
26
|
import com.regula.documentreader.api.params.ParamsCustomization
|
|
27
27
|
import com.regula.documentreader.api.params.ProcessParam
|
|
28
28
|
import com.regula.documentreader.api.params.RfidScenario
|
|
29
|
+
import com.regula.documentreader.api.params.rfid.dg.DTCDataGroup
|
|
29
30
|
import com.regula.documentreader.api.params.rfid.dg.DataGroups
|
|
30
31
|
import com.regula.documentreader.api.params.rfid.dg.EIDDataGroups
|
|
31
32
|
import com.regula.documentreader.api.params.rfid.dg.EPassportDataGroups
|
|
@@ -129,12 +130,16 @@ fun setProcessParams(processParams: ProcessParam, opts: JSONObject) = opts.forEa
|
|
|
129
130
|
"shouldReturnPackageForReprocess" -> processParams.shouldReturnPackageForReprocess = v as Boolean
|
|
130
131
|
"disablePerforationOCR" -> processParams.disablePerforationOCR = v as Boolean
|
|
131
132
|
"respectImageQuality" -> processParams.respectImageQuality = v as Boolean
|
|
133
|
+
"strictImageQuality" -> processParams.strictImageQuality = v as Boolean
|
|
132
134
|
"splitNames" -> processParams.splitNames = v as Boolean
|
|
133
135
|
"doDetectCan" -> processParams.doDetectCan = v as Boolean
|
|
134
136
|
"useFaceApi" -> processParams.useFaceApi = v as Boolean
|
|
135
137
|
"useAuthenticityCheck" -> processParams.useAuthenticityCheck = v as Boolean
|
|
136
138
|
"checkHologram" -> processParams.checkHologram = v as Boolean
|
|
137
139
|
"generateNumericCodes" -> processParams.generateNumericCodes = v as Boolean
|
|
140
|
+
"strictBarcodeDigitalSignatureCheck" -> processParams.strictBarcodeDigitalSignatureCheck = v as Boolean
|
|
141
|
+
"selectLongestNames" -> processParams.selectLongestNames = v as Boolean
|
|
142
|
+
"generateDTCVC" -> processParams.generateDTCVC = v as Boolean
|
|
138
143
|
"measureSystem" -> processParams.measureSystem = v.toInt()
|
|
139
144
|
"barcodeParserType" -> processParams.barcodeParserType = v.toInt()
|
|
140
145
|
"perspectiveAngle" -> processParams.perspectiveAngle = v.toInt()
|
|
@@ -207,12 +212,16 @@ fun getProcessParams(processParams: ProcessParam) = mapOf(
|
|
|
207
212
|
"shouldReturnPackageForReprocess" to processParams.shouldReturnPackageForReprocess,
|
|
208
213
|
"disablePerforationOCR" to processParams.disablePerforationOCR,
|
|
209
214
|
"respectImageQuality" to processParams.respectImageQuality,
|
|
215
|
+
"strictImageQuality" to processParams.strictImageQuality,
|
|
210
216
|
"splitNames" to processParams.splitNames,
|
|
211
217
|
"doDetectCan" to processParams.doDetectCan,
|
|
212
218
|
"useFaceApi" to processParams.useFaceApi,
|
|
213
219
|
"useAuthenticityCheck" to processParams.useAuthenticityCheck,
|
|
214
220
|
"checkHologram" to processParams.checkHologram,
|
|
215
221
|
"generateNumericCodes" to processParams.generateNumericCodes,
|
|
222
|
+
"strictBarcodeDigitalSignatureCheck" to processParams.strictBarcodeDigitalSignatureCheck,
|
|
223
|
+
"selectLongestNames" to processParams.selectLongestNames,
|
|
224
|
+
"generateDTCVC" to processParams.generateDTCVC,
|
|
216
225
|
"measureSystem" to processParams.measureSystem,
|
|
217
226
|
"barcodeParserType" to processParams.barcodeParserType,
|
|
218
227
|
"perspectiveAngle" to processParams.perspectiveAngle,
|
|
@@ -278,6 +287,7 @@ fun setCustomization(customization: ParamsCustomization, opts: JSONObject, conte
|
|
|
278
287
|
"activityIndicatorColor" -> editor.setActivityIndicatorColor(v.toColor())
|
|
279
288
|
"statusBackgroundColor" -> editor.setStatusBackgroundColor(v.toColor())
|
|
280
289
|
"cameraPreviewBackgroundColor" -> editor.setCameraPreviewBackgroundColor(v.toColor())
|
|
290
|
+
"backgroundMaskColor" -> editor.setBackgroundMaskColor(v.toColor())
|
|
281
291
|
"statusPositionMultiplier" -> editor.setStatusPositionMultiplier(v.toFloat())
|
|
282
292
|
"resultStatusPositionMultiplier" -> editor.setResultStatusPositionMultiplier(v.toFloat())
|
|
283
293
|
"toolbarSize" -> editor.setToolbarSize(v.toFloat())
|
|
@@ -288,6 +298,8 @@ fun setCustomization(customization: ParamsCustomization, opts: JSONObject, conte
|
|
|
288
298
|
"cameraFramePortraitAspectRatio" -> editor.setCameraFramePortraitAspectRatio(v.toFloat())
|
|
289
299
|
"cameraFrameCornerRadius" -> editor.setCameraFrameCornerRadius(v.toFloat())
|
|
290
300
|
"livenessAnimationPositionMultiplier" -> editor.setLivenessAnimationPositionMultiplier(v.toFloat())
|
|
301
|
+
"nextPageAnimationStartDelay" -> editor.setNextPageAnimationStartDelay(v.toFloat())
|
|
302
|
+
"nextPageAnimationEndDelay" -> editor.setNextPageAnimationEndDelay(v.toFloat())
|
|
291
303
|
"multipageAnimationFrontImage" -> editor.setMultipageAnimationFrontImage(v.toDrawable(context))
|
|
292
304
|
"multipageAnimationBackImage" -> editor.setMultipageAnimationBackImage(v.toDrawable(context))
|
|
293
305
|
"borderBackgroundImage" -> editor.setBorderBackgroundImage(v.toDrawable(context))
|
|
@@ -349,6 +361,7 @@ fun getCustomization(customization: ParamsCustomization) = mapOf(
|
|
|
349
361
|
"activityIndicatorColor" to customization.activityIndicatorColor.toLong(),
|
|
350
362
|
"statusBackgroundColor" to customization.statusBackgroundColor.toLong(),
|
|
351
363
|
"cameraPreviewBackgroundColor" to customization.cameraPreviewBackgroundColor.toLong(),
|
|
364
|
+
"backgroundMaskColor" to customization.backgroundMaskColor.toLong(),
|
|
352
365
|
"statusPositionMultiplier" to customization.statusPositionMultiplier,
|
|
353
366
|
"resultStatusPositionMultiplier" to customization.resultStatusPositionMultiplier,
|
|
354
367
|
"backgroundMaskAlpha" to customization.backgroundMaskAlpha,
|
|
@@ -359,6 +372,8 @@ fun getCustomization(customization: ParamsCustomization) = mapOf(
|
|
|
359
372
|
"cameraFramePortraitAspectRatio" to customization.cameraFramePortraitAspectRatio,
|
|
360
373
|
"cameraFrameCornerRadius" to customization.cameraFrameCornerRadius,
|
|
361
374
|
"livenessAnimationPositionMultiplier" to customization.livenessAnimationPositionMultiplier,
|
|
375
|
+
"nextPageAnimationStartDelay" to customization.nextPageAnimationStartDelay,
|
|
376
|
+
"nextPageAnimationEndDelay" to customization.nextPageAnimationEndDelay,
|
|
362
377
|
"multipageAnimationFrontImage" to customization.multipageAnimationFrontImage.toString(),
|
|
363
378
|
"multipageAnimationBackImage" to customization.multipageAnimationBackImage.toString(),
|
|
364
379
|
"borderBackgroundImage" to customization.borderBackgroundImage.toString(),
|
|
@@ -422,6 +437,8 @@ fun setRfidScenario(rfidScenario: RfidScenario, opts: JSONObject) = opts.forEach
|
|
|
422
437
|
"applyAmendments" -> rfidScenario.isApplyAmendments = v as Boolean
|
|
423
438
|
"autoSettings" -> rfidScenario.isAutoSettings = v as Boolean
|
|
424
439
|
"proceedReadingAlways" -> rfidScenario.proceedReadingAlways = v as Boolean
|
|
440
|
+
"readDTC" -> rfidScenario.isReadDTC = v as Boolean
|
|
441
|
+
"mrzStrictCheck" -> rfidScenario.isMrzStrictCheck = v as Boolean
|
|
425
442
|
"signManagementAction" -> rfidScenario.signManagementAction = v.toInt()
|
|
426
443
|
"readingBuffer" -> rfidScenario.readingBuffer = v.toInt()
|
|
427
444
|
"onlineTAToSignDataType" -> rfidScenario.onlineTAToSignDataType = v.toInt()
|
|
@@ -437,9 +454,11 @@ fun setRfidScenario(rfidScenario: RfidScenario, opts: JSONObject) = opts.forEach
|
|
|
437
454
|
"mrz" -> rfidScenario.mrz = v as String
|
|
438
455
|
"eSignPINDefault" -> rfidScenario.seteSignPINDefault(v as String)
|
|
439
456
|
"eSignPINNewValue" -> rfidScenario.seteSignPINNewValue(v as String)
|
|
457
|
+
"cardAccess" -> rfidScenario.cardAccess = v as String
|
|
440
458
|
"ePassportDataGroups" -> setDataGroups(rfidScenario.ePassportDataGroups(), v as JSONObject)
|
|
441
459
|
"eIDDataGroups" -> setDataGroups(rfidScenario.eIDDataGroups(), v as JSONObject)
|
|
442
460
|
"eDLDataGroups" -> setDataGroups(rfidScenario.eDLDataGroups(), v as JSONObject)
|
|
461
|
+
"dtcDataGroups" -> setDataGroups(rfidScenario.DTCDataGroup(), v as JSONObject)
|
|
443
462
|
}
|
|
444
463
|
}
|
|
445
464
|
|
|
@@ -478,6 +497,8 @@ fun getRfidScenario(rfidScenario: RfidScenario) = mapOf(
|
|
|
478
497
|
"applyAmendments" to rfidScenario.isApplyAmendments,
|
|
479
498
|
"autoSettings" to rfidScenario.isAutoSettings,
|
|
480
499
|
"proceedReadingAlways" to rfidScenario.proceedReadingAlways,
|
|
500
|
+
"readDTC" to rfidScenario.isReadDTC,
|
|
501
|
+
"mrzStrictCheck" to rfidScenario.isMrzStrictCheck,
|
|
481
502
|
"signManagementAction" to rfidScenario.signManagementAction,
|
|
482
503
|
"readingBuffer" to rfidScenario.readingBuffer,
|
|
483
504
|
"onlineTAToSignDataType" to rfidScenario.onlineTAToSignDataType,
|
|
@@ -493,9 +514,11 @@ fun getRfidScenario(rfidScenario: RfidScenario) = mapOf(
|
|
|
493
514
|
"mrz" to rfidScenario.mrz,
|
|
494
515
|
"eSignPINDefault" to rfidScenario.geteSignPINDefault(),
|
|
495
516
|
"eSignPINNewValue" to rfidScenario.geteSignPINNewValue(),
|
|
517
|
+
"cardAccess" to rfidScenario.cardAccess,
|
|
496
518
|
"ePassportDataGroups" to getDataGroups(rfidScenario.ePassportDataGroups()),
|
|
497
519
|
"eIDDataGroups" to getDataGroups(rfidScenario.eIDDataGroups()),
|
|
498
|
-
"eDLDataGroups" to getDataGroups(rfidScenario.eDLDataGroups())
|
|
520
|
+
"eDLDataGroups" to getDataGroups(rfidScenario.eDLDataGroups()),
|
|
521
|
+
"dtcDataGroups" to getDataGroups(rfidScenario.DTCDataGroup())
|
|
499
522
|
).toJsonObject()
|
|
500
523
|
|
|
501
524
|
fun setDataGroups(dataGroup: DataGroups, opts: JSONObject) = opts.forEach { k, v ->
|
|
@@ -529,6 +552,15 @@ fun setDataGroups(dataGroup: DataGroups, opts: JSONObject) = opts.forEach { k, v
|
|
|
529
552
|
"DG20" -> dataGroup.isDG20 = value
|
|
530
553
|
"DG21" -> dataGroup.isDG21 = value
|
|
531
554
|
}
|
|
555
|
+
if (dataGroup is DTCDataGroup) when (k) {
|
|
556
|
+
"DG15" -> dataGroup.isDG15 = value
|
|
557
|
+
"DG16" -> dataGroup.isDG16 = value
|
|
558
|
+
"DG17" -> dataGroup.isDG17 = value
|
|
559
|
+
"DG18" -> dataGroup.isDG18 = value
|
|
560
|
+
"DG22" -> dataGroup.isDG22 = value
|
|
561
|
+
"DG23" -> dataGroup.isDG23 = value
|
|
562
|
+
"DG24" -> dataGroup.isDG24 = value
|
|
563
|
+
}
|
|
532
564
|
}
|
|
533
565
|
|
|
534
566
|
fun getDataGroups(dataGroup: DataGroups): JSONObject {
|
|
@@ -561,6 +593,15 @@ fun getDataGroups(dataGroup: DataGroups): JSONObject {
|
|
|
561
593
|
result["DG20"] = dataGroup.isDG20
|
|
562
594
|
result["DG21"] = dataGroup.isDG21
|
|
563
595
|
}
|
|
596
|
+
if (dataGroup is DTCDataGroup) {
|
|
597
|
+
result["DG15"] = dataGroup.isDG15
|
|
598
|
+
result["DG16"] = dataGroup.isDG16
|
|
599
|
+
result["DG17"] = dataGroup.isDG17
|
|
600
|
+
result["DG18"] = dataGroup.isDG18
|
|
601
|
+
result["DG22"] = dataGroup.isDG22
|
|
602
|
+
result["DG23"] = dataGroup.isDG23
|
|
603
|
+
result["DG24"] = dataGroup.isDG24
|
|
604
|
+
}
|
|
564
605
|
return result.toJsonObject()
|
|
565
606
|
}
|
|
566
607
|
|
|
@@ -48,7 +48,18 @@ import org.json.JSONArray
|
|
|
48
48
|
import org.json.JSONObject
|
|
49
49
|
|
|
50
50
|
class DocumentReader : CordovaPlugin() {
|
|
51
|
-
override fun onNewIntent(intent: Intent)
|
|
51
|
+
override fun onNewIntent(intent: Intent) {
|
|
52
|
+
newIntent(intent)
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
override fun onActivityResult(requestCode: Int, resultCode: Int, intent: Intent?) {
|
|
56
|
+
myOnActivityResult(requestCode, resultCode, intent)
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
override fun onRequestPermissionsResult(requestCode: Int, permissions: Array<out String>?, grantResults: IntArray?) {
|
|
60
|
+
myOnRequestPermissionsResult(requestCode, permissions!!, grantResults!!)
|
|
61
|
+
}
|
|
62
|
+
|
|
52
63
|
override fun execute(action: String, args: JSONArray, callbackContext: CallbackContext): Boolean {
|
|
53
64
|
activity = cordova.activity
|
|
54
65
|
exec(args, callbackContext)
|
|
@@ -56,6 +67,12 @@ class DocumentReader : CordovaPlugin() {
|
|
|
56
67
|
}
|
|
57
68
|
}
|
|
58
69
|
|
|
70
|
+
fun myOnActivityResult(requestCode: Int, resultCode: Int, intent: Intent?) {
|
|
71
|
+
onActivityResult(requestCode, resultCode, intent)
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
fun myOnRequestPermissionsResult(requestCode: Int, permissions: Array<out String>?, grantResults: IntArray?) = onRequestPermissionsResult(requestCode, permissions!!, grantResults!!)
|
|
75
|
+
|
|
59
76
|
fun sendEvent(event: String, data: Any? = "") {
|
|
60
77
|
// These events are not working in cordova and ionic because they don't have a method
|
|
61
78
|
// associated with it. Callbacks are set automatically right after init.
|
|
@@ -98,8 +115,6 @@ fun exec(arguments: JSONArray, tempContext: CallbackContext) {
|
|
|
98
115
|
when (action) {
|
|
99
116
|
"getDocumentReaderIsReady" -> getDocumentReaderIsReady(callback)
|
|
100
117
|
"getDocumentReaderStatus" -> getDocumentReaderStatus(callback)
|
|
101
|
-
"isAuthenticatorAvailableForUse" -> isAuthenticatorAvailableForUse(callback)
|
|
102
|
-
"isBlePermissionsGranted" -> isBlePermissionsGranted(callback)
|
|
103
118
|
"getRfidSessionStatus" -> getRfidSessionStatus(callback)
|
|
104
119
|
"setRfidSessionStatus" -> setRfidSessionStatus(callback)
|
|
105
120
|
"getTag" -> getTag(callback)
|
|
@@ -139,11 +154,13 @@ fun exec(arguments: JSONArray, tempContext: CallbackContext) {
|
|
|
139
154
|
"addPKDCertificates" -> addPKDCertificates(callback, args(0))
|
|
140
155
|
"clearPKDCertificates" -> clearPKDCertificates(callback)
|
|
141
156
|
"startNewSession" -> startNewSession(callback)
|
|
142
|
-
"
|
|
157
|
+
"connectBluetoothDevice" -> connectBluetoothDevice(callback)
|
|
143
158
|
"setLocalizationDictionary" -> setLocalizationDictionary(args(0))
|
|
144
159
|
"getLicense" -> getLicense(callback)
|
|
145
160
|
"getAvailableScenarios" -> getAvailableScenarios(callback)
|
|
146
161
|
"getIsRFIDAvailableForUse" -> getIsRFIDAvailableForUse(callback)
|
|
162
|
+
"isAuthenticatorAvailableForUse" -> isAuthenticatorAvailableForUse(callback)
|
|
163
|
+
"isAuthenticatorRFIDAvailableForUse" -> isAuthenticatorRFIDAvailableForUse(callback)
|
|
147
164
|
"getDocReaderVersion" -> getDocReaderVersion(callback)
|
|
148
165
|
"getDocReaderDocumentsDatabase" -> getDocReaderDocumentsDatabase(callback)
|
|
149
166
|
"textFieldValueByType" -> textFieldValueByType(callback, args(0), args(1))
|
|
@@ -164,6 +181,7 @@ fun exec(arguments: JSONArray, tempContext: CallbackContext) {
|
|
|
164
181
|
"containers" -> containers(callback, args(0), args(1))
|
|
165
182
|
"encryptedContainers" -> encryptedContainers(callback, args(0))
|
|
166
183
|
"finalizePackage" -> finalizePackage(callback)
|
|
184
|
+
"endBackendTransaction" -> endBackendTransaction(callback)
|
|
167
185
|
"getTranslation" -> getTranslation(callback, args(0), args(1))
|
|
168
186
|
}
|
|
169
187
|
}
|
|
@@ -193,10 +211,6 @@ const val eventPACertificateCompletion = "pa_certificate_completion"
|
|
|
193
211
|
const val eventTACertificateCompletion = "ta_certificate_completion"
|
|
194
212
|
const val eventTASignatureCompletion = "ta_signature_completion"
|
|
195
213
|
|
|
196
|
-
const val bleOnServiceConnectedEvent = "bleOnServiceConnectedEvent"
|
|
197
|
-
const val bleOnServiceDisconnectedEvent = "bleOnServiceDisconnectedEvent"
|
|
198
|
-
const val bleOnDeviceReadyEvent = "bleOnDeviceReadyEvent"
|
|
199
|
-
|
|
200
214
|
const val eventVideoEncoderCompletion = "video_encoder_completion"
|
|
201
215
|
const val onCustomButtonTappedEvent = "onCustomButtonTappedEvent"
|
|
202
216
|
|
|
@@ -204,10 +218,6 @@ fun getDocumentReaderIsReady(callback: Callback) = callback.success(Instance().i
|
|
|
204
218
|
|
|
205
219
|
fun getDocumentReaderStatus(callback: Callback) = callback.success(Instance().status)
|
|
206
220
|
|
|
207
|
-
fun isAuthenticatorAvailableForUse(callback: Callback) = callback.success(Instance().isAuthenticatorAvailableForUse)
|
|
208
|
-
|
|
209
|
-
fun isBlePermissionsGranted(callback: Callback) = callback.success(isBlePermissionsGranted((activity)))
|
|
210
|
-
|
|
211
221
|
fun getRfidSessionStatus(callback: Callback) = callback.error("getRfidSessionStatus() is an ios-only method")
|
|
212
222
|
|
|
213
223
|
fun setRfidSessionStatus(callback: Callback) = callback.error("setRfidSessionStatus() is an ios-only method")
|
|
@@ -342,13 +352,6 @@ fun startNewSession(callback: Callback) {
|
|
|
342
352
|
callback.success()
|
|
343
353
|
}
|
|
344
354
|
|
|
345
|
-
fun startBluetoothService() = startBluetoothService(
|
|
346
|
-
activity,
|
|
347
|
-
{ sendEvent(bleOnServiceConnectedEvent, it) },
|
|
348
|
-
{ sendEvent(bleOnServiceDisconnectedEvent) },
|
|
349
|
-
{ sendEvent(bleOnDeviceReadyEvent) }
|
|
350
|
-
)
|
|
351
|
-
|
|
352
355
|
fun setLocalizationDictionary(dictionary: JSONObject) {
|
|
353
356
|
localizationCallbacks = LocalizationCallbacks { if (dictionary.has(it)) dictionary.getString(it) else null }
|
|
354
357
|
Instance().setLocalizationCallback(localizationCallbacks!!)
|
|
@@ -365,6 +368,10 @@ fun getAvailableScenarios(callback: Callback) {
|
|
|
365
368
|
|
|
366
369
|
fun getIsRFIDAvailableForUse(callback: Callback) = callback.success(Instance().isRFIDAvailableForUse)
|
|
367
370
|
|
|
371
|
+
fun isAuthenticatorAvailableForUse(callback: Callback) = callback.success(Instance().isAuthenticatorAvailableForUse)
|
|
372
|
+
|
|
373
|
+
fun isAuthenticatorRFIDAvailableForUse(callback: Callback) = callback.success(Instance().isAuthenticatorRFIDAvailableForUse)
|
|
374
|
+
|
|
368
375
|
fun getDocReaderVersion(callback: Callback) = callback.success(generateDocReaderVersion(Instance().version))
|
|
369
376
|
|
|
370
377
|
fun getDocReaderDocumentsDatabase(callback: Callback) = callback.success(Instance().version?.let { generateDocReaderDocumentsDatabase(it.database) })
|
|
@@ -405,6 +412,11 @@ fun encryptedContainers(callback: Callback, raw: String) = callback.success(from
|
|
|
405
412
|
|
|
406
413
|
fun finalizePackage(callback: Callback) = Instance().finalizePackage { action, info, error -> callback.success(generateFinalizePackageCompletion(action, info, error)) }
|
|
407
414
|
|
|
415
|
+
fun endBackendTransaction(callback: Callback) {
|
|
416
|
+
Instance().endBackendTransaction()
|
|
417
|
+
callback.success()
|
|
418
|
+
}
|
|
419
|
+
|
|
408
420
|
fun getTranslation(callback: Callback, className: String, value: Int) = when (className) {
|
|
409
421
|
"RFIDErrorCodes" -> callback.success(eRFID_ErrorCodes.getTranslation(context, value))
|
|
410
422
|
"LDSParsingErrorCodes" -> callback.success(eLDS_ParsingErrorCodes.getTranslation(context, value))
|
|
@@ -485,12 +497,15 @@ var requestType = RfidReaderRequestType(
|
|
|
485
497
|
)
|
|
486
498
|
|
|
487
499
|
@Suppress("DEPRECATION")
|
|
488
|
-
fun newIntent(intent: Intent)
|
|
500
|
+
fun newIntent(intent: Intent): Boolean {
|
|
501
|
+
if (intent.action != NfcAdapter.ACTION_TECH_DISCOVERED) return false
|
|
489
502
|
Instance().readRFID(
|
|
490
503
|
IsoDep.get(intent.getParcelableExtra(NfcAdapter.EXTRA_TAG)),
|
|
491
504
|
rfidReaderCompletion,
|
|
492
505
|
requestType.getRfidReaderRequest()
|
|
493
|
-
)
|
|
506
|
+
)
|
|
507
|
+
return true
|
|
508
|
+
}
|
|
494
509
|
|
|
495
510
|
fun startForegroundDispatch() {
|
|
496
511
|
backgroundRFIDEnabled = true
|