Skip to content

Commit f011513

Browse files
author
Jenkins
committed
9.3.1067
1 parent 2a73cae commit f011513

34 files changed

Lines changed: 1463 additions & 304 deletions

.dart_tool/package_config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"packages": [
44
{
55
"name": "async",
6-
"rootUri": "file:///Users/administratorregula/.pub-cache/hosted/pub.dev/async-2.13.0",
6+
"rootUri": "file:///Users/administratorregula/.pub-cache/hosted/pub.dev/async-2.13.1",
77
"packageUri": "lib/",
88
"languageVersion": "3.4"
99
},

android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ android {
2828
}
2929

3030
dependencies {
31-
implementation('com.regula.documentreader:api:9.2.12486') {
31+
implementation('com.regula.documentreader:api:9.3.12663') {
3232
transitive = true
3333
}
3434

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

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

android/src/main/kotlin/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/kotlin/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/kotlin/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)

android/src/test/kotlin/com/regula/plugin/documentreader/FlutterDocumentReaderApiPlugin.kt

Lines changed: 27 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,9 @@ class FlutterDocumentReaderApiPluginTest {
7676
@Test
7777
fun backendProcessingConfig() = compare("backendProcessingConfig", ::backendProcessingConfigFromJSON, ::generateBackendProcessingConfig)
7878

79+
@Test
80+
fun bsi() = compare("bsi", ::bsiFromJSON, ::generateBsi)
81+
7982
@Test
8083
fun processParams() = compare("processParams", ::processParamFromJSON, ::generateProcessParam)
8184

@@ -99,23 +102,19 @@ class FlutterDocumentReaderApiPluginTest {
99102
// params
100103

101104
@Test
102-
fun customization() {
103-
val expected = readFile("customization")
104-
val omit = listOf(
105-
"helpAnimationImageContentMode",
106-
"multipageAnimationFrontImageContentMode",
107-
"multipageAnimationBackImageContentMode",
108-
"livenessAnimationImageContentMode",
109-
"borderBackgroundImageContentMode",
110-
"statusTextFont",
111-
"resultStatusTextFont",
112-
"multipageButtonTextFont",
113-
"fonts"
114-
)
115-
for (key in omit) expected.remove(key)
116-
val actual = generateCustomization(customizationFromJSON(expected))
117-
compareJSONs("customization", expected, floatToDouble(actual))
118-
}
105+
fun customization() = compare(
106+
"customization", ::customizationFromJSON, ::generateCustomization,
107+
"helpAnimationImageContentMode",
108+
"multipageAnimationFrontImageContentMode",
109+
"multipageAnimationBackImageContentMode",
110+
"livenessAnimationImageContentMode",
111+
"borderBackgroundImageContentMode",
112+
"statusTextFont",
113+
"resultStatusTextFont",
114+
"multipageButtonTextFont",
115+
"fonts",
116+
"contentModes",
117+
)
119118

120119
@Test
121120
fun functionality() = compare(
@@ -267,13 +266,19 @@ class FlutterDocumentReaderApiPluginTest {
267266
fun value() = compare("value", ::documentReaderValueFromJSON, ::generateDocumentReaderValue)
268267

269268
@Test
270-
fun textField() = compare("textField", ::documentReaderTextFieldFromJSON, ::generateDocumentReaderTextField)
269+
fun textField() = compare(
270+
"textField", ::documentReaderTextFieldFromJSON, ::generateDocumentReaderTextField,
271+
"getValue"
272+
)
271273

272274
@Test
273275
fun textSource() = compare("textSource", ::documentReaderTextSourceFromJSON, ::generateDocumentReaderTextSource)
274276

275277
@Test
276-
fun textResult() = compare("textResult", ::documentReaderTextResultFromJSON, ::generateDocumentReaderTextResult)
278+
fun textResult() = compare(
279+
"textResult", ::documentReaderTextResultFromJSON, ::generateDocumentReaderTextResult,
280+
"fields.getValue"
281+
)
277282

278283
// results
279284

@@ -302,7 +307,9 @@ class FlutterDocumentReaderApiPluginTest {
302307
fun transactionInfo() = compare("transactionInfo", ::transactionInfoFromJSON, ::generateTransactionInfo)
303308

304309
@Test
305-
fun results() = compare("results", ::documentReaderResultsFromJSON, ::generateDocumentReaderResults)
310+
fun results() = compare(
311+
"results", ::documentReaderResultsFromJSON, ::generateDocumentReaderResults,
312+
"textResult.fields.getValue")
306313

307314
// rfid
308315

android/src/test/kotlin/com/regula/plugin/documentreader/TestUtils.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ fun readFile(name: String): JSONObject {
1919

2020
fun compareJSONs(name: String, expected: JSONObject, actual: JSONObject) =
2121
try {
22-
JSONAssert.assertEquals(expected, actual, false)
22+
JSONAssert.assertEquals(expected, floatToDouble(actual), true)
2323
} catch (e: Throwable) {
2424
println("\nAndroid test failed: $name")
2525
println(" Expected JSON:\n$expected")
@@ -36,7 +36,8 @@ fun <T> compareSingle(
3636
try {
3737
var expected = readFile(name)
3838
for (key in omit) expected = omitDeep(expected, key.split("."), 0)
39-
val actual = toJson(fromJson(expected))!!
39+
var actual = toJson(fromJson(expected))!!
40+
for (key in omit) actual = omitDeep(actual, key.split("."), 0)
4041
compareJSONs(name, expected, actual)
4142
} catch (_: IOException) {
4243
}

example/ios/Tests/Tests.swift

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,10 @@ class Tests: XCTestCase {
8686
compare(name: "backendProcessingConfig", fromJson: RGLWJSONConstructor.backendProcessingConfig, generate: RGLWJSONConstructor.generate)
8787
}
8888

89+
func test_bsi() {
90+
compare(name: "bsi", fromJson: RGLWJSONConstructor.bsi, generate: RGLWJSONConstructor.generate)
91+
}
92+
8993
func test_processParams() {
9094
compare(name: "processParams", fromJson: RGLWJSONConstructor.processParams, generate: RGLWJSONConstructor.generate,
9195
omit: ["sessionLogFolder",
@@ -131,13 +135,28 @@ class Tests: XCTestCase {
131135
"colors.rfidEnableNfcButtonText",
132136
"colors.rfidEnableNfcDescriptionText",
133137
"colors.rfidEnableNfcTitleText",
138+
"colors.mdlEnableNfcTitleText",
139+
"colors.mdlEnableNfcDescriptionText",
140+
"colors.mdlEnableNfcButtonText",
141+
"colors.mdlEnableNfcButtonBackground",
134142
"fonts.rfidProcessingScreenHintLabel.style",
135143
"fonts.rfidProcessingScreenProgressLabel.style",
136144
"fonts.rfidProcessingScreenResultLabel.style",
145+
"fonts.mdlProcessingScreenHintLabel.style",
146+
"fonts.mdlProcessingScreenProgressLabel.style",
147+
"fonts.mdlProcessingScreenResultLabel.style",
137148
"fonts.rfidEnableNfcTitleText",
138149
"fonts.rfidEnableNfcDescriptionText",
139150
"fonts.rfidEnableNfcButtonText",
140-
"images.rfidEnableNfcImage",])
151+
"fonts.mdlEnableNfcTitleText",
152+
"fonts.mdlEnableNfcDescriptionText",
153+
"fonts.mdlEnableNfcButtonText",
154+
"images.rfidEnableNfcImage",
155+
"images.rfidDisableNfcImage",
156+
"images.mdlEnableNfcImage",
157+
"images.mdlDisableNfcImage",
158+
"matrices",
159+
])
141160
}
142161

143162
func test_functionality() {

example/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ dependencies:
1414
sdk: flutter
1515
flutter_document_reader_api:
1616
path: ../
17-
flutter_document_reader_core_fullauthrfid: 9.2.1727
17+
flutter_document_reader_core_fullauthrfid: 9.3.1980
1818
flutter_document_reader_btdevice: 9.1.42
1919
cupertino_icons: ^1.0.8
2020

0 commit comments

Comments
 (0)