Skip to content

Commit afef1a4

Browse files
author
Jenkins
committed
9.3.495
1 parent 2194a50 commit afef1a4

14 files changed

Lines changed: 1456 additions & 762 deletions

File tree

RNDocumentReaderApi.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ Pod::Spec.new do |s|
1414
s.source = { :http => 'file:' + __dir__ }
1515
s.ios.deployment_target = '13.0'
1616
s.source_files = "ios/*.{h,m}"
17-
s.dependency 'DocumentReader', '9.2.5958'
17+
s.dependency 'DocumentReader', '9.3.6137'
1818
s.dependency 'React'
1919
end

android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ dependencies {
2929
//noinspection GradleDynamicVersion
3030
implementation 'com.facebook.react:react-native:+'
3131
//noinspection GradleDependency
32-
implementation('com.regula.documentreader:api:9.2.12486') {
32+
implementation('com.regula.documentreader:api:9.3.12663') {
3333
transitive = true
3434
}
3535
}

android/src/main/java/com/regula/plugin/documentreader/Config.kt

Lines changed: 157 additions & 39 deletions
Large diffs are not rendered by default.

android/src/main/java/com/regula/plugin/documentreader/JSONConstructor.kt

Lines changed: 36 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import com.regula.documentreader.api.listener.NetworkInterceptorListener
2929
import com.regula.documentreader.api.params.AuthenticityParams
3030
import com.regula.documentreader.api.params.BackendProcessingConfig
3131
import com.regula.documentreader.api.params.BleDeviceConfig
32+
import com.regula.documentreader.api.params.Bsi
3233
import com.regula.documentreader.api.params.DocReaderConfig
3334
import com.regula.documentreader.api.params.FaceApiParams
3435
import com.regula.documentreader.api.params.Functionality
@@ -309,6 +310,7 @@ fun backendProcessingConfigFromJSON(input: JSONObject?) = input?.let {
309310
}
310311
result.rfidServerSideChipVerification = it.getBooleanOrNull("rfidServerSideChipVerification")
311312
result.timeoutConnection = it.getDoubleOrNull("timeoutConnection")
313+
if (it.has("mdlVerification")) result.mdlVerification = it.getBoolean("mdlVerification")
312314
result
313315
}
314316

@@ -321,7 +323,20 @@ fun generateBackendProcessingConfig(input: BackendProcessingConfig?) = input?.le
321323
val httpHeaders = JSONObject()
322324
for ((key, value) in it.httpHeaders!!) httpHeaders.put(key, value)
323325
httpHeaders
324-
}
326+
},
327+
"mdlVerification" to it.mdlVerification,
328+
).toJson()
329+
}
330+
331+
fun bsiFromJSON(input: JSONObject?) = input?.let {
332+
val result = Bsi()
333+
result.generateResult = it.getBooleanOrNull("generateResult")
334+
result
335+
}
336+
337+
fun generateBsi(input: Bsi?) = input?.let {
338+
mapOf(
339+
"generateResult" to it.generateResult,
325340
).toJson()
326341
}
327342

