Skip to content

Commit 2bf1883

Browse files
author
Jenkins
committed
8.4.327
1 parent 45d005f commit 2bf1883

24 files changed

Lines changed: 1322 additions & 1722 deletions

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# Deprecated
2+
3+
Introduced a new unified [NPM package](https://www.npmjs.com/package/@regulaforensics/document-reader) that supports React, Ionic, and Cordova wrappers in a single distribution. The individual packages for each wrapper are now deprecated and will only be supported for a few upcoming releases before being removed in future versions. We’ll provide advance notice prior to their removal. Follow the Migration Guide for detailed steps to transition to the new unified package.
4+
15
# Regula Document Reader SDK for React Native
26

37
Regula Document Reader SDK allows you to read various kinds of identification documents, passports, driving licenses, ID cards, etc. All processing is performed completely _**offline**_ on your device. No any data leaving your device.

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', '8.3.5107'
17+
s.dependency 'DocumentReader', '8.4.5436'
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:8.3.11882') {
32+
implementation('com.regula.documentreader:api:8.4.12046') {
3333
transitive = true
3434
}
3535
}

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

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import android.annotation.SuppressLint
77
import android.app.Activity
88
import android.bluetooth.BluetoothAdapter
99
import android.content.ComponentName
10+
import android.content.Context.BIND_AUTO_CREATE
1011
import android.content.Intent
1112
import android.content.ServiceConnection
1213
import android.content.pm.PackageManager.PERMISSION_GRANTED
@@ -31,16 +32,18 @@ const val INTENT_REQUEST_ENABLE_BLUETOOTH = 197
3132

3233
@SuppressLint("StaticFieldLeak")
3334
var bluetooth: BLEWrapper? = null
35+
lateinit var savedDeviceNameForPermissionResult: String
3436
lateinit var savedCallbackForPermissionResult: Callback
3537

