@regulaforensics/react-native-document-reader-api 7.6.21-nightly → 7.6.35-beta
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 +1 -1
- package/android/build.gradle +2 -2
- package/android/src/main/java/com/regula/documentreader/BluetoothUtil.kt +12 -16
- package/android/src/main/java/com/regula/documentreader/Config.kt +2 -0
- package/android/src/main/java/com/regula/documentreader/JSONConstructor.kt +8 -0
- package/android/src/main/java/com/regula/documentreader/RNRegulaDocumentReaderModule.kt +50 -42
- package/example/package.json +2 -2
- package/index.d.ts +3 -1
- package/index.js +2 -1
- package/ios/RGLWJSONConstructor.h +5 -0
- package/ios/RGLWJSONConstructor.m +31 -0
- package/package.json +1 -1
|
@@ -14,6 +14,6 @@ Pod::Spec.new do |s|
|
|
|
14
14
|
s.source = { :http => 'file:' + __dir__ }
|
|
15
15
|
s.ios.deployment_target = '12.0'
|
|
16
16
|
s.source_files = "ios/*.{h,m}"
|
|
17
|
-
s.dependency '
|
|
17
|
+
s.dependency 'DocumentReader', '7.5.4221'
|
|
18
18
|
s.dependency 'React'
|
|
19
19
|
end
|
package/android/build.gradle
CHANGED
|
@@ -32,7 +32,7 @@ android {
|
|
|
32
32
|
rootProject.allprojects {
|
|
33
33
|
repositories {
|
|
34
34
|
maven {
|
|
35
|
-
url "https://maven.regulaforensics.com/RegulaDocumentReader
|
|
35
|
+
url "https://maven.regulaforensics.com/RegulaDocumentReader"
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
}
|
|
@@ -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:7.
|
|
44
|
+
implementation('com.regula.documentreader:api:7.5.10412') {
|
|
45
45
|
transitive = true
|
|
46
46
|
}
|
|
47
47
|
}
|
|
@@ -22,7 +22,6 @@ 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
26
|
import com.regula.documentreader.api.ble.BLEWrapper
|
|
28
27
|
import com.regula.documentreader.api.ble.BleWrapperCallback
|
|
@@ -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() {
|
|
@@ -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
|
}
|
|
@@ -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(
|
|
@@ -366,6 +369,11 @@ fun onlineProcessingConfigFromJSON(temp: JSONObject?): OnlineProcessingConfig? {
|
|
|
366
369
|
if (input.has("url")) builder.setUrl(input.getString("url"))
|
|
367
370
|
if (input.has("imageCompressionQuality")) builder.setImageCompressionQuality(input.getDouble("imageCompressionQuality").toFloat())
|
|
368
371
|
if (input.has("processParams")) builder.setProcessParams(processParamFromJSON(input.getJSONObject("processParams")))
|
|
372
|
+
if (input.has("requestHeaders")) {
|
|
373
|
+
val listener = NetworkInterceptorListener { input.getJSONObject("requestHeaders").forEach { k, v -> it.setRequestProperty(k, v as String) } }
|
|
374
|
+
weakReferencesHolder.add(listener)
|
|
375
|
+
builder.setNetworkInterceptorListener(listener)
|
|
376
|
+
}
|
|
369
377
|
|
|
370
378
|
return builder.build()
|
|
371
379
|
}
|
|
@@ -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<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)
|
|
@@ -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
|
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": "7.6.
|
|
14
|
-
"@regulaforensics/react-native-document-reader-core-fullauthrfid": "7.
|
|
13
|
+
"@regulaforensics/react-native-document-reader-api": "7.6.35-beta",
|
|
14
|
+
"@regulaforensics/react-native-document-reader-core-fullauthrfid": "7.5.893",
|
|
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",
|
package/index.d.ts
CHANGED
|
@@ -1477,6 +1477,7 @@ export class OnlineProcessingConfig {
|
|
|
1477
1477
|
processParams?: ProcessParams
|
|
1478
1478
|
imageFormat?: number
|
|
1479
1479
|
imageCompressionQuality?: number
|
|
1480
|
+
requestHeaders?: Record<string, string>
|
|
1480
1481
|
|
|
1481
1482
|
static fromJson(jsonObject?: any): OnlineProcessingConfig | undefined {
|
|
1482
1483
|
if (jsonObject == null || jsonObject == undefined) return undefined
|
|
@@ -1487,6 +1488,7 @@ export class OnlineProcessingConfig {
|
|
|
1487
1488
|
result.processParams = ProcessParams.fromJson(jsonObject["processParams"])
|
|
1488
1489
|
result.imageFormat = jsonObject["imageFormat"]
|
|
1489
1490
|
result.imageCompressionQuality = jsonObject["imageCompressionQuality"]
|
|
1491
|
+
result.requestHeaders = jsonObject["requestHeaders"]
|
|
1490
1492
|
|
|
1491
1493
|
return result
|
|
1492
1494
|
}
|
|
@@ -5417,7 +5419,7 @@ export default class DocumentReader {
|
|
|
5417
5419
|
static addPKDCertificates(certificates: PKDCertificate[], successCallback: (response: string) => void, errorCallback?: (error: string) => void): void
|
|
5418
5420
|
static clearPKDCertificates(successCallback: (response: string) => void, errorCallback?: (error: string) => void): void
|
|
5419
5421
|
static startNewSession(successCallback: (response: string) => void, errorCallback?: (error: string) => void): void
|
|
5420
|
-
static connectBluetoothDevice(successCallback: (response: string) => void, errorCallback?: (error: string) => void): void
|
|
5422
|
+
static connectBluetoothDevice(btDeviceName: string, successCallback: (response: string) => void, errorCallback?: (error: string) => void): void
|
|
5421
5423
|
static setLocalizationDictionary(dictionary: Record<string, string>, successCallback: (response: string) => void, errorCallback?: (error: string) => void): void
|
|
5422
5424
|
static getLicense(successCallback: (response: string) => void, errorCallback?: (error: string) => void): void
|
|
5423
5425
|
static getAvailableScenarios(successCallback: (response: string) => void, errorCallback?: (error: string) => void): void
|
package/index.js
CHANGED
|
@@ -998,6 +998,7 @@ export class OnlineProcessingConfig {
|
|
|
998
998
|
result.processParams = ProcessParams.fromJson(jsonObject["processParams"])
|
|
999
999
|
result.imageFormat = jsonObject["imageFormat"]
|
|
1000
1000
|
result.imageCompressionQuality = jsonObject["imageCompressionQuality"]
|
|
1001
|
+
result.requestHeaders = jsonObject["requestHeaders"]
|
|
1001
1002
|
|
|
1002
1003
|
return result
|
|
1003
1004
|
}
|
|
@@ -4433,7 +4434,7 @@ DocumentReader.setTCCParams = (params, successCallback, errorCallback) => RNRegu
|
|
|
4433
4434
|
DocumentReader.addPKDCertificates = (certificates, successCallback, errorCallback) => RNRegulaDocumentReader.exec("DocumentReader", "addPKDCertificates", [certificates], successCallback, errorCallback)
|
|
4434
4435
|
DocumentReader.clearPKDCertificates = (successCallback, errorCallback) => RNRegulaDocumentReader.exec("DocumentReader", "clearPKDCertificates", [], successCallback, errorCallback)
|
|
4435
4436
|
DocumentReader.startNewSession = (successCallback, errorCallback) => RNRegulaDocumentReader.exec("DocumentReader", "startNewSession", [], successCallback, errorCallback)
|
|
4436
|
-
DocumentReader.connectBluetoothDevice = (successCallback, errorCallback) => RNRegulaDocumentReader.exec("DocumentReader", "connectBluetoothDevice", [], successCallback, errorCallback)
|
|
4437
|
+
DocumentReader.connectBluetoothDevice = (btDeviceName, successCallback, errorCallback) => RNRegulaDocumentReader.exec("DocumentReader", "connectBluetoothDevice", [btDeviceName], successCallback, errorCallback)
|
|
4437
4438
|
DocumentReader.setLocalizationDictionary = (dictionary, successCallback, errorCallback) => RNRegulaDocumentReader.exec("DocumentReader", "setLocalizationDictionary", [dictionary], successCallback, errorCallback)
|
|
4438
4439
|
DocumentReader.getLicense = (successCallback, errorCallback) => RNRegulaDocumentReader.exec("DocumentReader", "getLicense", [], successCallback, errorCallback)
|
|
4439
4440
|
DocumentReader.getAvailableScenarios = (successCallback, errorCallback) => RNRegulaDocumentReader.exec("DocumentReader", "getAvailableScenarios", [], successCallback, errorCallback)
|
|
@@ -184,4 +184,9 @@
|
|
|
184
184
|
+(NSDictionary* _Nullable)generateTransactionInfo:(RGLTransactionInfo* _Nullable)input;
|
|
185
185
|
|
|
186
186
|
@end
|
|
187
|
+
|
|
188
|
+
@interface RGLWRequestInterceptorProxy : NSObject <RGLURLRequestInterceptingDelegate>
|
|
189
|
+
- (instancetype _Nonnull)initWithHeaders:(NSDictionary*_Nonnull)headers;
|
|
190
|
+
@end
|
|
191
|
+
|
|
187
192
|
#endif
|
|
@@ -11,6 +11,13 @@
|
|
|
11
11
|
|
|
12
12
|
@implementation RGLWJSONConstructor
|
|
13
13
|
|
|
14
|
+
static NSMutableArray* weakReferencesHolder;
|
|
15
|
+
+(void) holdWeakReference:(id)reference {
|
|
16
|
+
if(!weakReferencesHolder)
|
|
17
|
+
weakReferencesHolder = [NSMutableArray new];
|
|
18
|
+
[weakReferencesHolder addObject:reference];
|
|
19
|
+
}
|
|
20
|
+
|
|
14
21
|
+(NSString*)dictToString:(NSDictionary*)input {
|
|
15
22
|
if(input == nil) return nil;
|
|
16
23
|
return [[NSString alloc] initWithData:[NSJSONSerialization dataWithJSONObject:input options:NSJSONWritingPrettyPrinted error:nil] encoding:NSUTF8StringEncoding];
|
|
@@ -406,6 +413,11 @@
|
|
|
406
413
|
[RGLWConfig setProcessParams:[input valueForKey:@"processParams"] :params];
|
|
407
414
|
result.processParams = params;
|
|
408
415
|
}
|
|
416
|
+
if([input valueForKey:@"requestHeaders"] != nil) {
|
|
417
|
+
RGLWRequestInterceptorProxy* proxy = [[RGLWRequestInterceptorProxy alloc] initWithHeaders:[input valueForKey:@"requestHeaders"]];
|
|
418
|
+
[self holdWeakReference: proxy];
|
|
419
|
+
result.requestInterceptingDelegate = proxy;
|
|
420
|
+
}
|
|
409
421
|
|
|
410
422
|
return result;
|
|
411
423
|
}
|
|
@@ -2336,3 +2348,22 @@
|
|
|
2336
2348
|
}
|
|
2337
2349
|
|
|
2338
2350
|
@end
|
|
2351
|
+
|
|
2352
|
+
@implementation RGLWRequestInterceptorProxy {
|
|
2353
|
+
NSDictionary* _headers;
|
|
2354
|
+
}
|
|
2355
|
+
|
|
2356
|
+
- (instancetype)initWithHeaders:(NSDictionary*)headers {
|
|
2357
|
+
self = [super init];
|
|
2358
|
+
_headers = [headers copy];
|
|
2359
|
+
return self;
|
|
2360
|
+
}
|
|
2361
|
+
|
|
2362
|
+
-(NSURLRequest*)interceptorPrepareRequest:(NSURLRequest*)request {
|
|
2363
|
+
NSMutableURLRequest *interceptedRequest = [request mutableCopy];
|
|
2364
|
+
for (NSString* key in _headers.allKeys)
|
|
2365
|
+
[interceptedRequest addValue:[_headers valueForKey:key] forHTTPHeaderField:key];
|
|
2366
|
+
return interceptedRequest;
|
|
2367
|
+
}
|
|
2368
|
+
|
|
2369
|
+
@end
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@regulaforensics/react-native-document-reader-api",
|
|
3
|
-
"version": "7.6.
|
|
3
|
+
"version": "7.6.35-beta",
|
|
4
4
|
"description": "React Native module for reading and validation of identification documents (API framework)",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|