@regulaforensics/cordova-plugin-document-reader-api 8.1.116-nightly → 8.1.120-nightly
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/package.json +2 -2
- package/package.json +1 -1
- package/plugin.xml +2 -2
- package/src/android/BluetoothUtil.kt +15 -18
- package/src/android/JSONConstructor.kt +2 -2
- package/src/android/build.gradle +1 -1
package/example/package.json
CHANGED
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
"author": "Regula Forensics Inc.",
|
|
14
14
|
"license": "commercial",
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@regulaforensics/cordova-plugin-document-reader-api": "8.1.
|
|
17
|
-
"@regulaforensics/cordova-plugin-document-reader-core-fullauthrfid": "8.1.
|
|
16
|
+
"@regulaforensics/cordova-plugin-document-reader-api": "8.1.120-nightly",
|
|
17
|
+
"@regulaforensics/cordova-plugin-document-reader-core-fullauthrfid": "8.1.307-nightly",
|
|
18
18
|
"cordova-android": "13.0.0",
|
|
19
19
|
"cordova-ios": "7.1.1",
|
|
20
20
|
"cordova-plugin-add-swift-support": "2.0.2",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@regulaforensics/cordova-plugin-document-reader-api",
|
|
3
|
-
"version": "8.1.
|
|
3
|
+
"version": "8.1.120-nightly",
|
|
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="@regulaforensics/cordova-plugin-document-reader-api" version="8.1.
|
|
2
|
+
<plugin id="@regulaforensics/cordova-plugin-document-reader-api" version="8.1.120-nightly" xmlns="http://apache.org/cordova/ns/plugins/1.0">
|
|
3
3
|
<name>DocumentReaderApi</name>
|
|
4
4
|
<description>Cordova plugin Document reader api</description>
|
|
5
5
|
<license>commercial</license>
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
<source url="https://github.com/CocoaPods/Specs.git"/>
|
|
28
28
|
</config>
|
|
29
29
|
<pods>
|
|
30
|
-
<pod name="DocumentReaderNightly" spec="8.1.
|
|
30
|
+
<pod name="DocumentReaderNightly" spec="8.1.4609" />
|
|
31
31
|
</pods>
|
|
32
32
|
</podspec>
|
|
33
33
|
</platform>
|
|
@@ -22,6 +22,7 @@ import android.content.pm.PackageManager.PERMISSION_GRANTED
|
|
|
22
22
|
import android.os.Build
|
|
23
23
|
import android.os.IBinder
|
|
24
24
|
import android.provider.Settings
|
|
25
|
+
import android.util.Log
|
|
25
26
|
import androidx.core.content.ContextCompat.checkSelfPermission
|
|
26
27
|
import com.regula.common.ble.BLEWrapper
|
|
27
28
|
import com.regula.common.ble.BleWrapperCallback
|
|
@@ -38,44 +39,40 @@ const val INTENT_REQUEST_ENABLE_LOCATION = 196
|
|
|
38
39
|
const val INTENT_REQUEST_ENABLE_BLUETOOTH = 197
|
|
39
40
|
|
|
40
41
|
@SuppressLint("StaticFieldLeak")
|
|
41
|
-
|
|
42
|
+
var bluetooth: BLEWrapper? = null
|
|
42
43
|
lateinit var savedCallbackForPermissionResult: Callback
|
|
43
|
-
var deviceConnected = false
|
|
44
44
|
|
|
45
45
|
fun connectBluetoothDevice(callback: Callback) {
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
if (bluetooth?.isConnected == true) {
|
|
47
|
+
Log.e("REGULA", "Bluetooth device already connected, returning false")
|
|
48
|
+
callback.success(false)
|
|
49
|
+
return
|
|
50
|
+
}
|
|
48
51
|
|
|
49
|
-
// If some of the bluetooth permissions/settings don't match the requirements,
|
|
50
|
-
// save callback for later and request the permissions/settings.
|
|
51
|
-
// Callback will then be used in onRequestPermissionsResult for permission requests
|
|
52
|
-
// and in onActivityResult for settings change requests.
|
|
53
52
|
if (!isBluetoothSettingsReady(activity)) {
|
|
54
53
|
savedCallbackForPermissionResult = callback
|
|
55
54
|
return
|
|
56
55
|
}
|
|
57
56
|
|
|
58
|
-
|
|
59
|
-
val timer = object : TimerTask() {
|
|
57
|
+
val timeout = object : TimerTask() {
|
|
60
58
|
override fun run() {
|
|
61
59
|
callback.success(false)
|
|
62
|
-
bluetooth
|
|
63
|
-
bluetooth
|
|
60
|
+
bluetooth?.stopDeviceScan()
|
|
61
|
+
bluetooth?.disconnect()
|
|
64
62
|
}
|
|
65
63
|
}
|
|
66
|
-
Timer().schedule(
|
|
64
|
+
Timer().schedule(timeout, SEARCHING_TIMEOUT)
|
|
67
65
|
|
|
68
|
-
// start searching devices
|
|
69
66
|
val bleIntent = Intent(context, RegulaBleService::class.java)
|
|
70
67
|
context.startService(bleIntent)
|
|
71
68
|
context.bindService(bleIntent, object : ServiceConnection {
|
|
72
69
|
override fun onServiceConnected(name: ComponentName, service: IBinder) {
|
|
73
70
|
bluetooth = (service as RegulaBleService.LocalBinder).service.bleManager
|
|
74
|
-
bluetooth.
|
|
71
|
+
if (bluetooth!!.isConnected) callback.success(true)
|
|
72
|
+
else bluetooth!!.addCallback(object : BleWrapperCallback() {
|
|
75
73
|
override fun onDeviceReady() {
|
|
76
|
-
|
|
77
|
-
bluetooth
|
|
78
|
-
deviceConnected = true
|
|
74
|
+
timeout.cancel()
|
|
75
|
+
bluetooth!!.removeCallback(this)
|
|
79
76
|
callback.success(true)
|
|
80
77
|
}
|
|
81
78
|
})
|
|
@@ -250,9 +250,9 @@ fun generateDocReaderConfig(temp: DocReaderConfig?): JSONObject? {
|
|
|
250
250
|
}
|
|
251
251
|
|
|
252
252
|
fun bleDeviceConfigFromJSON(input: JSONObject): BleDeviceConfig {
|
|
253
|
-
var result = BleDeviceConfig(bluetooth)
|
|
253
|
+
var result = BleDeviceConfig(bluetooth!!)
|
|
254
254
|
|
|
255
|
-
if (input.has("customDb")) result = BleDeviceConfig(bluetooth
|
|
255
|
+
if (input.has("customDb")) result = BleDeviceConfig(bluetooth!!, byteArrayFromBase64(input.getString("customDb")))
|
|
256
256
|
if (input.has("licenseUpdate")) result.setLicenseUpdate(input.getBoolean("licenseUpdate"))
|
|
257
257
|
if (input.has("delayedNNLoad")) result.isDelayedNNLoad = input.getBoolean("delayedNNLoad")
|
|
258
258
|
if (input.has("blackList")) result.blackList = input.getJSONObject("blackList")
|
package/src/android/build.gradle
CHANGED