@regulaforensics/react-native-document-reader-api 7.6.787-nightly → 8.1.68-nightly
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/RNDocumentReaderApi.podspec +2 -2
- package/android/build.gradle +1 -1
- package/android/src/main/java/com/regula/documentreader/BluetoothUtil.kt +16 -20
- package/android/src/main/java/com/regula/documentreader/Config.kt +40 -23
- package/android/src/main/java/com/regula/documentreader/JSONConstructor.kt +15 -4
- package/android/src/main/java/com/regula/documentreader/RNRegulaDocumentReaderModule.kt +52 -44
- package/example/android/gradle/wrapper/gradle-wrapper.properties +1 -1
- package/example/ios/DocumentReader.xcodeproj/project.pbxproj +4 -4
- package/example/ios/Podfile +2 -0
- package/example/package.json +2 -2
- package/index.d.ts +31 -40
- package/index.js +19 -21
- package/ios/RGLWConfig.h +2 -0
- package/ios/RGLWConfig.m +82 -67
- package/ios/RGLWJSONConstructor.h +7 -2
- package/ios/RGLWJSONConstructor.m +48 -11
- package/package.json +2 -6
- package/.github/ISSUE_TEMPLATE/config.yml +0 -5
|
@@ -12,8 +12,8 @@ Pod::Spec.new do |s|
|
|
|
12
12
|
s.homepage = 'https://regulaforensics.com'
|
|
13
13
|
|
|
14
14
|
s.source = { :http => 'file:' + __dir__ }
|
|
15
|
-
s.ios.deployment_target = '
|
|
15
|
+
s.ios.deployment_target = '13.0'
|
|
16
16
|
s.source_files = "ios/*.{h,m}"
|
|
17
|
-
s.dependency 'DocumentReaderNightly', '
|
|
17
|
+
s.dependency 'DocumentReaderNightly', '8.1.4473'
|
|
18
18
|
s.dependency 'React'
|
|
19
19
|
end
|
package/android/build.gradle
CHANGED
|
@@ -41,7 +41,7 @@ dependencies {
|
|
|
41
41
|
//noinspection GradleDynamicVersion
|
|
42
42
|
implementation 'com.facebook.react:react-native:+'
|
|
43
43
|
//noinspection GradleDependency
|
|
44
|
-
implementation('com.regula.documentreader:api:
|
|
44
|
+
implementation('com.regula.documentreader:api:8.1.11283') {
|
|
45
45
|
transitive = true
|
|
46
46
|
}
|
|
47
47
|
}
|
|
@@ -22,11 +22,10 @@ import android.content.pm.PackageManager.PERMISSION_GRANTED
|
|
|
22
22
|
import android.os.Build
|
|
23
23
|
import android.os.IBinder
|
|
24
24
|
import android.provider.Settings
|
|
25
|
-
import androidx.core.app.ActivityCompat.requestPermissions
|
|
26
25
|
import androidx.core.content.ContextCompat.checkSelfPermission
|
|
27
|
-
import com.regula.
|
|
28
|
-
import com.regula.
|
|
29
|
-
import com.regula.
|
|
26
|
+
import com.regula.common.ble.BLEWrapper
|
|
27
|
+
import com.regula.common.ble.BleWrapperCallback
|
|
28
|
+
import com.regula.common.ble.RegulaBleService
|
|
30
29
|
import com.regula.documentreader.api.internal.permission.BluetoothPermissionHelper.BLE_ACCESS_PERMISSION
|
|
31
30
|
import com.regula.documentreader.api.internal.permission.BluetoothSettingsHelper.isBluetoothEnabled
|
|
32
31
|
import com.regula.documentreader.api.internal.permission.BluetoothSettingsHelper.isLocationServiceEnabled
|
|
@@ -67,9 +66,9 @@ fun connectBluetoothDevice(callback: Callback) {
|
|
|
67
66
|
Timer().schedule(timer, SEARCHING_TIMEOUT)
|
|
68
67
|
|
|
69
68
|
// start searching devices
|
|
70
|
-
val bleIntent = Intent(
|
|
71
|
-
|
|
72
|
-
|
|
69
|
+
val bleIntent = Intent(context, RegulaBleService::class.java)
|
|
70
|
+
context.startService(bleIntent)
|
|
71
|
+
context.bindService(bleIntent, object : ServiceConnection {
|
|
73
72
|
override fun onServiceConnected(name: ComponentName, service: IBinder) {
|
|
74
73
|
bluetooth = (service as RegulaBleService.LocalBinder).service.bleManager
|
|
75
74
|
bluetooth.addCallback(object : BleWrapperCallback() {
|
|
@@ -88,7 +87,7 @@ fun connectBluetoothDevice(callback: Callback) {
|
|
|
88
87
|
|
|
89
88
|
fun onRequestPermissionsResult(
|
|
90
89
|
requestCode: Int,
|
|
91
|
-
permissions: Array<
|
|
90
|
+
permissions: Array<String>,
|
|
92
91
|
grantResults: IntArray
|
|
93
92
|
): Boolean {
|
|
94
93
|
if (requestCode != BLE_ACCESS_PERMISSION || permissions.isEmpty()) return false
|
|
@@ -117,7 +116,7 @@ fun onActivityResult(requestCode: Int, rc: Int, @Suppress("UNUSED_PARAMETER") da
|
|
|
117
116
|
}
|
|
118
117
|
|
|
119
118
|
fun isBluetoothSettingsReady(activity: Activity): Boolean {
|
|
120
|
-
deniedBluetoothPermissions(
|
|
119
|
+
deniedBluetoothPermissions()?.let {
|
|
121
120
|
requestPermissions(activity, it, BLE_ACCESS_PERMISSION)
|
|
122
121
|
return false
|
|
123
122
|
}
|
|
@@ -132,31 +131,28 @@ fun isBluetoothSettingsReady(activity: Activity): Boolean {
|
|
|
132
131
|
return true
|
|
133
132
|
}
|
|
134
133
|
|
|
135
|
-
fun deniedBluetoothPermissions(
|
|
134
|
+
fun deniedBluetoothPermissions(): Array<String>? {
|
|
136
135
|
val result = mutableListOf<String>()
|
|
137
136
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
|
|
138
|
-
result.addAll(deniedBluetoothPermission(
|
|
139
|
-
result.addAll(deniedBluetoothPermission(
|
|
137
|
+
result.addAll(deniedBluetoothPermission(BLUETOOTH_SCAN))
|
|
138
|
+
result.addAll(deniedBluetoothPermission(BLUETOOTH_CONNECT))
|
|
140
139
|
} else
|
|
141
|
-
result.addAll(deniedBluetoothPermission(
|
|
140
|
+
result.addAll(deniedBluetoothPermission(ACCESS_FINE_LOCATION))
|
|
142
141
|
return result.let { if (it.size > 0) it.toTypedArray() else null }
|
|
143
142
|
}
|
|
144
143
|
|
|
145
|
-
fun deniedBluetoothPermission(
|
|
146
|
-
|
|
147
|
-
permission: String
|
|
148
|
-
): Array<String> {
|
|
149
|
-
if (checkSelfPermission(activity, permission) != PERMISSION_GRANTED)
|
|
144
|
+
fun deniedBluetoothPermission(permission: String): Array<String> {
|
|
145
|
+
if (checkSelfPermission(context, permission) != PERMISSION_GRANTED)
|
|
150
146
|
return arrayOf(permission)
|
|
151
147
|
return arrayOf()
|
|
152
148
|
}
|
|
153
149
|
|
|
154
150
|
fun requestEnableBluetooth(activity: Activity) {
|
|
155
151
|
val enableIntent = Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE)
|
|
156
|
-
|
|
152
|
+
startActivityForResult(activity, enableIntent, INTENT_REQUEST_ENABLE_BLUETOOTH)
|
|
157
153
|
}
|
|
158
154
|
|
|
159
155
|
fun requestEnableLocationService(activity: Activity) {
|
|
160
156
|
val myIntent = Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS)
|
|
161
|
-
|
|
157
|
+
startActivityForResult(activity, myIntent, INTENT_REQUEST_ENABLE_LOCATION)
|
|
162
158
|
}
|
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
// Copyright © 2023 Regula. All rights reserved.
|
|
7
7
|
//
|
|
8
8
|
|
|
9
|
+
@file:Suppress("EnumValuesSoftDeprecate")
|
|
10
|
+
|
|
9
11
|
package com.regula.documentreader
|
|
10
12
|
|
|
11
13
|
import android.content.Context
|
|
@@ -53,6 +55,7 @@ fun setFunctionality(functionality: Functionality, opts: JSONObject) = opts.forE
|
|
|
53
55
|
"isCameraTorchCheckDisabled" -> editor.setIsCameraTorchCheckDisabled(v as Boolean)
|
|
54
56
|
"recordScanningProcess" -> editor.setDoRecordProcessingVideo(v as Boolean)
|
|
55
57
|
"manualMultipageMode" -> editor.setManualMultipageMode(v as Boolean)
|
|
58
|
+
"torchTurnedOn" -> editor.setTorchTurnedOn(v as Boolean)
|
|
56
59
|
"showCaptureButtonDelayFromDetect" -> editor.setShowCaptureButtonDelayFromDetect(v.toLong())
|
|
57
60
|
"showCaptureButtonDelayFromStart" -> editor.setShowCaptureButtonDelayFromStart(v.toLong())
|
|
58
61
|
"orientation" -> editor.setOrientation(v.toInt())
|
|
@@ -86,6 +89,7 @@ fun getFunctionality(functionality: Functionality) = mapOf(
|
|
|
86
89
|
"isCameraTorchCheckDisabled" to functionality.isCameraTorchCheckDisabled,
|
|
87
90
|
"recordScanningProcess" to functionality.doRecordProcessingVideo(),
|
|
88
91
|
"manualMultipageMode" to functionality.isManualMultipageMode,
|
|
92
|
+
"torchTurnedOn" to functionality.isTorchTurnedOn,
|
|
89
93
|
"showCaptureButtonDelayFromDetect" to functionality.showCaptureButtonDelayFromDetect,
|
|
90
94
|
"showCaptureButtonDelayFromStart" to functionality.showCaptureButtonDelayFromStart,
|
|
91
95
|
"orientation" to functionality.orientation,
|
|
@@ -140,6 +144,7 @@ fun setProcessParams(processParams: ProcessParam, opts: JSONObject) = opts.forEa
|
|
|
140
144
|
"strictBarcodeDigitalSignatureCheck" -> processParams.strictBarcodeDigitalSignatureCheck = v as Boolean
|
|
141
145
|
"selectLongestNames" -> processParams.selectLongestNames = v as Boolean
|
|
142
146
|
"generateDTCVC" -> processParams.generateDTCVC = v as Boolean
|
|
147
|
+
"strictDLCategoryExpiry" -> processParams.strictDLCategoryExpiry = v as Boolean
|
|
143
148
|
"measureSystem" -> processParams.measureSystem = v.toInt()
|
|
144
149
|
"barcodeParserType" -> processParams.barcodeParserType = v.toInt()
|
|
145
150
|
"perspectiveAngle" -> processParams.perspectiveAngle = v.toInt()
|
|
@@ -158,7 +163,6 @@ fun setProcessParams(processParams: ProcessParam, opts: JSONObject) = opts.forEa
|
|
|
158
163
|
"dateFormat" -> processParams.dateFormat = v as String
|
|
159
164
|
"scenario" -> processParams.scenario = v as String
|
|
160
165
|
"captureButtonScenario" -> processParams.captureButtonScenario = v as String
|
|
161
|
-
"sessionLogFolder" -> processParams.sessionLogFolder = v as String
|
|
162
166
|
"timeout" -> processParams.timeout = v.toDouble()
|
|
163
167
|
"timeoutFromFirstDetect" -> processParams.timeoutFromFirstDetect = v.toDouble()
|
|
164
168
|
"timeoutFromFirstDocType" -> processParams.timeoutFromFirstDocType = v.toDouble()
|
|
@@ -222,6 +226,7 @@ fun getProcessParams(processParams: ProcessParam) = mapOf(
|
|
|
222
226
|
"strictBarcodeDigitalSignatureCheck" to processParams.strictBarcodeDigitalSignatureCheck,
|
|
223
227
|
"selectLongestNames" to processParams.selectLongestNames,
|
|
224
228
|
"generateDTCVC" to processParams.generateDTCVC,
|
|
229
|
+
"strictDLCategoryExpiry" to processParams.strictDLCategoryExpiry,
|
|
225
230
|
"measureSystem" to processParams.measureSystem,
|
|
226
231
|
"barcodeParserType" to processParams.barcodeParserType,
|
|
227
232
|
"perspectiveAngle" to processParams.perspectiveAngle,
|
|
@@ -240,7 +245,6 @@ fun getProcessParams(processParams: ProcessParam) = mapOf(
|
|
|
240
245
|
"dateFormat" to processParams.dateFormat,
|
|
241
246
|
"scenario" to processParams.scenario,
|
|
242
247
|
"captureButtonScenario" to processParams.captureButtonScenario,
|
|
243
|
-
"sessionLogFolder" to processParams.sessionLogFolder,
|
|
244
248
|
"timeout" to processParams.timeout,
|
|
245
249
|
"timeoutFromFirstDetect" to processParams.timeoutFromFirstDetect,
|
|
246
250
|
"timeoutFromFirstDocType" to processParams.timeoutFromFirstDocType,
|
|
@@ -439,6 +443,8 @@ fun setRfidScenario(rfidScenario: RfidScenario, opts: JSONObject) = opts.forEach
|
|
|
439
443
|
"proceedReadingAlways" -> rfidScenario.proceedReadingAlways = v as Boolean
|
|
440
444
|
"readDTC" -> rfidScenario.isReadDTC = v as Boolean
|
|
441
445
|
"mrzStrictCheck" -> rfidScenario.isMrzStrictCheck = v as Boolean
|
|
446
|
+
"loadCRLFromRemote" -> rfidScenario.isLoadCRLFromRemote = v as Boolean
|
|
447
|
+
"independentSODStatus" -> rfidScenario.isIndependentSODStatus = v as Boolean
|
|
442
448
|
"signManagementAction" -> rfidScenario.signManagementAction = v.toInt()
|
|
443
449
|
"readingBuffer" -> rfidScenario.readingBuffer = v.toInt()
|
|
444
450
|
"onlineTAToSignDataType" -> rfidScenario.onlineTAToSignDataType = v.toInt()
|
|
@@ -458,7 +464,7 @@ fun setRfidScenario(rfidScenario: RfidScenario, opts: JSONObject) = opts.forEach
|
|
|
458
464
|
"ePassportDataGroups" -> setDataGroups(rfidScenario.ePassportDataGroups(), v as JSONObject)
|
|
459
465
|
"eIDDataGroups" -> setDataGroups(rfidScenario.eIDDataGroups(), v as JSONObject)
|
|
460
466
|
"eDLDataGroups" -> setDataGroups(rfidScenario.eDLDataGroups(), v as JSONObject)
|
|
461
|
-
"dtcDataGroups" ->
|
|
467
|
+
"dtcDataGroups" -> setDTCDataGroup(rfidScenario.DTCDataGroup(), v as JSONObject)
|
|
462
468
|
}
|
|
463
469
|
}
|
|
464
470
|
|
|
@@ -499,6 +505,8 @@ fun getRfidScenario(rfidScenario: RfidScenario) = mapOf(
|
|
|
499
505
|
"proceedReadingAlways" to rfidScenario.proceedReadingAlways,
|
|
500
506
|
"readDTC" to rfidScenario.isReadDTC,
|
|
501
507
|
"mrzStrictCheck" to rfidScenario.isMrzStrictCheck,
|
|
508
|
+
"loadCRLFromRemote" to rfidScenario.isLoadCRLFromRemote,
|
|
509
|
+
"independentSODStatus" to rfidScenario.isIndependentSODStatus,
|
|
502
510
|
"signManagementAction" to rfidScenario.signManagementAction,
|
|
503
511
|
"readingBuffer" to rfidScenario.readingBuffer,
|
|
504
512
|
"onlineTAToSignDataType" to rfidScenario.onlineTAToSignDataType,
|
|
@@ -518,7 +526,7 @@ fun getRfidScenario(rfidScenario: RfidScenario) = mapOf(
|
|
|
518
526
|
"ePassportDataGroups" to getDataGroups(rfidScenario.ePassportDataGroups()),
|
|
519
527
|
"eIDDataGroups" to getDataGroups(rfidScenario.eIDDataGroups()),
|
|
520
528
|
"eDLDataGroups" to getDataGroups(rfidScenario.eDLDataGroups()),
|
|
521
|
-
"dtcDataGroups" to
|
|
529
|
+
"dtcDataGroups" to getDTCDataGroup(rfidScenario.DTCDataGroup())
|
|
522
530
|
).toJsonObject()
|
|
523
531
|
|
|
524
532
|
fun setDataGroups(dataGroup: DataGroups, opts: JSONObject) = opts.forEach { k, v ->
|
|
@@ -552,15 +560,6 @@ fun setDataGroups(dataGroup: DataGroups, opts: JSONObject) = opts.forEach { k, v
|
|
|
552
560
|
"DG20" -> dataGroup.isDG20 = value
|
|
553
561
|
"DG21" -> dataGroup.isDG21 = value
|
|
554
562
|
}
|
|
555
|
-
if (dataGroup is DTCDataGroup) when (k) {
|
|
556
|
-
"DG15" -> dataGroup.isDG15 = value
|
|
557
|
-
"DG16" -> dataGroup.isDG16 = value
|
|
558
|
-
"DG17" -> dataGroup.isDG17 = value
|
|
559
|
-
"DG18" -> dataGroup.isDG18 = value
|
|
560
|
-
"DG22" -> dataGroup.isDG22 = value
|
|
561
|
-
"DG23" -> dataGroup.isDG23 = value
|
|
562
|
-
"DG24" -> dataGroup.isDG24 = value
|
|
563
|
-
}
|
|
564
563
|
}
|
|
565
564
|
|
|
566
565
|
fun getDataGroups(dataGroup: DataGroups): JSONObject {
|
|
@@ -593,18 +592,28 @@ fun getDataGroups(dataGroup: DataGroups): JSONObject {
|
|
|
593
592
|
result["DG20"] = dataGroup.isDG20
|
|
594
593
|
result["DG21"] = dataGroup.isDG21
|
|
595
594
|
}
|
|
596
|
-
if (dataGroup is DTCDataGroup) {
|
|
597
|
-
result["DG15"] = dataGroup.isDG15
|
|
598
|
-
result["DG16"] = dataGroup.isDG16
|
|
599
|
-
result["DG17"] = dataGroup.isDG17
|
|
600
|
-
result["DG18"] = dataGroup.isDG18
|
|
601
|
-
result["DG22"] = dataGroup.isDG22
|
|
602
|
-
result["DG23"] = dataGroup.isDG23
|
|
603
|
-
result["DG24"] = dataGroup.isDG24
|
|
604
|
-
}
|
|
605
595
|
return result.toJsonObject()
|
|
606
596
|
}
|
|
607
597
|
|
|
598
|
+
fun setDTCDataGroup(dataGroup: DTCDataGroup, opts: JSONObject) = opts.forEach { k, v ->
|
|
599
|
+
val value = v as Boolean
|
|
600
|
+
when (k) {
|
|
601
|
+
"DG17" -> dataGroup.isDG17 = value
|
|
602
|
+
"DG18" -> dataGroup.isDG18 = value
|
|
603
|
+
"DG22" -> dataGroup.isDG22 = value
|
|
604
|
+
"DG23" -> dataGroup.isDG23 = value
|
|
605
|
+
"DG24" -> dataGroup.isDG24 = value
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
fun getDTCDataGroup(dataGroup: DTCDataGroup) = mapOf(
|
|
610
|
+
"DG17" to dataGroup.isDG17,
|
|
611
|
+
"DG18" to dataGroup.isDG18,
|
|
612
|
+
"DG22" to dataGroup.isDG22,
|
|
613
|
+
"DG23" to dataGroup.isDG23,
|
|
614
|
+
"DG24" to dataGroup.isDG24,
|
|
615
|
+
).toJsonObject()
|
|
616
|
+
|
|
608
617
|
fun setImageQA(input: ImageQA, opts: JSONObject) = opts.forEach { k, v ->
|
|
609
618
|
when (k) {
|
|
610
619
|
"focusCheck" -> input.focusCheck = v as Boolean
|
|
@@ -617,6 +626,7 @@ fun setImageQA(input: ImageQA, opts: JSONObject) = opts.forEach { k, v ->
|
|
|
617
626
|
"brightnessThreshold" -> input.brightnessThreshold = v.toDouble()
|
|
618
627
|
"expectedPass" -> input.expectedPass = v.toIntArray()
|
|
619
628
|
"glaresCheckParams" -> input.glaresCheckParams = glaresCheckParamsFromJSON(v as JSONObject)
|
|
629
|
+
"occlusionCheck" -> input.occlusionCheck = v as Boolean
|
|
620
630
|
}
|
|
621
631
|
}
|
|
622
632
|
|
|
@@ -631,6 +641,7 @@ fun getImageQA(input: ImageQA) = mapOf(
|
|
|
631
641
|
"brightnessThreshold" to input.brightnessThreshold,
|
|
632
642
|
"expectedPass" to input.expectedPass.generate(),
|
|
633
643
|
"glaresCheckParams" to generateGlaresCheckParams(input.glaresCheckParams),
|
|
644
|
+
"occlusionCheck" to input.occlusionCheck,
|
|
634
645
|
).toJsonObject()
|
|
635
646
|
|
|
636
647
|
fun setAuthenticityParams(input: AuthenticityParams, opts: JSONObject) = opts.forEach { k, v ->
|
|
@@ -649,6 +660,7 @@ fun setAuthenticityParams(input: AuthenticityParams, opts: JSONObject) = opts.fo
|
|
|
649
660
|
"checkPhotoEmbedding" -> input.checkPhotoEmbedding = v as Boolean
|
|
650
661
|
"checkPhotoComparison" -> input.checkPhotoComparison = v as Boolean
|
|
651
662
|
"checkLetterScreen" -> input.checkLetterScreen = v as Boolean
|
|
663
|
+
"checkSecurityText" -> input.checkSecurityText = v as Boolean
|
|
652
664
|
"livenessParams" -> {
|
|
653
665
|
if (input.livenessParams == null) input.livenessParams = LivenessParams.defaultParams()
|
|
654
666
|
setLivenessParams(input.livenessParams!!, v as JSONObject)
|
|
@@ -672,6 +684,7 @@ fun getAuthenticityParams(input: AuthenticityParams?) = input?.let {
|
|
|
672
684
|
"checkPhotoEmbedding" to it.checkPhotoEmbedding,
|
|
673
685
|
"checkPhotoComparison" to it.checkPhotoComparison,
|
|
674
686
|
"checkLetterScreen" to it.checkLetterScreen,
|
|
687
|
+
"checkSecurityText" to it.checkSecurityText,
|
|
675
688
|
"livenessParams" to getLivenessParams(it.livenessParams)
|
|
676
689
|
).toJsonObject()
|
|
677
690
|
}
|
|
@@ -682,6 +695,8 @@ fun setLivenessParams(input: LivenessParams, opts: JSONObject) = opts.forEach {
|
|
|
682
695
|
"checkMLI" -> input.checkMLI = v as Boolean
|
|
683
696
|
"checkHolo" -> input.checkHolo = v as Boolean
|
|
684
697
|
"checkED" -> input.checkED = v as Boolean
|
|
698
|
+
"checkBlackAndWhiteCopy" -> input.checkBlackAndWhiteCopy = v as Boolean
|
|
699
|
+
"checkDynaprint" -> input.checkDynaprint = v as Boolean
|
|
685
700
|
}
|
|
686
701
|
}
|
|
687
702
|
|
|
@@ -690,7 +705,9 @@ fun getLivenessParams(input: LivenessParams?) = input?.let {
|
|
|
690
705
|
"checkOVI" to input.checkOVI,
|
|
691
706
|
"checkMLI" to input.checkMLI,
|
|
692
707
|
"checkHolo" to input.checkHolo,
|
|
693
|
-
"checkED" to input.checkED
|
|
708
|
+
"checkED" to input.checkED,
|
|
709
|
+
"checkBlackAndWhiteCopy" to input.checkBlackAndWhiteCopy,
|
|
710
|
+
"checkDynaprint" to input.checkDynaprint,
|
|
694
711
|
).toJsonObject()
|
|
695
712
|
}
|
|
696
713
|
|
|
@@ -26,6 +26,7 @@ import com.regula.documentreader.api.enums.PDF417Info
|
|
|
26
26
|
import com.regula.documentreader.api.enums.eGraphicFieldType
|
|
27
27
|
import com.regula.documentreader.api.enums.eRFID_DataFile_Type
|
|
28
28
|
import com.regula.documentreader.api.enums.eRPRM_Lights
|
|
29
|
+
import com.regula.documentreader.api.listener.NetworkInterceptorListener
|
|
29
30
|
import com.regula.documentreader.api.params.AuthenticityParams
|
|
30
31
|
import com.regula.documentreader.api.params.BackendProcessingConfig
|
|
31
32
|
import com.regula.documentreader.api.params.BleDeviceConfig
|
|
@@ -106,6 +107,8 @@ import com.regula.documentreader.Convert.generateByteArray
|
|
|
106
107
|
import org.json.JSONArray
|
|
107
108
|
import org.json.JSONObject
|
|
108
109
|
|
|
110
|
+
val weakReferencesHolder = mutableListOf<Any>()
|
|
111
|
+
|
|
109
112
|
fun generateCompletion(action: Int, results: DocumentReaderResults?, error: RegulaException?, context: Context?) = object : JSONObject() { init {
|
|
110
113
|
put("action", action)
|
|
111
114
|
if (listOf(
|
|
@@ -175,6 +178,7 @@ fun transactionInfoFromJSON(temp: JSONObject?): TransactionInfo? {
|
|
|
175
178
|
|
|
176
179
|
if (input.has("transactionId")) result.transactionId = input.getString("transactionId")
|
|
177
180
|
if (input.has("tag")) result.tag = input.getString("tag")
|
|
181
|
+
if (input.has("sessionLogFolder")) result.sessionLogFolder = input.getString("sessionLogFolder")
|
|
178
182
|
|
|
179
183
|
return result
|
|
180
184
|
}
|
|
@@ -186,6 +190,7 @@ fun generateTransactionInfo(temp: TransactionInfo?): JSONObject? {
|
|
|
186
190
|
|
|
187
191
|
result.put("transactionId", input.transactionId)
|
|
188
192
|
result.put("tag", input.tag)
|
|
193
|
+
result.put("sessionLogFolder", input.sessionLogFolder)
|
|
189
194
|
|
|
190
195
|
return result
|
|
191
196
|
}
|
|
@@ -366,6 +371,11 @@ fun onlineProcessingConfigFromJSON(temp: JSONObject?): OnlineProcessingConfig? {
|
|
|
366
371
|
if (input.has("url")) builder.setUrl(input.getString("url"))
|
|
367
372
|
if (input.has("imageCompressionQuality")) builder.setImageCompressionQuality(input.getDouble("imageCompressionQuality").toFloat())
|
|
368
373
|
if (input.has("processParams")) builder.setProcessParams(processParamFromJSON(input.getJSONObject("processParams")))
|
|
374
|
+
if (input.has("requestHeaders")) {
|
|
375
|
+
val listener = NetworkInterceptorListener { input.getJSONObject("requestHeaders").forEach { k, v -> it.setRequestProperty(k, v as String) } }
|
|
376
|
+
weakReferencesHolder.add(listener)
|
|
377
|
+
builder.setNetworkInterceptorListener(listener)
|
|
378
|
+
}
|
|
369
379
|
|
|
370
380
|
return builder.build()
|
|
371
381
|
}
|
|
@@ -524,13 +534,13 @@ fun eIDDataGroupsFromJSON(input: JSONObject): EIDDataGroups {
|
|
|
524
534
|
|
|
525
535
|
fun generateEIDDataGroups(input: EIDDataGroups): JSONObject = getDataGroups(input)
|
|
526
536
|
|
|
527
|
-
fun
|
|
537
|
+
fun dtcDataGroupFromJSON(input: JSONObject): DTCDataGroup {
|
|
528
538
|
val result = DTCDataGroup()
|
|
529
|
-
|
|
539
|
+
setDTCDataGroup(result, input)
|
|
530
540
|
return result
|
|
531
541
|
}
|
|
532
542
|
|
|
533
|
-
fun
|
|
543
|
+
fun generateDTCDataGroup(input: DTCDataGroup): JSONObject = getDTCDataGroup(input)
|
|
534
544
|
|
|
535
545
|
fun rfidScenarioFromJSON(input: JSONObject): RfidScenario {
|
|
536
546
|
val result = RfidScenario()
|
|
@@ -1713,6 +1723,7 @@ fun generateDocumentReaderAuthenticityResult(temp: DocumentReaderAuthenticityRes
|
|
|
1713
1723
|
temp ?: return null
|
|
1714
1724
|
val input: DocumentReaderAuthenticityResult = temp
|
|
1715
1725
|
|
|
1726
|
+
@Suppress("DEPRECATION")
|
|
1716
1727
|
result.put("status", input.status)
|
|
1717
1728
|
result.put("checks", generateList(input.checks, ::generateDocumentReaderAuthenticityCheck, context))
|
|
1718
1729
|
|
|
@@ -2181,7 +2192,7 @@ fun documentReaderResultsFromJSON(temp: JSONObject?): DocumentReaderResults? {
|
|
|
2181
2192
|
result.status = documentReaderResultsStatusFromJSON(input.optJSONObject("status"))!!
|
|
2182
2193
|
result.vdsncData = vdsncDataFromJSON(input.optJSONObject("vdsncData")!!)
|
|
2183
2194
|
result.dtcData = input.getString("dtcData")
|
|
2184
|
-
result.transactionInfo = transactionInfoFromJSON(input.optJSONObject("transactionInfo"))
|
|
2195
|
+
result.transactionInfo = transactionInfoFromJSON(input.optJSONObject("transactionInfo"))!!
|
|
2185
2196
|
|
|
2186
2197
|
return result
|
|
2187
2198
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
@file:Suppress("UNCHECKED_CAST")
|
|
1
|
+
@file:Suppress("UNCHECKED_CAST", "MissingPermission")
|
|
2
2
|
|
|
3
3
|
package com.regula.documentreader
|
|
4
4
|
|
|
5
|
-
import android.annotation.SuppressLint
|
|
6
5
|
import android.app.Activity
|
|
7
6
|
import android.app.PendingIntent
|
|
7
|
+
import android.content.Context
|
|
8
8
|
import android.content.Intent
|
|
9
9
|
import android.content.IntentFilter
|
|
10
10
|
import android.nfc.NfcAdapter
|
|
@@ -21,7 +21,7 @@ import com.facebook.react.bridge.ReactContextBaseJavaModule
|
|
|
21
21
|
import com.facebook.react.bridge.ReactMethod
|
|
22
22
|
import com.facebook.react.bridge.ReadableArray
|
|
23
23
|
import com.facebook.react.modules.core.DeviceEventManagerModule
|
|
24
|
-
import com.facebook.react.modules.core.
|
|
24
|
+
import com.facebook.react.modules.core.PermissionAwareActivity
|
|
25
25
|
import com.regula.common.LocalizationCallbacks
|
|
26
26
|
import com.regula.documentreader.Convert.bitmapToBase64
|
|
27
27
|
import com.regula.documentreader.Convert.byteArrayFromBase64
|
|
@@ -55,11 +55,40 @@ import com.regula.documentreader.api.results.DocumentReaderScenario
|
|
|
55
55
|
import org.json.JSONArray
|
|
56
56
|
import org.json.JSONObject
|
|
57
57
|
|
|
58
|
+
lateinit var args: JSONArray
|
|
59
|
+
lateinit var binding: ReactContext
|
|
60
|
+
val context: Context
|
|
61
|
+
get() = binding.applicationContext
|
|
62
|
+
val activity: Activity
|
|
63
|
+
get() = binding.currentActivity!!
|
|
64
|
+
val lifecycle: Lifecycle
|
|
65
|
+
get() = (activity as AppCompatActivity).lifecycle
|
|
66
|
+
|
|
67
|
+
fun sendEvent(event: String, data: Any? = "") {
|
|
68
|
+
val map = Arguments.createMap()
|
|
69
|
+
val result = if (data is JSONObject || data is JSONArray) data.toString() else data.toString() + ""
|
|
70
|
+
map.putString("msg", result)
|
|
71
|
+
binding.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter::class.java).emit(event, map)
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
fun <T> argsNullable(index: Int): T? {
|
|
75
|
+
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
76
|
+
// Rewrite it according to react native documentation!!!
|
|
77
|
+
// the is no int or double in js so all ints are sent as double by default
|
|
78
|
+
val value = args[index]
|
|
79
|
+
if (value is Double) if (value % 1 == 0.0) {
|
|
80
|
+
val intValue = value.toInt()
|
|
81
|
+
return intValue as T
|
|
82
|
+
}
|
|
83
|
+
if (args[index].toString() == "null") return null
|
|
84
|
+
return args[index] as T
|
|
85
|
+
}
|
|
86
|
+
|
|
58
87
|
@Suppress("unused", "UNUSED_PARAMETER")
|
|
59
|
-
class RNRegulaDocumentReaderModule(
|
|
88
|
+
class RNRegulaDocumentReaderModule(reactContext: ReactApplicationContext) : ReactContextBaseJavaModule(reactContext), ActivityEventListener {
|
|
60
89
|
init {
|
|
61
|
-
|
|
62
|
-
|
|
90
|
+
binding = reactContext
|
|
91
|
+
binding.addActivityEventListener(this)
|
|
63
92
|
}
|
|
64
93
|
|
|
65
94
|
@ReactMethod
|
|
@@ -70,7 +99,9 @@ class RNRegulaDocumentReaderModule(rc: ReactApplicationContext) : ReactContextBa
|
|
|
70
99
|
|
|
71
100
|
@ReactMethod
|
|
72
101
|
fun exec(moduleName: String?, action: String?, args: ReadableArray, successCallback: com.facebook.react.bridge.Callback, errorCallback: com.facebook.react.bridge.Callback) = exec(action, args, successCallback, errorCallback)
|
|
102
|
+
|
|
73
103
|
override fun getName() = "RNRegulaDocumentReader"
|
|
104
|
+
|
|
74
105
|
override fun onNewIntent(intent: Intent) {
|
|
75
106
|
newIntent(intent)
|
|
76
107
|
}
|
|
@@ -78,38 +109,20 @@ class RNRegulaDocumentReaderModule(rc: ReactApplicationContext) : ReactContextBa
|
|
|
78
109
|
override fun onActivityResult(activity: Activity, requestCode: Int, resultCode: Int, data: Intent?) {
|
|
79
110
|
onActivityResult(requestCode, resultCode, data)
|
|
80
111
|
}
|
|
81
|
-
|
|
82
|
-
override fun onRequestPermissionsResult(requestCode: Int, permissions: Array<out String>?, grantResults: IntArray?) = com.regula.documentreader.onRequestPermissionsResult(requestCode, permissions!!, grantResults!!)
|
|
83
112
|
}
|
|
84
113
|
|
|
85
|
-
fun
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
map.putString("msg", result)
|
|
89
|
-
reactContext.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter::class.java).emit(event, map)
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
fun <T> argsNullable(index: Int): T? {
|
|
93
|
-
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
94
|
-
// Rewrite it according to react native documentation!!!
|
|
95
|
-
// the is no int or double in js so all ints are sent as double by default
|
|
96
|
-
val value = args[index]
|
|
97
|
-
if (value is Double) if (value % 1 == 0.0) {
|
|
98
|
-
val intValue = value.toInt()
|
|
99
|
-
return intValue as T
|
|
114
|
+
fun requestPermissions(activity: Activity, permissions: Array<String>, requestCode: Int) {
|
|
115
|
+
(activity as PermissionAwareActivity).requestPermissions(permissions, requestCode) { code, perms, grantResults ->
|
|
116
|
+
onRequestPermissionsResult(code, perms, grantResults)
|
|
100
117
|
}
|
|
101
|
-
if (args[index].toString() == "null") return null
|
|
102
|
-
return args[index] as T
|
|
103
118
|
}
|
|
104
119
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
get() = (activity as AppCompatActivity).lifecycle
|
|
120
|
+
fun startActivityForResult(activity: Activity, intent: Intent, requestCode: Int) {
|
|
121
|
+
activity.startActivityForResult(intent, requestCode)
|
|
122
|
+
}
|
|
109
123
|
|
|
110
124
|
fun exec(action: String?, arguments: ReadableArray, successCallback: com.facebook.react.bridge.Callback, errorCallback: com.facebook.react.bridge.Callback) {
|
|
111
125
|
args = JSONArray(arguments.toArrayList())
|
|
112
|
-
reactContext.currentActivity?.let { activity = it }
|
|
113
126
|
val callback = object : Callback {
|
|
114
127
|
override fun success(data: Any?) = successCallback.invoke(data.toSendable())
|
|
115
128
|
override fun error(message: String) = errorCallback.invoke(message)
|
|
@@ -194,14 +207,6 @@ interface Callback {
|
|
|
194
207
|
fun error(message: String)
|
|
195
208
|
}
|
|
196
209
|
|
|
197
|
-
@SuppressLint("StaticFieldLeak")
|
|
198
|
-
lateinit var activity: Activity
|
|
199
|
-
lateinit var lifecycleObserver: LifecycleEventObserver
|
|
200
|
-
val context
|
|
201
|
-
get() = activity
|
|
202
|
-
|
|
203
|
-
var backgroundRFIDEnabled = false
|
|
204
|
-
|
|
205
210
|
const val eventCompletion = "completion"
|
|
206
211
|
const val eventDatabaseProgress = "database_progress"
|
|
207
212
|
|
|
@@ -509,6 +514,9 @@ fun newIntent(intent: Intent): Boolean {
|
|
|
509
514
|
return true
|
|
510
515
|
}
|
|
511
516
|
|
|
517
|
+
var backgroundRFIDEnabled = false
|
|
518
|
+
lateinit var lifecycleObserver: LifecycleEventObserver
|
|
519
|
+
|
|
512
520
|
fun startForegroundDispatch() {
|
|
513
521
|
backgroundRFIDEnabled = true
|
|
514
522
|
val filters: Array<IntentFilter?> = arrayOfNulls(1)
|
|
@@ -516,9 +524,9 @@ fun startForegroundDispatch() {
|
|
|
516
524
|
filters[0]!!.addAction(NfcAdapter.ACTION_TECH_DISCOVERED)
|
|
517
525
|
filters[0]!!.addCategory(Intent.CATEGORY_DEFAULT)
|
|
518
526
|
val techList = arrayOf(arrayOf("android.nfc.tech.IsoDep"))
|
|
519
|
-
val intent = Intent(
|
|
527
|
+
val intent = Intent(activity, activity.javaClass)
|
|
520
528
|
val flag = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) PendingIntent.FLAG_MUTABLE else 0
|
|
521
|
-
val pendingIntent = PendingIntent.getActivity(
|
|
529
|
+
val pendingIntent = PendingIntent.getActivity(activity, 0, intent, flag)
|
|
522
530
|
|
|
523
531
|
if (lifecycle.currentState.isAtLeast(Lifecycle.State.RESUMED))
|
|
524
532
|
enableForegroundDispatch(pendingIntent, filters, techList)
|
|
@@ -529,7 +537,7 @@ fun startForegroundDispatch() {
|
|
|
529
537
|
else -> Unit
|
|
530
538
|
}
|
|
531
539
|
}
|
|
532
|
-
|
|
540
|
+
activity.runOnUiThread { lifecycle.addObserver(lifecycleObserver) }
|
|
533
541
|
}
|
|
534
542
|
|
|
535
543
|
fun enableForegroundDispatch(
|
|
@@ -538,15 +546,15 @@ fun enableForegroundDispatch(
|
|
|
538
546
|
techList: Array<Array<String>>
|
|
539
547
|
) = NfcAdapter.getDefaultAdapter(context).enableForegroundDispatch(activity, pendingIntent, filters, techList)
|
|
540
548
|
|
|
541
|
-
fun disableForegroundDispatch() = NfcAdapter.getDefaultAdapter(
|
|
549
|
+
fun disableForegroundDispatch() = NfcAdapter.getDefaultAdapter(context).disableForegroundDispatch(activity)
|
|
542
550
|
|
|
543
551
|
fun stopBackgroundRFID() {
|
|
544
552
|
if (!backgroundRFIDEnabled) return
|
|
545
553
|
backgroundRFIDEnabled = false
|
|
546
554
|
if (lifecycle.currentState.isAtLeast(Lifecycle.State.RESUMED))
|
|
547
555
|
disableForegroundDispatch()
|
|
548
|
-
|
|
556
|
+
activity.runOnUiThread { lifecycle.removeObserver(lifecycleObserver) }
|
|
549
557
|
}
|
|
550
558
|
|
|
551
559
|
// Weak references
|
|
552
|
-
var localizationCallbacks: LocalizationCallbacks? = null
|
|
560
|
+
var localizationCallbacks: LocalizationCallbacks? = null
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
distributionBase=GRADLE_USER_HOME
|
|
2
2
|
distributionPath=wrapper/dists
|
|
3
|
-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.
|
|
3
|
+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
|
|
4
4
|
networkTimeout=10000
|
|
5
5
|
zipStoreBase=GRADLE_USER_HOME
|
|
6
6
|
zipStorePath=wrapper/dists
|
|
@@ -448,7 +448,7 @@
|
|
|
448
448
|
"$(inherited)",
|
|
449
449
|
);
|
|
450
450
|
INFOPLIST_FILE = DocumentReaderTests/Info.plist;
|
|
451
|
-
IPHONEOS_DEPLOYMENT_TARGET =
|
|
451
|
+
IPHONEOS_DEPLOYMENT_TARGET = 15.6;
|
|
452
452
|
LD_RUNPATH_SEARCH_PATHS = (
|
|
453
453
|
"$(inherited)",
|
|
454
454
|
"@executable_path/Frameworks",
|
|
@@ -477,7 +477,7 @@
|
|
|
477
477
|
BUNDLE_LOADER = "$(TEST_HOST)";
|
|
478
478
|
COPY_PHASE_STRIP = NO;
|
|
479
479
|
INFOPLIST_FILE = DocumentReaderTests/Info.plist;
|
|
480
|
-
IPHONEOS_DEPLOYMENT_TARGET =
|
|
480
|
+
IPHONEOS_DEPLOYMENT_TARGET = 15.6;
|
|
481
481
|
LD_RUNPATH_SEARCH_PATHS = (
|
|
482
482
|
"$(inherited)",
|
|
483
483
|
"@executable_path/Frameworks",
|
|
@@ -612,7 +612,7 @@
|
|
|
612
612
|
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
|
613
613
|
GCC_WARN_UNUSED_FUNCTION = YES;
|
|
614
614
|
GCC_WARN_UNUSED_VARIABLE = YES;
|
|
615
|
-
IPHONEOS_DEPLOYMENT_TARGET =
|
|
615
|
+
IPHONEOS_DEPLOYMENT_TARGET = 15.6;
|
|
616
616
|
LD_RUNPATH_SEARCH_PATHS = (
|
|
617
617
|
/usr/lib/swift,
|
|
618
618
|
"$(inherited)",
|
|
@@ -678,7 +678,7 @@
|
|
|
678
678
|
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
|
679
679
|
GCC_WARN_UNUSED_FUNCTION = YES;
|
|
680
680
|
GCC_WARN_UNUSED_VARIABLE = YES;
|
|
681
|
-
IPHONEOS_DEPLOYMENT_TARGET =
|
|
681
|
+
IPHONEOS_DEPLOYMENT_TARGET = 15.6;
|
|
682
682
|
LD_RUNPATH_SEARCH_PATHS = (
|
|
683
683
|
/usr/lib/swift,
|
|
684
684
|
"$(inherited)",
|
package/example/ios/Podfile
CHANGED
package/example/package.json
CHANGED
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
"test": "jest"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@regulaforensics/react-native-document-reader-api": "
|
|
14
|
-
"@regulaforensics/react-native-document-reader-core-fullauthrfid": "
|
|
13
|
+
"@regulaforensics/react-native-document-reader-api": "8.1.68-nightly",
|
|
14
|
+
"@regulaforensics/react-native-document-reader-core-fullauthrfid": "8.1.75-nightly",
|
|
15
15
|
"react-native-progress": "5.0.0",
|
|
16
16
|
"react-native-radio-buttons-group": "3.0.5",
|
|
17
17
|
"@rneui/base": "4.0.0-rc.7",
|