@regulaforensics/cordova-plugin-document-reader-api 9.11.950-rc → 9.11.953-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.
@@ -1,6 +1,6 @@
1
1
  <?xml version='1.0' encoding='utf-8'?>
2
2
  <widget android-packageName="com.regula.dr.fullauthrfid" 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
- <name>DocumentReader</name>
3
+ <name>Document</name>
4
4
  <platform name="android">
5
5
  <resource-file src="www/db.dat" target="app/src/main/assets/Regula/db.dat" />
6
6
  <preference name="orientation" value="portrait" />
@@ -15,7 +15,7 @@
15
15
  </platform>
16
16
  <platform name="ios">
17
17
  <resource-file src="www/db.dat" />
18
- <preference name="deployment-target" value="15.0" />
18
+ <preference name="deployment-target" value="16.0" />
19
19
  <preference name="orientation" value="portrait" />
20
20
  <allow-intent href="itms:*" />
21
21
  <allow-intent href="itms-apps:*" />
@@ -1,6 +1,6 @@
1
1
  {
2
- "name": "documentreader",
3
- "displayName": "DocumentReader",
2
+ "name": "document",
3
+ "displayName": "Document",
4
4
  "version": "1.0.0",
5
5
  "description": "A sample Regula Document Reader application for reading and validation of identification documents.",
6
6
  "main": "index.js",
@@ -13,8 +13,8 @@
13
13
  "author": "Regula Forensics Inc.",
14
14
  "license": "commercial",
15
15
  "dependencies": {
16
- "@regulaforensics/cordova-plugin-document-reader-api": "9.11.950-rc",
17
- "@regulaforensics/cordova-plugin-document-reader-core-fullauthrfid": "9.11.4066-rc",
16
+ "@regulaforensics/cordova-plugin-document-reader-api": "9.11.953-rc",
17
+ "@regulaforensics/cordova-plugin-document-reader-core-fullauthrfid": "9.10.3958",
18
18
  "cordova-android": "15.0.0",
19
19
  "cordova-ios": "8.1.1",
20
20
  "cordova-plugin-camera": "8.0.0",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@regulaforensics/cordova-plugin-document-reader-api",
3
- "version": "9.11.950-rc",
3
+ "version": "9.11.953-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="9.11.950-rc" xmlns="http://apache.org/cordova/ns/plugins/1.0">
2
+ <plugin id="@regulaforensics/cordova-plugin-document-reader-api" version="9.11.953-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>
@@ -15,21 +15,19 @@
15
15
  <param name="ios-package" value="RGLWDocumentReader" />
16
16
  </feature>
17
17
  <preference name="deployment-target" value="16.0" />
18
+ <preference name="SwiftVersion" value="5" />
18
19
  </config-file>
19
- <header-file src="src/ios/RGLWDocumentReader.h" />
20
- <source-file src="src/ios/RGLWDocumentReader.m" />
21
- <header-file src="src/ios/RGLWJSONConstructor.h" />
22
- <source-file src="src/ios/RGLWJSONConstructor.m" />
23
- <header-file src="src/ios/RGLWConfig.h" />
24
- <source-file src="src/ios/RGLWConfig.m" />
25
- <header-file src="src/ios/RGLWMain.h" />
26
- <source-file src="src/ios/RGLWMain.m" />
20
+ <source-file src="src/ios/RGLWDocumentReader.swift" />
21
+ <source-file src="src/ios/Config.swift" />
22
+ <source-file src="src/ios/Decoder.swift" />
23
+ <source-file src="src/ios/Implementation.swift" />
24
+ <source-file src="src/ios/Utils.swift" />
27
25
  <podspec>
28
26
  <config>
29
27
  <source url="https://github.com/regulaforensics/podspecs.git"/>
30
28
  </config>
31
29
  <pods>
32
- <pod name="DocumentReaderStage" spec="9.11.7404" />
30
+ <pod name="DocumentReader" spec="9.10.7402" />
33
31
  </pods>
34
32
  </podspec>
35
33
  </platform>
@@ -10,10 +10,13 @@ import org.apache.cordova.CallbackContext
10
10
  import org.apache.cordova.CordovaPlugin
11
11
  import org.apache.cordova.PluginResult
12
12
  import org.json.JSONArray
13
+ import org.json.JSONObject
13
14
 
14
15
  val eventCallbackIds = mutableMapOf<String, String>()
15
16
  lateinit var callbackContext: CallbackContext
16
17
 
18
+ // Args pass null arguments as nulls, null elements in arrays as nulls,
19
+ // but in maps keys with null values are removed.
17
20
  lateinit var args: JSONArray
18
21
  lateinit var binding: CordovaPlugin
19
22
  val context: Context
@@ -45,9 +48,25 @@ fun sendEvent(event: String, data: Any? = "") {
45
48
  }
46
49
 
47
50
  @Suppress("UNCHECKED_CAST")
48
- fun <T> argsNullable(index: Int): T? = if (args.get(index).toString() != "null") {
49
- args.get(index) as T
50
- } else null
51
+ fun <T> argsNullable(index: Int): T? {
52
+ if (args.isNull(index)) return null
53
+ val value = args.get(index)
54
+ omitNullKeys(value)
55
+ return value as T
56
+ }
57
+
58
+ private fun omitNullKeys(value: Any?) {
59
+ when (value) {
60
+ is JSONObject -> {
61
+ val keys = value.keys()
62
+ while (keys.hasNext()) {
63
+ val key = keys.next()
64
+ if (value.isNull(key)) keys.remove() else omitNullKeys(value.get(key))
65
+ }
66
+ }
67
+ is JSONArray -> for (index in 0 until value.length()) omitNullKeys(value.opt(index))
68
+ }
69
+ }
51
70
 
52
71
  fun requestPermissions(@Suppress("UNUSED_PARAMETER") activity: Activity, permissions: Array<String>, requestCode: Int) = binding.cordova.requestPermissions(binding, requestCode, permissions)
53
72
  fun startActivityForResult(@Suppress("UNUSED_PARAMETER") activity: Activity, intent: Intent, requestCode: Int) = binding.cordova.startActivityForResult(binding, intent, requestCode)
@@ -139,7 +139,7 @@ fun methodCall(method: String, callback: (Any?) -> Unit): Any = when (method) {
139
139
  "finalizePackage" -> finalizePackage(callback)
140
140
  "finalizePackageWithFinalizeConfig" -> finalizePackageWithFinalizeConfig(callback, args(0))
141
141
  "endBackendTransaction" -> endBackendTransaction()
142
- "getTranslation" -> getTranslation(callback, args(0), args(1))
142
+ "getTranslation" -> getTranslation(callback, args(0), (args[1] as Number).toLong().toInt())
143
143
  else -> Unit
144
144
  }
145
145
 
@@ -510,7 +510,7 @@ fun encryptedContainers(
510
510
  raw: String
511
511
  ) = callback(fromRawResults(raw).encryptedContainers)
512
512
 
513
- fun getTranslation(callback: Callback, className: String, value: Int) = when (className) {
513
+ fun getTranslation(callback: Callback, className: String, value: Int) = if (value == -1) callback("Unknown") else when (className) {
514
514
  "RFIDErrorCodes" -> callback(eRFID_ErrorCodes.getTranslation(context, value))
515
515
  "LDSParsingErrorCodes" -> callback(eLDS_ParsingErrorCodes.getTranslation(context, value))
516
516
  "LDSParsingNotificationCodes" -> callback(eLDS_ParsingNotificationCodes.getTranslation(context, value))
@@ -7,7 +7,7 @@ repositories {
7
7
 
8
8
  dependencies {
9
9
  //noinspection GradleDependency
10
- implementation ('com.regula.documentreader:api:9.10.13806'){
10
+ implementation ('com.regula.documentreader:api:9.10.13800'){
11
11
  transitive = true
12
12
  }
13
13
  }