36-
fun connectBluetoothDevice(callback: Callback) {
38+
fun connectBluetoothDevice(deviceName: String, callback: Callback) {
3739
if (bluetooth?.isConnected == true) {
3840
Log.e("REGULA", "Bluetooth device already connected, returning false")
3941
callback(false)
4042
return
4143
}
4244

4345
if (!isBluetoothSettingsReady(activity)) {
46+
savedDeviceNameForPermissionResult = deviceName
4447
savedCallbackForPermissionResult = callback
4548
return
4649
}
@@ -55,6 +58,7 @@ fun connectBluetoothDevice(callback: Callback) {
5558
Timer().schedule(timeout, SEARCHING_TIMEOUT)
5659

5760
val bleIntent = Intent(context, RegulaBleService::class.java)
61+
bleIntent.putExtra(RegulaBleService.DEVICE_NAME, deviceName)
5862
context.startService(bleIntent)
5963
context.bindService(bleIntent, object : ServiceConnection {
6064
override fun onServiceConnected(name: ComponentName, service: IBinder) {
@@ -70,7 +74,7 @@ fun connectBluetoothDevice(callback: Callback) {
7074
}
7175

7276
override fun onServiceDisconnected(name: ComponentName) {}
73-
}, 0)
77+
}, BIND_AUTO_CREATE)
7478
}
7579

7680
fun onRequestPermissionsResult(
@@ -83,7 +87,7 @@ fun onRequestPermissionsResult(
8387
savedCallbackForPermissionResult(false)
8488
return true
8589
}
86-
connectBluetoothDevice(savedCallbackForPermissionResult)
90+
connectBluetoothDevice(savedDeviceNameForPermissionResult, savedCallbackForPermissionResult)
8791
return true
8892
}
8993

@@ -95,7 +99,7 @@ fun onActivityResult(requestCode: Int, rc: Int, @Suppress("UNUSED_PARAMETER") da
9599

96100
if (requestCode == INTENT_REQUEST_ENABLE_BLUETOOTH || requestCode == INTENT_REQUEST_ENABLE_LOCATION) {
97101
if (resultCode == Activity.RESULT_OK)
98-
connectBluetoothDevice(savedCallbackForPermissionResult)
102+
connectBluetoothDevice(savedDeviceNameForPermissionResult, savedCallbackForPermissionResult)
99103
else
100104
savedCallbackForPermissionResult(false)
101105
return true
@@ -126,7 +130,7 @@ fun deniedBluetoothPermissions(): Array<String>? {
126130
result.addAll(deniedBluetoothPermission(BLUETOOTH_CONNECT))
127131
} else
128132
result.addAll(deniedBluetoothPermission(ACCESS_FINE_LOCATION))
129-
return result.let { if (it.size > 0) it.toTypedArray() else null }
133+
return result.let { if (it.isNotEmpty()) it.toTypedArray() else null }
130134
}
131135

132136
fun deniedBluetoothPermission(permission: String): Array<String> {

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

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ fun setFunctionality(config: Functionality, input: JSONObject) = input.forEach {
4747
"recordScanningProcess" -> editor.setDoRecordProcessingVideo(v as Boolean)
4848
"manualMultipageMode" -> editor.setManualMultipageMode(v as Boolean)
4949
"torchTurnedOn" -> editor.setTorchTurnedOn(v as Boolean)
50+
"preventScreenRecording" -> editor.setPreventScreenRecording(v as Boolean)
5051
"showCaptureButtonDelayFromDetect" -> editor.setShowCaptureButtonDelayFromDetect(v.toLong())
5152
"showCaptureButtonDelayFromStart" -> editor.setShowCaptureButtonDelayFromStart(v.toLong())
5253
"orientation" -> editor.setOrientation(v.toInt())
@@ -82,6 +83,7 @@ fun getFunctionality(input: Functionality) = mapOf(
8283
"recordScanningProcess" to input.doRecordProcessingVideo(),
8384
"manualMultipageMode" to input.isManualMultipageMode,
8485
"torchTurnedOn" to input.isTorchTurnedOn,
86+
"preventScreenRecording" to input.doPreventScreenRecording(),
8587
"showCaptureButtonDelayFromDetect" to input.showCaptureButtonDelayFromDetect,
8688
"showCaptureButtonDelayFromStart" to input.showCaptureButtonDelayFromStart,
8789
"orientation" to input.orientation,
@@ -141,6 +143,7 @@ fun setProcessParams(processParams: ProcessParam, opts: JSONObject) = opts.forEa
141143
"generateAlpha2Codes" -> processParams.generateAlpha2Codes = v as Boolean
142144
"disableAuthResolutionFilter" -> processParams.disableAuthResolutionFilter = v as Boolean
143145
"strictSecurityChecks" -> processParams.strictSecurityChecks = v as Boolean
146+
"returnTransliteratedFields" -> processParams.returnTransliteratedFields = v as Boolean
144147
"measureSystem" -> processParams.measureSystem = v.toInt()
145148
"barcodeParserType" -> processParams.barcodeParserType = v.toInt()
146149
"perspectiveAngle" -> processParams.perspectiveAngle = v.toInt()
@@ -227,6 +230,7 @@ fun getProcessParams(processParams: ProcessParam) = mapOf(
227230
"generateAlpha2Codes" to processParams.generateAlpha2Codes,
228231
"disableAuthResolutionFilter" to processParams.disableAuthResolutionFilter,
229232
"strictSecurityChecks" to processParams.strictSecurityChecks,
233+
"returnTransliteratedFields" to processParams.returnTransliteratedFields,
230234
"measureSystem" to processParams.measureSystem,
231235
"barcodeParserType" to processParams.barcodeParserType,
232236
"perspectiveAngle" to processParams.perspectiveAngle,
@@ -752,6 +756,10 @@ fun setColors(input: ParamsCustomization.CustomizationEditor, opts: JSONObject)
752756
"rfidProcessingScreenProgressBarBackground" -> input.setColor(CustomizationColor.RFID_PROCESSING_SCREEN_PROGRESS_BAR_BACKGROUND, value)
753757
"rfidProcessingScreenResultLabelText" -> input.setColor(CustomizationColor.RFID_PROCESSING_SCREEN_RESULT_LABEL_TEXT, value)
754758
"rfidProcessingScreenLoadingBar" -> input.setColor(CustomizationColor.RFID_PROCESSING_SCREEN_LOADING_BAR, value)
759+
"rfidEnableNfcTitleText" -> input.setColor(CustomizationColor.RFID_ENABLE_NFC_TITLE_TEXT, value)
760+
"rfidEnableNfcDescriptionText" -> input.setColor(CustomizationColor.RFID_ENABLE_NFC_DESCRIPTION_TEXT, value)
761+
"rfidEnableNfcButtonText" -> input.setColor(CustomizationColor.RFID_ENABLE_NFC_BUTTON_TEXT, value)
762+
"rfidEnableNfcButtonBackground" -> input.setColor(CustomizationColor.RFID_ENABLE_NFC_BUTTON_BACKGROUND, value)
755763
}
756764
}
757765

@@ -764,30 +772,42 @@ fun getColors(input: Map<CustomizationColor, Long>) = mapOf(
764772
"rfidProcessingScreenProgressBarBackground" to input[CustomizationColor.RFID_PROCESSING_SCREEN_PROGRESS_BAR_BACKGROUND],
765773
"rfidProcessingScreenResultLabelText" to input[CustomizationColor.RFID_PROCESSING_SCREEN_RESULT_LABEL_TEXT],
766774
"rfidProcessingScreenLoadingBar" to input[CustomizationColor.RFID_PROCESSING_SCREEN_LOADING_BAR],
775+
"rfidEnableNfcTitleText" to input[CustomizationColor.RFID_ENABLE_NFC_TITLE_TEXT],
776+
"rfidEnableNfcDescriptionText" to input[CustomizationColor.RFID_ENABLE_NFC_DESCRIPTION_TEXT],
777+
"rfidEnableNfcButtonText" to input[CustomizationColor.RFID_ENABLE_NFC_BUTTON_TEXT],
778+
"rfidEnableNfcButtonBackground" to input[CustomizationColor.RFID_ENABLE_NFC_BUTTON_BACKGROUND],
767779
).toJson()
768780

769781
fun setFonts(input: ParamsCustomization.CustomizationEditor, opts: JSONObject) = opts.forEach { key, value ->
770782
when (key) {
771783
"rfidProcessingScreenHintLabel" -> CustomizationFont.RFID_PROCESSING_SCREEN_HINT_LABEL.setFont(input, value)
772784
"rfidProcessingScreenProgressLabel" -> CustomizationFont.RFID_PROCESSING_SCREEN_PROGRESS_LABEL.setFont(input, value)
773785
"rfidProcessingScreenResultLabel" -> CustomizationFont.RFID_PROCESSING_SCREEN_RESULT_LABEL.setFont(input, value)
786+
"rfidEnableNfcTitleText" -> CustomizationFont.RFID_ENABLE_NFC_TITLE_TEXT.setFont(input, value)
787+
"rfidEnableNfcDescriptionText" -> CustomizationFont.RFID_ENABLE_NFC_DESCRIPTION_TEXT.setFont(input, value)
788+
"rfidEnableNfcButtonText" -> CustomizationFont.RFID_ENABLE_NFC_BUTTON_TEXT.setFont(input, value)
774789
}
775790
}
776791

777792
fun getFonts(fonts: Map<CustomizationFont, Typeface>, sizes: Map<CustomizationFont, Int>) = mapOf(
778793
"rfidProcessingScreenHintLabel" to CustomizationFont.RFID_PROCESSING_SCREEN_HINT_LABEL.getFont(fonts, sizes),
779794
"rfidProcessingScreenProgressLabel" to CustomizationFont.RFID_PROCESSING_SCREEN_PROGRESS_LABEL.getFont(fonts, sizes),
780795
"rfidProcessingScreenResultLabel" to CustomizationFont.RFID_PROCESSING_SCREEN_RESULT_LABEL.getFont(fonts, sizes),
796+
"rfidEnableNfcTitleText" to CustomizationFont.RFID_ENABLE_NFC_TITLE_TEXT.getFont(fonts, sizes),
797+
"rfidEnableNfcDescriptionText" to CustomizationFont.RFID_ENABLE_NFC_DESCRIPTION_TEXT.getFont(fonts, sizes),
798+
"rfidEnableNfcButtonText" to CustomizationFont.RFID_ENABLE_NFC_BUTTON_TEXT.getFont(fonts, sizes),
781799
).toJson()
782800

783801
fun setImages(input: ParamsCustomization.CustomizationEditor, opts: JSONObject) = opts.forEach { key, v ->
784802
when (key) {
785803
"rfidProcessingScreenFailureImage" -> input.setImage(CustomizationImage.RFID_PROCESSING_SCREEN_FAILURE_IMAGE, v.toDrawable())
804+
"rfidEnableNfcImage" -> input.setImage(CustomizationImage.RFID_ENABLE_NFC_IMAGE, v.toDrawable())
786805
}
787806
}
788807

789808
fun getImages(input: Map<CustomizationImage, Drawable>) = mapOf(
790809
"rfidProcessingScreenFailureImage" to (input[CustomizationImage.RFID_PROCESSING_SCREEN_FAILURE_IMAGE] ?: ContextCompat.getDrawable(context, com.regula.documentreader.api.R.drawable.reg_ic_error)).toBase64(),
810+
"rfidEnableNfcImage" to (input[CustomizationImage.RFID_ENABLE_NFC_IMAGE] ?: ContextCompat.getDrawable(context, com.regula.documentreader.api.R.drawable.reg_enable_nfc)).toBase64(),
791811
).toJson()
792812

793813
fun CustomizationFont.getFont(fonts: Map<CustomizationFont, Typeface>, sizes: Map<CustomizationFont, Int>) =

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@ fun initConfigFromJSON(input: JSONObject) = input.let {
192192

193193
if (it.has("licenseUpdate")) result.setLicenseUpdate(it.getBoolean("licenseUpdate"))
194194
if (it.has("delayedNNLoad")) result.isDelayedNNLoad = it.getBoolean("delayedNNLoad")
195+
result.licenseUpdateTimeout = it.getDoubleOrNull("licenseUpdateTimeout")
195196
result.blackList = it.getJSONObjectOrNull("blackList")
196197
result
197198
}
@@ -203,6 +204,7 @@ fun generateInitConfig(input: DocReaderConfig?) = input?.let {
203204
"databasePath" to it.customDbPath,
204205
"licenseUpdate" to it.isLicenseUpdate,
205206
"delayedNNLoad" to it.isDelayedNNLoad,
207+
"licenseUpdateTimeout" to it.licenseUpdateTimeout,
206208
"blackList" to it.blackList
207209
).toJson()
208210
}
@@ -213,6 +215,7 @@ fun initBleDeviceConfigFromJSON(input: JSONObject) = input.let {
213215

214216
if (it.has("licenseUpdate")) result.setLicenseUpdate(it.getBoolean("licenseUpdate"))
215217
if (it.has("delayedNNLoad")) result.isDelayedNNLoad = it.getBoolean("delayedNNLoad")
218+
result.licenseUpdateTimeout = it.getDoubleOrNull("licenseUpdateTimeout")
216219
result.blackList = it.getJSONObjectOrNull("blackList")
217220
result
218221
}

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,11 @@ import org.json.JSONObject
4444
import com.regula.plugin.documentreader.Convert.toBase64
4545
import com.regula.plugin.documentreader.Convert.toByteArray
4646

47-
fun methodCall(method: String, callback: (Any?) -> Unit): Any = when (method) {
47+
fun methodCall(method: String, callback: (Any?) -> Unit): Any? = when (method) {
4848
"getDocumentReaderIsReady" -> getDocumentReaderIsReady(callback)
4949
"getDocumentReaderStatus" -> getDocumentReaderStatus(callback)
5050
"getRfidSessionStatus" -> getRfidSessionStatus(callback)
51-
"setRfidSessionStatus" -> setRfidSessionStatus(argsNullable(0))
51+
"setRfidSessionStatus" -> setRfidSessionStatus()
5252
"getTag" -> getTag(callback)
5353
"setTag" -> setTag(argsNullable(0))
5454
"getTenant" -> getTenant(callback)
@@ -90,7 +90,7 @@ fun methodCall(method: String, callback: (Any?) -> Unit): Any = when (method) {
9090
"addPKDCertificates" -> addPKDCertificates(args(0))
9191
"clearPKDCertificates" -> clearPKDCertificates()
9292
"startNewSession" -> startNewSession()
93-
"connectBluetoothDevice" -> connectBluetoothDevice(callback)
93+
"connectBluetoothDevice" -> connectBluetoothDevice(args(0), callback)
9494
"btDeviceRequestFlashing" -> btDeviceRequestFlashing()
9595
"btDeviceRequestFlashingFullIR" -> btDeviceRequestFlashingFullIR()
9696
"btDeviceRequestTurnOffAll" -> btDeviceRequestTurnOffAll()
@@ -148,7 +148,7 @@ fun getDocumentReaderStatus(callback: Callback) = callback(Instance().status)
148148

149149
fun getRfidSessionStatus(iosOnly: Callback) = iosOnly(null)
150150

151-
fun setRfidSessionStatus(iosOnly: String?) = Unit
151+
fun setRfidSessionStatus() = Unit
152152

153153
fun getTag(callback: Callback) = callback(Instance().tag)
154154

example/App.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react'
2-
import { SafeAreaView, ScrollView, StyleSheet, Text, View, NativeEventEmitter, Platform, TouchableOpacity, Image, Button } from 'react-native'
2+
import { ScrollView, StyleSheet, Text, View, NativeEventEmitter, Platform, TouchableOpacity, Image, Button } from 'react-native'
33
import DocumentReader, { Enum, DocumentReaderCompletion, DocumentReaderScenario, RNRegulaDocumentReader, DocumentReaderResults, DocumentReaderNotification, ScannerConfig, RecognizeConfig, DocReaderConfig, Functionality } from '@regulaforensics/react-native-document-reader-api'
44
import * as RNFS from 'react-native-fs'
55
import RadioGroup, { RadioButtonProps } from 'react-native-radio-buttons-group'
@@ -230,7 +230,7 @@ export default class App extends React.Component<IProps, IState> {
230230

231231
render() {
232232
return (
233-
<SafeAreaView style={styles.container}>
233+
<View style={styles.container}>
234234
{!this.state.isReadingRfidCustomUi && <View style={styles.container}>
235235
<Text style={styles.title}>{this.state.fullName}</Text>
236236

@@ -281,7 +281,7 @@ export default class App extends React.Component<IProps, IState> {
281281
<Text style={{ fontSize: 20 }}>X</Text>
282282
</TouchableOpacity>
283283
</View>}
284-
</SafeAreaView>
284+
</View>
285285
)
286286
}
287287
}
@@ -295,6 +295,7 @@ const styles = StyleSheet.create({
295295
alignItems: 'center',
296296
backgroundColor: '#F5FCFF',
297297
marginBottom: 12,
298+
paddingTop: 15
298299
},
299300
cancelButton: {
300301
position: 'absolute',

example/android/app/build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ react {
4949
//
5050
// The list of flags to pass to the Hermes compiler. By default is "-O", "-output-source-map"
5151
// hermesFlags = ["-O", "-output-source-map"]
52-
52+
5353
/* Autolinking */
5454
autolinkLibrariesWithApp()
5555
}
@@ -63,14 +63,14 @@ def enableProguardInReleaseBuilds = false
6363
* The preferred build flavor of JavaScriptCore (JSC)
6464
*
6565
* For example, to use the international variant, you can use:
66-
* `def jscFlavor = 'org.webkit:android-jsc-intl:+'`
66+
* `def jscFlavor = io.github.react-native-community:jsc-android-intl:2026004.+`
6767
*
6868
* The international variant includes ICU i18n library and necessary data
6969
* allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that
7070
* give correct results when using with locales other than en-US. Note that
7171
* this variant is about 6MiB larger per architecture than default.
7272
*/
73-
def jscFlavor = 'org.webkit:android-jsc:+'
73+
def jscFlavor = 'io.github.react-native-community:jsc-android:2026004.+'
7474

7575
android {
7676
ndkVersion rootProject.ext.ndkVersion

example/android/build.gradle

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ buildscript {
33
buildToolsVersion = "35.0.0"
44
minSdkVersion = 24
55
compileSdkVersion = 35
6-
targetSdkVersion = 34
7-
8-
ndkVersion = "26.1.10909125"
9-
kotlinVersion = "1.9.25"
6+
targetSdkVersion = 35
7+
8+
ndkVersion = "27.1.12297006"
9+
kotlinVersion = "2.0.21"
1010
}
1111
repositories {
1212
google()

0 commit comments

Comments
 (0)