Skip to content

Commit 7ca04b3

Browse files
author
Jenkins
committed
7.3.676
1 parent cbfd579 commit 7ca04b3

15 files changed

Lines changed: 1877 additions & 2966 deletions

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 = '11.0'
1616
s.source_files = "ios/*.{h,m}"
17-
s.dependency 'DocumentReader', '7.2.3545'
17+
s.dependency 'DocumentReader', '7.3.3764'
1818
s.dependency 'React'
1919
end

android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ dependencies {
4141
//noinspection GradleDynamicVersion
4242
implementation 'com.facebook.react:react-native:+'
4343
//noinspection GradleDependency
44-
implementation('com.regula.documentreader:api:7.2.9835') {
44+
implementation('com.regula.documentreader:api:7.3.10030') {
4545
transitive = true
4646
}
4747
}

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import androidx.core.content.ContextCompat
1818
import com.regula.documentreader.api.enums.CustomizationColor
1919
import com.regula.documentreader.api.enums.CustomizationFont
2020
import com.regula.documentreader.api.enums.CustomizationImage
21+
import com.regula.documentreader.api.enums.LogLevel
2122
import com.regula.documentreader.api.params.AuthenticityParams
2223
import com.regula.documentreader.api.params.Functionality
2324
import com.regula.documentreader.api.params.ImageQA
@@ -133,6 +134,7 @@ fun setProcessParams(processParams: ProcessParam, opts: JSONObject) = opts.forEa
133134
"useFaceApi" -> processParams.useFaceApi = v as Boolean
134135
"useAuthenticityCheck" -> processParams.useAuthenticityCheck = v as Boolean
135136
"checkHologram" -> processParams.checkHologram = v as Boolean
137+
"generateNumericCodes" -> processParams.generateNumericCodes = v as Boolean
136138
"measureSystem" -> processParams.measureSystem = v.toInt()
137139
"barcodeParserType" -> processParams.barcodeParserType = v.toInt()
138140
"perspectiveAngle" -> processParams.perspectiveAngle = v.toInt()
@@ -146,6 +148,8 @@ fun setProcessParams(processParams: ProcessParam, opts: JSONObject) = opts.forEa
146148
"imageOutputMaxWidth" -> processParams.imageOutputMaxWidth = v.toInt()
147149
"processAuth" -> processParams.processAuth = v.toInt()
148150
"convertCase" -> processParams.convertCase = v.toInt()
151+
"logLevel" -> processParams.logLevel = LogLevel.valueOf(v.toString())
152+
"mrzDetectMode" -> processParams.mrzDetectMode = v.toInt()
149153
"dateFormat" -> processParams.dateFormat = v as String
150154
"scenario" -> processParams.scenario = v as String
151155
"captureButtonScenario" -> processParams.captureButtonScenario = v as String
@@ -154,6 +158,7 @@ fun setProcessParams(processParams: ProcessParam, opts: JSONObject) = opts.forEa
154158
"timeoutFromFirstDetect" -> processParams.timeoutFromFirstDetect = v.toDouble()
155159
"timeoutFromFirstDocType" -> processParams.timeoutFromFirstDocType = v.toDouble()
156160
"documentAreaMin" -> processParams.documentAreaMin = v.toDouble()
161+
"timeoutLiveness" -> processParams.timeoutLiveness = v.toDouble()
157162
"documentIDList" -> processParams.documentIDList = v.toIntArray()
158163
"fieldTypesFilter" -> processParams.fieldTypesFilter = v.toIntArray()
159164
"resultTypeOutput" -> processParams.resultTypeOutput = v.toIntArray()
@@ -207,6 +212,7 @@ fun getProcessParams(processParams: ProcessParam) = mapOf(
207212
"useFaceApi" to processParams.useFaceApi,
208213
"useAuthenticityCheck" to processParams.useAuthenticityCheck,
209214
"checkHologram" to processParams.checkHologram,
215+
"generateNumericCodes" to processParams.generateNumericCodes,
210216
"measureSystem" to processParams.measureSystem,
211217
"barcodeParserType" to processParams.barcodeParserType,
212218
"perspectiveAngle" to processParams.perspectiveAngle,
@@ -220,6 +226,8 @@ fun getProcessParams(processParams: ProcessParam) = mapOf(
220226
"imageOutputMaxWidth" to processParams.imageOutputMaxWidth,
221227
"processAuth" to processParams.processAuth,
222228
"convertCase" to processParams.convertCase,
229+
"logLevel" to processParams.logLevel?.toString(),
230+
"mrzDetectMode" to processParams.mrzDetectMode,
223231
"dateFormat" to processParams.dateFormat,
224232
"scenario" to processParams.scenario,
225233
"captureButtonScenario" to processParams.captureButtonScenario,
@@ -228,6 +236,7 @@ fun getProcessParams(processParams: ProcessParam) = mapOf(
228236
"timeoutFromFirstDetect" to processParams.timeoutFromFirstDetect,
229237
"timeoutFromFirstDocType" to processParams.timeoutFromFirstDocType,
230238
"documentAreaMin" to processParams.documentAreaMin,
239+
"timeoutLiveness" to processParams.timeoutLiveness,
231240
"documentIDList" to processParams.documentIDList.generate(),
232241
"fieldTypesFilter" to processParams.fieldTypesFilter.generate(),
233242
"documentGroupFilter" to processParams.documentGroupFilter.generate(),
@@ -654,6 +663,7 @@ fun setColors(input: ParamsCustomization.CustomizationEditor, opts: JSONObject)
654663
"rfidProcessingScreenProgressBar" -> input.setColor(CustomizationColor.RFID_PROCESSING_SCREEN_PROGRESS_BAR, value)
655664
"rfidProcessingScreenProgressBarBackground" -> input.setColor(CustomizationColor.RFID_PROCESSING_SCREEN_PROGRESS_BAR_BACKGROUND, value)
656665
"rfidProcessingScreenResultLabelText" -> input.setColor(CustomizationColor.RFID_PROCESSING_SCREEN_RESULT_LABEL_TEXT, value)
666+
"rfidProcessingScreenLoadingBar" -> input.setColor(CustomizationColor.RFID_PROCESSING_SCREEN_LOADING_BAR, value)
657667
}
658668
}
659669

@@ -665,6 +675,7 @@ fun getColors(input: Map<CustomizationColor, Long>) = mapOf(
665675
"rfidProcessingScreenProgressBar" to input[CustomizationColor.RFID_PROCESSING_SCREEN_PROGRESS_BAR],
666676
"rfidProcessingScreenProgressBarBackground" to input[CustomizationColor.RFID_PROCESSING_SCREEN_PROGRESS_BAR_BACKGROUND],
667677
"rfidProcessingScreenResultLabelText" to input[CustomizationColor.RFID_PROCESSING_SCREEN_RESULT_LABEL_TEXT],
678+
"rfidProcessingScreenLoadingBar" to input[CustomizationColor.RFID_PROCESSING_SCREEN_LOADING_BAR],
668679
).toJsonObject()
669680

670681
fun setFonts(input: ParamsCustomization.CustomizationEditor, opts: JSONObject) = opts.forEach { key, value ->

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@
55
// Created by Pavel Masiuk on 21.09.2023.
66
// Copyright © 2023 Regula. All rights reserved.
77
//
8+
@file:SuppressLint("MissingPermission")
89

910
package com.regula.documentreader
1011

12+
import android.annotation.SuppressLint
1113
import android.content.Context
1214
import android.graphics.Bitmap
1315
import android.graphics.Rect
@@ -218,6 +220,7 @@ fun docReaderConfigFromJSON(input: JSONObject): DocReaderConfig {
218220
var result = DocReaderConfig(license!!)
219221

220222
if (input.has("customDb")) result = DocReaderConfig(license, byteArrayFromBase64(input.getString("customDb"))!!)
223+
if (input.has("databasePath")) result = DocReaderConfig(license, input.getString("databasePath"))
221224
if (input.has("licenseUpdate")) result.setLicenseUpdate(input.getBoolean("licenseUpdate"))
222225
if (input.has("delayedNNLoad")) result.isDelayedNNLoad = input.getBoolean("delayedNNLoad")
223226
if (input.has("blackList")) result.blackList = input.getJSONObject("blackList")
@@ -232,6 +235,7 @@ fun generateDocReaderConfig(temp: DocReaderConfig?): JSONObject? {
232235

233236
result.put("license", generateByteArray(input.license))
234237
result.put("customDb", generateByteArray(input.customDb))
238+
result.put("databasePath", input.customDbPath)
235239
result.put("licenseUpdate", input.isLicenseUpdate)
236240
result.put("delayedNNLoad", input.isDelayedNNLoad)
237241
result.put("blackList", input.blackList)

android/src/main/java/com/regula/documentreader/RNRegulaDocumentReaderModule.kt

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ val lifecycle: Lifecycle
101101

102102
fun exec(action: String?, arguments: ReadableArray, successCallback: com.facebook.react.bridge.Callback, errorCallback: com.facebook.react.bridge.Callback) {
103103
args = JSONArray(arguments.toArrayList())
104-
activity = reactContext.currentActivity!!
104+
reactContext.currentActivity?.let { activity = it }
105105
val callback = object : Callback {
106106
override fun success(data: Any?) = successCallback.invoke(data.toSendable())
107107
override fun error(message: String) = errorCallback.invoke(message)
@@ -115,6 +115,10 @@ fun exec(action: String?, arguments: ReadableArray, successCallback: com.faceboo
115115
"setRfidSessionStatus" -> setRfidSessionStatus(callback)
116116
"getTag" -> getTag(callback)
117117
"setTag" -> setTag(argsNullable(0))
118+
"getTenant" -> getTenant(callback)
119+
"setTenant" -> setTenant(argsNullable(0))
120+
"getEnv" -> getEnv(callback)
121+
"setEnv" -> setEnv(argsNullable(0))
118122
"getFunctionality" -> getFunctionality(callback)
119123
"setFunctionality" -> setFunctionality(args(0))
120124
"getProcessParams" -> getProcessParams(callback)
@@ -188,7 +192,6 @@ val context
188192
get() = activity
189193

190194
var backgroundRFIDEnabled = false
191-
var databaseDownloadProgress = 0
192195

193196
const val eventCompletion = "completion"
194197
const val eventDatabaseProgress = "database_progress"
@@ -224,6 +227,14 @@ fun getTag(callback: Callback) = callback.success(Instance().tag)
224227

225228
fun setTag(tag: String?) = tag.let { Instance().tag = it }
226229

230+
fun getTenant(callback: Callback) = callback.success(Instance().tenant)
231+
232+
fun setTenant(tag: String?) = tag.let { Instance().tenant = it }
233+
234+
fun getEnv(callback: Callback) = callback.success(Instance().env)
235+
236+
fun setEnv(tag: String?) = tag.let { Instance().env = it }
237+
227238
fun getFunctionality(callback: Callback) = callback.success(getFunctionality(Instance().functionality()))
228239

229240
fun setFunctionality(functionality: JSONObject) = setFunctionality(Instance().functionality(), functionality)

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,9 +177,11 @@ fun Any?.toDouble() = when (this) {
177177

178178
fun Any?.toColor() = "#" + toLong().toString(16)
179179

180-
fun Any?.toFloat() =
181-
if (this is Double) toFloat()
182-
else this as Float
180+
fun Any?.toFloat() = when (this) {
181+
is Int -> toFloat()
182+
is Double -> toFloat()
183+
else -> this as Float
184+
}
183185

184186
fun Any?.toMatrix() = this?.let {
185187
val matrix = Matrix()

example/App.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ export default class App extends React.Component<IProps, IState> {
214214
}
215215

216216
handleResults(results: DocumentReaderResults) {
217-
if (this.state.doRfid && !isReadingRfid && results.chipPage != 0) {
217+
if (this.state.doRfid && !isReadingRfid && results != null && results.chipPage != 0) {
218218
// this.customRFID()
219219
this.usualRFID()
220220
} else {

0 commit comments

Comments
 (0)