@@ -903,18 +918,18 @@ fun generateCameraSize(width: Int?, height: Int?): JSONObject? {
903918
fun documentReaderDocumentTypeFromJSON(input: JSONObject?) = input?.let {
904919
val result = DocumentReaderDocumentType()
905920

906-
result.pageIndex = it.optInt("pageIndex")
907-
result.documentID = it.optInt("documentID")
908-
result.dType = it.optInt("dType")
909-
result.dFormat = it.optInt("dFormat")
910-
result.dMRZ = it.optBoolean("dMRZ")
911-
result.isDeprecated = it.optBoolean("isDeprecated")
912-
result.name = it.optString("name")
913-
result.ICAOCode = it.optString("ICAOCode")
914-
result.dDescription = it.optString("dDescription")
915-
result.dCountryName = it.optString("dCountryName")
916-
result.dYear = it.optString("dYear")
917-
result.FDSID = it.optJSONArray("FDSID").toIntArray()
921+
result.pageIndex = it.getInt("pageIndex")
922+
result.documentID = it.getInt("documentID")
923+
result.dType = it.getInt("dType")
924+
result.dFormat = it.getInt("dFormat")
925+
result.dMRZ = it.getBoolean("dMRZ")
926+
result.isDeprecated = it.getBoolean("isDeprecated")
927+
result.name = it.getStringOrNull("name")
928+
result.ICAOCode = it.getStringOrNull("ICAOCode")
929+
result.dDescription = it.getStringOrNull("dDescription")
930+
result.dCountryName = it.getStringOrNull("dCountryName")
931+
result.dYear = it.getStringOrNull("dYear")
932+
result.FDSID = it.getJSONArrayOrNull("FDSID").toIntArray()
918933

919934
result
920935
}
@@ -1438,7 +1453,7 @@ fun generateDocumentReaderAuthenticityElement(input: DocumentReaderAuthenticityE
14381453
fun paResourcesIssuerFromJSON(input: JSONObject?) = input?.let {
14391454
val result = PAResourcesIssuer()
14401455
result.data = it.optString("data").toByteArray()
1441-
result.friendlyName = it.optString("friendlyName")
1456+
result.friendlyName = it.getStringOrNull("friendlyName")
14421457
result.attributes = it.optJSONArray("attributes").toArray(::paAttributeFromJSON)
14431458
result
14441459
}
@@ -1718,9 +1733,9 @@ fun generateDocumentReaderRFIDOrigin(input: DocumentReaderRfidOrigin?) = input?.
17181733

17191734
fun documentReaderTextSourceFromJSON(input: JSONObject?) = input?.let {
17201735
val result = DocumentReaderTextSource()
1721-
result.sourceType = it.optInt("sourceType")
1722-
result.source = it.optString("source")
1723-
result.validityStatus = it.optInt("validityStatus")
1736+
result.sourceType = it.getInt("sourceType")
1737+
result.source = it.getStringOrNull("source")
1738+
result.validityStatus = it.getInt("validityStatus")
17241739
result
17251740
}
17261741

@@ -1862,7 +1877,7 @@ fun documentReaderResultsFromJSON(input: JSONObject?) = input?.let {
18621877
result.mrzPosition = it.optJSONArray("mrzPosition").toList(::elementPositionFromJSON)!!
18631878
result.imageQuality = it.optJSONArray("imageQuality").toList(::imageQualityGroupFromJSON)!!
18641879
result.rawResult = it.optString("rawResult")
1865-
result.bsiTr03135Results = it.optString("bsiTr03135Results")
1880+
result.bsiTr03135Results = it.getStringOrNull("bsiTr03135Results")
18661881
result.rfidSessionData = rfidSessionDataFromJSON(it.optJSONObject("rfidSessionData"))
18671882
result.authenticityResult = documentReaderAuthenticityResultFromJSON(it.optJSONObject("authenticityResult"))
18681883
result.barcodeResult = documentReaderBarcodeResultFromJSON(it.optJSONObject("barcodeResult"))
@@ -2111,13 +2126,15 @@ fun finalizeConfigFromJSON(input: JSONObject?) = input?.let {
21112126
if (it.has("rawImages")) result.setRawImages(it.getBoolean("rawImages"))
21122127
if (it.has("video")) result.setVideo(it.getBoolean("video"))
21132128
if (it.has("rfidSession")) result.setRfidSession(it.getBoolean("rfidSession"))
2129+
if (it.has("mdlSession")) result.setMdlSession(it.getBoolean("mdlSession"))
21142130
result.build()
21152131
}
21162132

21172133
fun generateFinalizeConfig(input: FinalizeConfig?) = input?.let {
21182134
mapOf(
21192135
"rawImages" to it.getPrivateProperty("rawImages"),
21202136
"video" to it.getPrivateProperty("video"),
2121-
"rfidSession" to it.getPrivateProperty("rfidSession")
2137+
"rfidSession" to it.getPrivateProperty("rfidSession"),
2138+
"mdlSession" to it.getPrivateProperty("mdlSession"),
21222139
).toJson()
21232140
}

android/src/main/java/com/regula/plugin/documentreader/Main.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ fun methodCall(method: String, callback: (Any?) -> Unit): Any = when (method) {
7373
"initialize" -> initialize(callback, args(0))
7474
"initializeReader" -> initialize(callback, args(0)) // deprecated
7575
"initializeReaderWithBleDeviceConfig" -> initializeReaderWithBleDeviceConfig(callback, args(0)) // deprecated
76-
"deinitialize" -> deinitialize()
76+
"deinitializeReader" -> deinitializeReader()
7777
"prepareDatabase" -> prepareDatabase(callback, args(0))
7878
"removeDatabase" -> removeDatabase(callback)
7979
"runAutoUpdate" -> runAutoUpdate(callback, args(0))
@@ -205,7 +205,7 @@ fun initialize(callback: Callback, config: JSONObject) =
205205
// deprecated
206206
fun initializeReaderWithBleDeviceConfig(callback: Callback, config: JSONObject) = Instance().initializeReader(context, initBleDeviceConfigFromJSON(config), initCompletion(callback))
207207

208-
fun deinitialize() = Instance().deinitializeReader()
208+
fun deinitializeReader() = Instance().deinitializeReader()
209209

210210
fun prepareDatabase(callback: Callback, databaseID: String) = Instance().prepareDatabase(
211211
context,

android/src/main/java/com/regula/plugin/documentreader/Utils.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,11 @@ fun JSONObject.getStringOrNull(name: String): String? {
157157
return null
158158
}
159159

160+
fun JSONObject.getJSONArrayOrNull(name: String): JSONArray? {
161+
if (has(name) && get(name).toString() != "null") return getJSONArray(name)
162+
return null
163+
}
164+
160165
fun <T : Any> KClass<T>.constructor(vararg argTypes: KClass<*>): Constructor<T> {
161166
val types = mutableListOf<Class<*>>()
162167
for (argType in argTypes) types.add(argType.java)

0 commit comments

Comments
 (0)