Skip to content

Commit

Permalink
7.3.676
Browse files Browse the repository at this point in the history
  • Loading branch information
Jenkins committed Jul 19, 2024
1 parent cbfd579 commit 7ca04b3
Show file tree
Hide file tree
Showing 15 changed files with 1,877 additions and 2,966 deletions.
2 changes: 1 addition & 1 deletion RNDocumentReaderApi.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ Pod::Spec.new do |s|
s.source = { :http => 'file:' + __dir__ }
s.ios.deployment_target = '11.0'
s.source_files = "ios/*.{h,m}"
s.dependency 'DocumentReader', '7.2.3545'
s.dependency 'DocumentReader', '7.3.3764'
s.dependency 'React'
end
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ dependencies {
//noinspection GradleDynamicVersion
implementation 'com.facebook.react:react-native:+'
//noinspection GradleDependency
implementation('com.regula.documentreader:api:7.2.9835') {
implementation('com.regula.documentreader:api:7.3.10030') {
transitive = true
}
}
Expand Down
11 changes: 11 additions & 0 deletions android/src/main/java/com/regula/documentreader/Config.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import androidx.core.content.ContextCompat
import com.regula.documentreader.api.enums.CustomizationColor
import com.regula.documentreader.api.enums.CustomizationFont
import com.regula.documentreader.api.enums.CustomizationImage
import com.regula.documentreader.api.enums.LogLevel
import com.regula.documentreader.api.params.AuthenticityParams
import com.regula.documentreader.api.params.Functionality
import com.regula.documentreader.api.params.ImageQA
Expand Down Expand Up @@ -133,6 +134,7 @@ fun setProcessParams(processParams: ProcessParam, opts: JSONObject) = opts.forEa
"useFaceApi" -> processParams.useFaceApi = v as Boolean
"useAuthenticityCheck" -> processParams.useAuthenticityCheck = v as Boolean
"checkHologram" -> processParams.checkHologram = v as Boolean
"generateNumericCodes" -> processParams.generateNumericCodes = v as Boolean
"measureSystem" -> processParams.measureSystem = v.toInt()
"barcodeParserType" -> processParams.barcodeParserType = v.toInt()
"perspectiveAngle" -> processParams.perspectiveAngle = v.toInt()
Expand All @@ -146,6 +148,8 @@ fun setProcessParams(processParams: ProcessParam, opts: JSONObject) = opts.forEa
"imageOutputMaxWidth" -> processParams.imageOutputMaxWidth = v.toInt()
"processAuth" -> processParams.processAuth = v.toInt()
"convertCase" -> processParams.convertCase = v.toInt()
"logLevel" -> processParams.logLevel = LogLevel.valueOf(v.toString())
"mrzDetectMode" -> processParams.mrzDetectMode = v.toInt()
"dateFormat" -> processParams.dateFormat = v as String
"scenario" -> processParams.scenario = v as String
"captureButtonScenario" -> processParams.captureButtonScenario = v as String
Expand All @@ -154,6 +158,7 @@ fun setProcessParams(processParams: ProcessParam, opts: JSONObject) = opts.forEa
"timeoutFromFirstDetect" -> processParams.timeoutFromFirstDetect = v.toDouble()
"timeoutFromFirstDocType" -> processParams.timeoutFromFirstDocType = v.toDouble()
"documentAreaMin" -> processParams.documentAreaMin = v.toDouble()
"timeoutLiveness" -> processParams.timeoutLiveness = v.toDouble()
"documentIDList" -> processParams.documentIDList = v.toIntArray()
"fieldTypesFilter" -> processParams.fieldTypesFilter = v.toIntArray()
"resultTypeOutput" -> processParams.resultTypeOutput = v.toIntArray()
Expand Down Expand Up @@ -207,6 +212,7 @@ fun getProcessParams(processParams: ProcessParam) = mapOf(
"useFaceApi" to processParams.useFaceApi,
"useAuthenticityCheck" to processParams.useAuthenticityCheck,
"checkHologram" to processParams.checkHologram,
"generateNumericCodes" to processParams.generateNumericCodes,
"measureSystem" to processParams.measureSystem,
"barcodeParserType" to processParams.barcodeParserType,
"perspectiveAngle" to processParams.perspectiveAngle,
Expand All @@ -220,6 +226,8 @@ fun getProcessParams(processParams: ProcessParam) = mapOf(
"imageOutputMaxWidth" to processParams.imageOutputMaxWidth,
"processAuth" to processParams.processAuth,
"convertCase" to processParams.convertCase,
"logLevel" to processParams.logLevel?.toString(),
"mrzDetectMode" to processParams.mrzDetectMode,
"dateFormat" to processParams.dateFormat,
"scenario" to processParams.scenario,
"captureButtonScenario" to processParams.captureButtonScenario,
Expand All @@ -228,6 +236,7 @@ fun getProcessParams(processParams: ProcessParam) = mapOf(
"timeoutFromFirstDetect" to processParams.timeoutFromFirstDetect,
"timeoutFromFirstDocType" to processParams.timeoutFromFirstDocType,
"documentAreaMin" to processParams.documentAreaMin,
"timeoutLiveness" to processParams.timeoutLiveness,
"documentIDList" to processParams.documentIDList.generate(),
"fieldTypesFilter" to processParams.fieldTypesFilter.generate(),
"documentGroupFilter" to processParams.documentGroupFilter.generate(),
Expand Down Expand Up @@ -654,6 +663,7 @@ fun setColors(input: ParamsCustomization.CustomizationEditor, opts: JSONObject)
"rfidProcessingScreenProgressBar" -> input.setColor(CustomizationColor.RFID_PROCESSING_SCREEN_PROGRESS_BAR, value)
"rfidProcessingScreenProgressBarBackground" -> input.setColor(CustomizationColor.RFID_PROCESSING_SCREEN_PROGRESS_BAR_BACKGROUND, value)
"rfidProcessingScreenResultLabelText" -> input.setColor(CustomizationColor.RFID_PROCESSING_SCREEN_RESULT_LABEL_TEXT, value)
"rfidProcessingScreenLoadingBar" -> input.setColor(CustomizationColor.RFID_PROCESSING_SCREEN_LOADING_BAR, value)
}
}

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

fun setFonts(input: ParamsCustomization.CustomizationEditor, opts: JSONObject) = opts.forEach { key, value ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
// Created by Pavel Masiuk on 21.09.2023.
// Copyright © 2023 Regula. All rights reserved.
//
@file:SuppressLint("MissingPermission")

package com.regula.documentreader

import android.annotation.SuppressLint
import android.content.Context
import android.graphics.Bitmap
import android.graphics.Rect
Expand Down Expand Up @@ -218,6 +220,7 @@ fun docReaderConfigFromJSON(input: JSONObject): DocReaderConfig {
var result = DocReaderConfig(license!!)

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

result.put("license", generateByteArray(input.license))
result.put("customDb", generateByteArray(input.customDb))
result.put("databasePath", input.customDbPath)
result.put("licenseUpdate", input.isLicenseUpdate)
result.put("delayedNNLoad", input.isDelayedNNLoad)
result.put("blackList", input.blackList)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ val lifecycle: Lifecycle

fun exec(action: String?, arguments: ReadableArray, successCallback: com.facebook.react.bridge.Callback, errorCallback: com.facebook.react.bridge.Callback) {
args = JSONArray(arguments.toArrayList())
activity = reactContext.currentActivity!!
reactContext.currentActivity?.let { activity = it }
val callback = object : Callback {
override fun success(data: Any?) = successCallback.invoke(data.toSendable())
override fun error(message: String) = errorCallback.invoke(message)
Expand All @@ -115,6 +115,10 @@ fun exec(action: String?, arguments: ReadableArray, successCallback: com.faceboo
"setRfidSessionStatus" -> setRfidSessionStatus(callback)
"getTag" -> getTag(callback)
"setTag" -> setTag(argsNullable(0))
"getTenant" -> getTenant(callback)
"setTenant" -> setTenant(argsNullable(0))
"getEnv" -> getEnv(callback)
"setEnv" -> setEnv(argsNullable(0))
"getFunctionality" -> getFunctionality(callback)
"setFunctionality" -> setFunctionality(args(0))
"getProcessParams" -> getProcessParams(callback)
Expand Down Expand Up @@ -188,7 +192,6 @@ val context
get() = activity

var backgroundRFIDEnabled = false
var databaseDownloadProgress = 0

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

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

fun getTenant(callback: Callback) = callback.success(Instance().tenant)

fun setTenant(tag: String?) = tag.let { Instance().tenant = it }

fun getEnv(callback: Callback) = callback.success(Instance().env)

fun setEnv(tag: String?) = tag.let { Instance().env = it }

fun getFunctionality(callback: Callback) = callback.success(getFunctionality(Instance().functionality()))

fun setFunctionality(functionality: JSONObject) = setFunctionality(Instance().functionality(), functionality)
Expand Down
8 changes: 5 additions & 3 deletions android/src/main/java/com/regula/documentreader/Utils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,11 @@ fun Any?.toDouble() = when (this) {

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

fun Any?.toFloat() =
if (this is Double) toFloat()
else this as Float
fun Any?.toFloat() = when (this) {
is Int -> toFloat()
is Double -> toFloat()
else -> this as Float
}

fun Any?.toMatrix() = this?.let {
val matrix = Matrix()
Expand Down
2 changes: 1 addition & 1 deletion example/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ export default class App extends React.Component<IProps, IState> {
}

handleResults(results: DocumentReaderResults) {
if (this.state.doRfid && !isReadingRfid && results.chipPage != 0) {
if (this.state.doRfid && !isReadingRfid && results != null && results.chipPage != 0) {
// this.customRFID()
this.usualRFID()
} else {
Expand Down
Loading

0 comments on commit 7ca04b3

Please sign in to comment.