@regulaforensics/react-native-document-reader-api 7.6.6-beta → 7.6.15-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.
@@ -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
  }
@@ -10,8 +10,8 @@
10
10
  "test": "jest"
11
11
  },
12
12
  "dependencies": {
13
- "@regulaforensics/react-native-document-reader-api": "7.6.6-beta",
14
- "@regulaforensics/react-native-document-reader-core-fullauthrfid": "7.6.8-beta",
13
+ "@regulaforensics/react-native-document-reader-api": "7.6.15-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.6-beta",
3
+ "version": "7.6.15-beta",
4
4
  "description": "React Native module for reading and validation of identification documents (API framework)",
5
5
  "main": "index.js",
6
6
  "scripts": {