@regulaforensics/cordova-plugin-document-reader-api 8.1.120-nightly → 8.1.121-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.
@@ -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.120-nightly",
17
- "@regulaforensics/cordova-plugin-document-reader-core-fullauthrfid": "8.1.307-nightly",
16
+ "@regulaforensics/cordova-plugin-document-reader-api": "8.1.121-rc",
17
+ "@regulaforensics/cordova-plugin-document-reader-core-fullauthrfid": "8.1.308-rc",
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.120-nightly",
3
+ "version": "8.1.121-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",
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.120-nightly" xmlns="http://apache.org/cordova/ns/plugins/1.0">
2
+ <plugin id="@regulaforensics/cordova-plugin-document-reader-api" version="8.1.121-rc" 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.4609" />
30
+ <pod name="DocumentReaderStage" spec="8.1.4610" />
31
31
  </pods>
32
32
  </podspec>
33
33
  </platform>
@@ -22,7 +22,6 @@ 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
26
25
  import androidx.core.content.ContextCompat.checkSelfPermission
27
26
  import com.regula.common.ble.BLEWrapper
28
27
  import com.regula.common.ble.BleWrapperCallback
@@ -39,40 +38,44 @@ const val INTENT_REQUEST_ENABLE_LOCATION = 196
39
38
  const val INTENT_REQUEST_ENABLE_BLUETOOTH = 197
40
39
 
41
40
  @SuppressLint("StaticFieldLeak")
42
- var bluetooth: BLEWrapper? = null
41
+ lateinit var bluetooth: BLEWrapper
43
42
  lateinit var savedCallbackForPermissionResult: Callback
43
+ var deviceConnected = false
44
44
 
45
45
  fun connectBluetoothDevice(callback: Callback) {
46
- if (bluetooth?.isConnected == true) {
47
- Log.e("REGULA", "Bluetooth device already connected, returning false")
48
- callback.success(false)
49
- return
50
- }
46
+ // return if already connected
47
+ if (deviceConnected) return
51
48
 
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.
52
53
  if (!isBluetoothSettingsReady(activity)) {
53
54
  savedCallbackForPermissionResult = callback
54
55
  return
55
56
  }
56
57
 
57
- val timeout = object : TimerTask() {
58
+ // set searching timeout
59
+ val timer = object : TimerTask() {
58
60
  override fun run() {
59
61
  callback.success(false)
60
- bluetooth?.stopDeviceScan()
61
- bluetooth?.disconnect()
62
+ bluetooth.stopDeviceScan()
63
+ bluetooth.disconnect()
62
64
  }
63
65
  }
64
- Timer().schedule(timeout, SEARCHING_TIMEOUT)
66
+ Timer().schedule(timer, SEARCHING_TIMEOUT)
65
67
 
68
+ // start searching devices
66
69
  val bleIntent = Intent(context, RegulaBleService::class.java)
67
70
  context.startService(bleIntent)
68
71
  context.bindService(bleIntent, object : ServiceConnection {
69
72
  override fun onServiceConnected(name: ComponentName, service: IBinder) {
70
73
  bluetooth = (service as RegulaBleService.LocalBinder).service.bleManager
71
- if (bluetooth!!.isConnected) callback.success(true)
72
- else bluetooth!!.addCallback(object : BleWrapperCallback() {
74
+ bluetooth.addCallback(object : BleWrapperCallback() {
73
75
  override fun onDeviceReady() {
74
- timeout.cancel()
75
- bluetooth!!.removeCallback(this)
76
+ timer.cancel()
77
+ bluetooth.removeCallback(this)
78
+ deviceConnected = true
76
79
  callback.success(true)
77
80
  }
78
81
  })
@@ -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!!, byteArrayFromBase64(input.getString("customDb")))
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")
@@ -8,13 +8,13 @@ android {
8
8
 
9
9
  repositories {
10
10
  maven {
11
- url "https://maven.regulaforensics.com/RegulaDocumentReader/Nightly"
11
+ url "https://maven.regulaforensics.com/RegulaDocumentReader/Stage"
12
12
  }
13
13
  }
14
14
 
15
15
  dependencies {
16
16
  //noinspection GradleDependency
17
- implementation ('com.regula.documentreader:api:8.1.11428'){
17
+ implementation ('com.regula.documentreader:api:8.1.11429'){
18
18
  transitive = true
19
19
  }
20
20
  }
@@ -928,19 +928,17 @@ static NSMutableArray* weakReferencesHolder;
928
928
  +(NSDictionary*)generateImageQuality:(RGLImageQuality*)input {
929
929
  if(input == nil) return nil;
930
930
  NSMutableDictionary* result = [NSMutableDictionary new];
931
-
931
+
932
932
  result[@"type"] = [RGLWConfig generateImageQualityCheckType:input.type];
933
933
  result[@"result"] = @(input.result);
934
934
  result[@"featureType"] = @(input.featureType);
935
935
  if(input.boundRects != nil){
936
936
  NSMutableArray *array = [NSMutableArray new];
937
- for(NSValue* item in input.boundRects) {
938
- id rect = [self generateRect:[item CGRectValue]];
939
- if(rect) [array addObject:rect];
940
- }
937
+ for(NSValue* item in input.boundRects)
938
+ [array addObject:[self generateRect:[item CGRectValue]]];
941
939
  result[@"boundRects"] = array;
942
940
  }
943
-
941
+
944
942
  return result;
945
943
  }
946
944
 
@@ -1909,7 +1907,7 @@ static NSMutableArray* weakReferencesHolder;
1909
1907
  +(RGLTAChallenge*)taChallengeFromJson:(NSDictionary*)input {
1910
1908
  NSMutableDictionary* json = input.mutableCopy;
1911
1909
 
1912
- json[@"#text"] = [input valueForKey:@"data"];
1910
+ json[@"#text"] = [self base64Decode:[input valueForKey:@"data"]];
1913
1911
  json[@"@auxPCD"] = [input valueForKey:@"auxPCD"];
1914
1912
  json[@"@challengePICC"] = [input valueForKey: @"challengePICC"];
1915
1913
  json[@"@hashPK"] = [input valueForKey:@"hashPK"];