@regulaforensics/cordova-plugin-document-reader-api 7.4.620 → 7.5.78-rc
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/.gitlab/report.yaml +75 -0
- package/.gitlab-ci.yml +49 -0
- package/README.md +1 -1
- package/example/config.xml +14 -12
- package/example/package.json +4 -4
- package/example/www/js/index.js +5 -0
- package/package.json +4 -8
- package/plugin.xml +7 -5
- package/src/android/BluetoothUtil.kt +105 -59
- package/src/android/Config.kt +63 -5
- package/src/android/DocumentReader.kt +66 -47
- package/src/android/JSONConstructor.kt +39 -14
- package/src/android/Utils.kt +7 -2
- package/src/android/build.gradle +2 -4
- package/src/ios/RGLWConfig.h +2 -0
- package/src/ios/RGLWConfig.m +103 -50
- package/src/ios/RGLWDocumentReader.h +4 -1
- package/src/ios/RGLWDocumentReader.m +71 -21
- package/src/ios/RGLWJSONConstructor.h +8 -0
- package/src/ios/RGLWJSONConstructor.m +77 -9
- package/www/DocumentReader.js +82 -6
- package/.github/ISSUE_TEMPLATE/config.yml +0 -5
package/src/android/Config.kt
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
//
|
|
2
|
-
// Config.
|
|
2
|
+
// Config.kt
|
|
3
3
|
// DocumentReader
|
|
4
4
|
//
|
|
5
5
|
// Created by Pavel Masiuk on 21.09.2023.
|
|
6
6
|
// Copyright © 2023 Regula. All rights reserved.
|
|
7
7
|
//
|
|
8
8
|
|
|
9
|
+
@file:Suppress("EnumValuesSoftDeprecate")
|
|
10
|
+
|
|
9
11
|
package cordova.plugin.documentreader
|
|
10
12
|
|
|
11
13
|
import android.content.Context
|
|
@@ -26,6 +28,7 @@ import com.regula.documentreader.api.params.LivenessParams
|
|
|
26
28
|
import com.regula.documentreader.api.params.ParamsCustomization
|
|
27
29
|
import com.regula.documentreader.api.params.ProcessParam
|
|
28
30
|
import com.regula.documentreader.api.params.RfidScenario
|
|
31
|
+
import com.regula.documentreader.api.params.rfid.dg.DTCDataGroup
|
|
29
32
|
import com.regula.documentreader.api.params.rfid.dg.DataGroups
|
|
30
33
|
import com.regula.documentreader.api.params.rfid.dg.EIDDataGroups
|
|
31
34
|
import com.regula.documentreader.api.params.rfid.dg.EPassportDataGroups
|
|
@@ -52,6 +55,7 @@ fun setFunctionality(functionality: Functionality, opts: JSONObject) = opts.forE
|
|
|
52
55
|
"isCameraTorchCheckDisabled" -> editor.setIsCameraTorchCheckDisabled(v as Boolean)
|
|
53
56
|
"recordScanningProcess" -> editor.setDoRecordProcessingVideo(v as Boolean)
|
|
54
57
|
"manualMultipageMode" -> editor.setManualMultipageMode(v as Boolean)
|
|
58
|
+
"torchTurnedOn" -> editor.setTorchTurnedOn(v as Boolean)
|
|
55
59
|
"showCaptureButtonDelayFromDetect" -> editor.setShowCaptureButtonDelayFromDetect(v.toLong())
|
|
56
60
|
"showCaptureButtonDelayFromStart" -> editor.setShowCaptureButtonDelayFromStart(v.toLong())
|
|
57
61
|
"orientation" -> editor.setOrientation(v.toInt())
|
|
@@ -85,6 +89,7 @@ fun getFunctionality(functionality: Functionality) = mapOf(
|
|
|
85
89
|
"isCameraTorchCheckDisabled" to functionality.isCameraTorchCheckDisabled,
|
|
86
90
|
"recordScanningProcess" to functionality.doRecordProcessingVideo(),
|
|
87
91
|
"manualMultipageMode" to functionality.isManualMultipageMode,
|
|
92
|
+
"torchTurnedOn" to functionality.isTorchTurnedOn,
|
|
88
93
|
"showCaptureButtonDelayFromDetect" to functionality.showCaptureButtonDelayFromDetect,
|
|
89
94
|
"showCaptureButtonDelayFromStart" to functionality.showCaptureButtonDelayFromStart,
|
|
90
95
|
"orientation" to functionality.orientation,
|
|
@@ -129,12 +134,17 @@ fun setProcessParams(processParams: ProcessParam, opts: JSONObject) = opts.forEa
|
|
|
129
134
|
"shouldReturnPackageForReprocess" -> processParams.shouldReturnPackageForReprocess = v as Boolean
|
|
130
135
|
"disablePerforationOCR" -> processParams.disablePerforationOCR = v as Boolean
|
|
131
136
|
"respectImageQuality" -> processParams.respectImageQuality = v as Boolean
|
|
137
|
+
"strictImageQuality" -> processParams.strictImageQuality = v as Boolean
|
|
132
138
|
"splitNames" -> processParams.splitNames = v as Boolean
|
|
133
139
|
"doDetectCan" -> processParams.doDetectCan = v as Boolean
|
|
134
140
|
"useFaceApi" -> processParams.useFaceApi = v as Boolean
|
|
135
141
|
"useAuthenticityCheck" -> processParams.useAuthenticityCheck = v as Boolean
|
|
136
142
|
"checkHologram" -> processParams.checkHologram = v as Boolean
|
|
137
143
|
"generateNumericCodes" -> processParams.generateNumericCodes = v as Boolean
|
|
144
|
+
"strictBarcodeDigitalSignatureCheck" -> processParams.strictBarcodeDigitalSignatureCheck = v as Boolean
|
|
145
|
+
"selectLongestNames" -> processParams.selectLongestNames = v as Boolean
|
|
146
|
+
"generateDTCVC" -> processParams.generateDTCVC = v as Boolean
|
|
147
|
+
"strictDLCategoryExpiry" -> processParams.strictDLCategoryExpiry = v as Boolean
|
|
138
148
|
"measureSystem" -> processParams.measureSystem = v.toInt()
|
|
139
149
|
"barcodeParserType" -> processParams.barcodeParserType = v.toInt()
|
|
140
150
|
"perspectiveAngle" -> processParams.perspectiveAngle = v.toInt()
|
|
@@ -153,7 +163,6 @@ fun setProcessParams(processParams: ProcessParam, opts: JSONObject) = opts.forEa
|
|
|
153
163
|
"dateFormat" -> processParams.dateFormat = v as String
|
|
154
164
|
"scenario" -> processParams.scenario = v as String
|
|
155
165
|
"captureButtonScenario" -> processParams.captureButtonScenario = v as String
|
|
156
|
-
"sessionLogFolder" -> processParams.sessionLogFolder = v as String
|
|
157
166
|
"timeout" -> processParams.timeout = v.toDouble()
|
|
158
167
|
"timeoutFromFirstDetect" -> processParams.timeoutFromFirstDetect = v.toDouble()
|
|
159
168
|
"timeoutFromFirstDocType" -> processParams.timeoutFromFirstDocType = v.toDouble()
|
|
@@ -207,12 +216,17 @@ fun getProcessParams(processParams: ProcessParam) = mapOf(
|
|
|
207
216
|
"shouldReturnPackageForReprocess" to processParams.shouldReturnPackageForReprocess,
|
|
208
217
|
"disablePerforationOCR" to processParams.disablePerforationOCR,
|
|
209
218
|
"respectImageQuality" to processParams.respectImageQuality,
|
|
219
|
+
"strictImageQuality" to processParams.strictImageQuality,
|
|
210
220
|
"splitNames" to processParams.splitNames,
|
|
211
221
|
"doDetectCan" to processParams.doDetectCan,
|
|
212
222
|
"useFaceApi" to processParams.useFaceApi,
|
|
213
223
|
"useAuthenticityCheck" to processParams.useAuthenticityCheck,
|
|
214
224
|
"checkHologram" to processParams.checkHologram,
|
|
215
225
|
"generateNumericCodes" to processParams.generateNumericCodes,
|
|
226
|
+
"strictBarcodeDigitalSignatureCheck" to processParams.strictBarcodeDigitalSignatureCheck,
|
|
227
|
+
"selectLongestNames" to processParams.selectLongestNames,
|
|
228
|
+
"generateDTCVC" to processParams.generateDTCVC,
|
|
229
|
+
"strictDLCategoryExpiry" to processParams.strictDLCategoryExpiry,
|
|
216
230
|
"measureSystem" to processParams.measureSystem,
|
|
217
231
|
"barcodeParserType" to processParams.barcodeParserType,
|
|
218
232
|
"perspectiveAngle" to processParams.perspectiveAngle,
|
|
@@ -231,7 +245,6 @@ fun getProcessParams(processParams: ProcessParam) = mapOf(
|
|
|
231
245
|
"dateFormat" to processParams.dateFormat,
|
|
232
246
|
"scenario" to processParams.scenario,
|
|
233
247
|
"captureButtonScenario" to processParams.captureButtonScenario,
|
|
234
|
-
"sessionLogFolder" to processParams.sessionLogFolder,
|
|
235
248
|
"timeout" to processParams.timeout,
|
|
236
249
|
"timeoutFromFirstDetect" to processParams.timeoutFromFirstDetect,
|
|
237
250
|
"timeoutFromFirstDocType" to processParams.timeoutFromFirstDocType,
|
|
@@ -278,6 +291,7 @@ fun setCustomization(customization: ParamsCustomization, opts: JSONObject, conte
|
|
|
278
291
|
"activityIndicatorColor" -> editor.setActivityIndicatorColor(v.toColor())
|
|
279
292
|
"statusBackgroundColor" -> editor.setStatusBackgroundColor(v.toColor())
|
|
280
293
|
"cameraPreviewBackgroundColor" -> editor.setCameraPreviewBackgroundColor(v.toColor())
|
|
294
|
+
"backgroundMaskColor" -> editor.setBackgroundMaskColor(v.toColor())
|
|
281
295
|
"statusPositionMultiplier" -> editor.setStatusPositionMultiplier(v.toFloat())
|
|
282
296
|
"resultStatusPositionMultiplier" -> editor.setResultStatusPositionMultiplier(v.toFloat())
|
|
283
297
|
"toolbarSize" -> editor.setToolbarSize(v.toFloat())
|
|
@@ -288,6 +302,8 @@ fun setCustomization(customization: ParamsCustomization, opts: JSONObject, conte
|
|
|
288
302
|
"cameraFramePortraitAspectRatio" -> editor.setCameraFramePortraitAspectRatio(v.toFloat())
|
|
289
303
|
"cameraFrameCornerRadius" -> editor.setCameraFrameCornerRadius(v.toFloat())
|
|
290
304
|
"livenessAnimationPositionMultiplier" -> editor.setLivenessAnimationPositionMultiplier(v.toFloat())
|
|
305
|
+
"nextPageAnimationStartDelay" -> editor.setNextPageAnimationStartDelay(v.toFloat())
|
|
306
|
+
"nextPageAnimationEndDelay" -> editor.setNextPageAnimationEndDelay(v.toFloat())
|
|
291
307
|
"multipageAnimationFrontImage" -> editor.setMultipageAnimationFrontImage(v.toDrawable(context))
|
|
292
308
|
"multipageAnimationBackImage" -> editor.setMultipageAnimationBackImage(v.toDrawable(context))
|
|
293
309
|
"borderBackgroundImage" -> editor.setBorderBackgroundImage(v.toDrawable(context))
|
|
@@ -349,6 +365,7 @@ fun getCustomization(customization: ParamsCustomization) = mapOf(
|
|
|
349
365
|
"activityIndicatorColor" to customization.activityIndicatorColor.toLong(),
|
|
350
366
|
"statusBackgroundColor" to customization.statusBackgroundColor.toLong(),
|
|
351
367
|
"cameraPreviewBackgroundColor" to customization.cameraPreviewBackgroundColor.toLong(),
|
|
368
|
+
"backgroundMaskColor" to customization.backgroundMaskColor.toLong(),
|
|
352
369
|
"statusPositionMultiplier" to customization.statusPositionMultiplier,
|
|
353
370
|
"resultStatusPositionMultiplier" to customization.resultStatusPositionMultiplier,
|
|
354
371
|
"backgroundMaskAlpha" to customization.backgroundMaskAlpha,
|
|
@@ -359,6 +376,8 @@ fun getCustomization(customization: ParamsCustomization) = mapOf(
|
|
|
359
376
|
"cameraFramePortraitAspectRatio" to customization.cameraFramePortraitAspectRatio,
|
|
360
377
|
"cameraFrameCornerRadius" to customization.cameraFrameCornerRadius,
|
|
361
378
|
"livenessAnimationPositionMultiplier" to customization.livenessAnimationPositionMultiplier,
|
|
379
|
+
"nextPageAnimationStartDelay" to customization.nextPageAnimationStartDelay,
|
|
380
|
+
"nextPageAnimationEndDelay" to customization.nextPageAnimationEndDelay,
|
|
362
381
|
"multipageAnimationFrontImage" to customization.multipageAnimationFrontImage.toString(),
|
|
363
382
|
"multipageAnimationBackImage" to customization.multipageAnimationBackImage.toString(),
|
|
364
383
|
"borderBackgroundImage" to customization.borderBackgroundImage.toString(),
|
|
@@ -422,6 +441,10 @@ fun setRfidScenario(rfidScenario: RfidScenario, opts: JSONObject) = opts.forEach
|
|
|
422
441
|
"applyAmendments" -> rfidScenario.isApplyAmendments = v as Boolean
|
|
423
442
|
"autoSettings" -> rfidScenario.isAutoSettings = v as Boolean
|
|
424
443
|
"proceedReadingAlways" -> rfidScenario.proceedReadingAlways = v as Boolean
|
|
444
|
+
"readDTC" -> rfidScenario.isReadDTC = v as Boolean
|
|
445
|
+
"mrzStrictCheck" -> rfidScenario.isMrzStrictCheck = v as Boolean
|
|
446
|
+
"loadCRLFromRemote" -> rfidScenario.isLoadCRLFromRemote = v as Boolean
|
|
447
|
+
"independentSODStatus" -> rfidScenario.isIndependentSODStatus = v as Boolean
|
|
425
448
|
"signManagementAction" -> rfidScenario.signManagementAction = v.toInt()
|
|
426
449
|
"readingBuffer" -> rfidScenario.readingBuffer = v.toInt()
|
|
427
450
|
"onlineTAToSignDataType" -> rfidScenario.onlineTAToSignDataType = v.toInt()
|
|
@@ -437,9 +460,11 @@ fun setRfidScenario(rfidScenario: RfidScenario, opts: JSONObject) = opts.forEach
|
|
|
437
460
|
"mrz" -> rfidScenario.mrz = v as String
|
|
438
461
|
"eSignPINDefault" -> rfidScenario.seteSignPINDefault(v as String)
|
|
439
462
|
"eSignPINNewValue" -> rfidScenario.seteSignPINNewValue(v as String)
|
|
463
|
+
"cardAccess" -> rfidScenario.cardAccess = v as String
|
|
440
464
|
"ePassportDataGroups" -> setDataGroups(rfidScenario.ePassportDataGroups(), v as JSONObject)
|
|
441
465
|
"eIDDataGroups" -> setDataGroups(rfidScenario.eIDDataGroups(), v as JSONObject)
|
|
442
466
|
"eDLDataGroups" -> setDataGroups(rfidScenario.eDLDataGroups(), v as JSONObject)
|
|
467
|
+
"dtcDataGroups" -> setDTCDataGroup(rfidScenario.DTCDataGroup(), v as JSONObject)
|
|
443
468
|
}
|
|
444
469
|
}
|
|
445
470
|
|
|
@@ -478,6 +503,10 @@ fun getRfidScenario(rfidScenario: RfidScenario) = mapOf(
|
|
|
478
503
|
"applyAmendments" to rfidScenario.isApplyAmendments,
|
|
479
504
|
"autoSettings" to rfidScenario.isAutoSettings,
|
|
480
505
|
"proceedReadingAlways" to rfidScenario.proceedReadingAlways,
|
|
506
|
+
"readDTC" to rfidScenario.isReadDTC,
|
|
507
|
+
"mrzStrictCheck" to rfidScenario.isMrzStrictCheck,
|
|
508
|
+
"loadCRLFromRemote" to rfidScenario.isLoadCRLFromRemote,
|
|
509
|
+
"independentSODStatus" to rfidScenario.isIndependentSODStatus,
|
|
481
510
|
"signManagementAction" to rfidScenario.signManagementAction,
|
|
482
511
|
"readingBuffer" to rfidScenario.readingBuffer,
|
|
483
512
|
"onlineTAToSignDataType" to rfidScenario.onlineTAToSignDataType,
|
|
@@ -493,9 +522,11 @@ fun getRfidScenario(rfidScenario: RfidScenario) = mapOf(
|
|
|
493
522
|
"mrz" to rfidScenario.mrz,
|
|
494
523
|
"eSignPINDefault" to rfidScenario.geteSignPINDefault(),
|
|
495
524
|
"eSignPINNewValue" to rfidScenario.geteSignPINNewValue(),
|
|
525
|
+
"cardAccess" to rfidScenario.cardAccess,
|
|
496
526
|
"ePassportDataGroups" to getDataGroups(rfidScenario.ePassportDataGroups()),
|
|
497
527
|
"eIDDataGroups" to getDataGroups(rfidScenario.eIDDataGroups()),
|
|
498
|
-
"eDLDataGroups" to getDataGroups(rfidScenario.eDLDataGroups())
|
|
528
|
+
"eDLDataGroups" to getDataGroups(rfidScenario.eDLDataGroups()),
|
|
529
|
+
"dtcDataGroups" to getDTCDataGroup(rfidScenario.DTCDataGroup())
|
|
499
530
|
).toJsonObject()
|
|
500
531
|
|
|
501
532
|
fun setDataGroups(dataGroup: DataGroups, opts: JSONObject) = opts.forEach { k, v ->
|
|
@@ -564,6 +595,25 @@ fun getDataGroups(dataGroup: DataGroups): JSONObject {
|
|
|
564
595
|
return result.toJsonObject()
|
|
565
596
|
}
|
|
566
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
|
+
|
|
567
617
|
fun setImageQA(input: ImageQA, opts: JSONObject) = opts.forEach { k, v ->
|
|
568
618
|
when (k) {
|
|
569
619
|
"focusCheck" -> input.focusCheck = v as Boolean
|
|
@@ -576,6 +626,7 @@ fun setImageQA(input: ImageQA, opts: JSONObject) = opts.forEach { k, v ->
|
|
|
576
626
|
"brightnessThreshold" -> input.brightnessThreshold = v.toDouble()
|
|
577
627
|
"expectedPass" -> input.expectedPass = v.toIntArray()
|
|
578
628
|
"glaresCheckParams" -> input.glaresCheckParams = glaresCheckParamsFromJSON(v as JSONObject)
|
|
629
|
+
"occlusionCheck" -> input.occlusionCheck = v as Boolean
|
|
579
630
|
}
|
|
580
631
|
}
|
|
581
632
|
|
|
@@ -590,6 +641,7 @@ fun getImageQA(input: ImageQA) = mapOf(
|
|
|
590
641
|
"brightnessThreshold" to input.brightnessThreshold,
|
|
591
642
|
"expectedPass" to input.expectedPass.generate(),
|
|
592
643
|
"glaresCheckParams" to generateGlaresCheckParams(input.glaresCheckParams),
|
|
644
|
+
"occlusionCheck" to input.occlusionCheck,
|
|
593
645
|
).toJsonObject()
|
|
594
646
|
|
|
595
647
|
fun setAuthenticityParams(input: AuthenticityParams, opts: JSONObject) = opts.forEach { k, v ->
|
|
@@ -608,6 +660,7 @@ fun setAuthenticityParams(input: AuthenticityParams, opts: JSONObject) = opts.fo
|
|
|
608
660
|
"checkPhotoEmbedding" -> input.checkPhotoEmbedding = v as Boolean
|
|
609
661
|
"checkPhotoComparison" -> input.checkPhotoComparison = v as Boolean
|
|
610
662
|
"checkLetterScreen" -> input.checkLetterScreen = v as Boolean
|
|
663
|
+
"checkSecurityText" -> input.checkSecurityText = v as Boolean
|
|
611
664
|
"livenessParams" -> {
|
|
612
665
|
if (input.livenessParams == null) input.livenessParams = LivenessParams.defaultParams()
|
|
613
666
|
setLivenessParams(input.livenessParams!!, v as JSONObject)
|
|
@@ -631,6 +684,7 @@ fun getAuthenticityParams(input: AuthenticityParams?) = input?.let {
|
|
|
631
684
|
"checkPhotoEmbedding" to it.checkPhotoEmbedding,
|
|
632
685
|
"checkPhotoComparison" to it.checkPhotoComparison,
|
|
633
686
|
"checkLetterScreen" to it.checkLetterScreen,
|
|
687
|
+
"checkSecurityText" to it.checkSecurityText,
|
|
634
688
|
"livenessParams" to getLivenessParams(it.livenessParams)
|
|
635
689
|
).toJsonObject()
|
|
636
690
|
}
|
|
@@ -641,6 +695,8 @@ fun setLivenessParams(input: LivenessParams, opts: JSONObject) = opts.forEach {
|
|
|
641
695
|
"checkMLI" -> input.checkMLI = v as Boolean
|
|
642
696
|
"checkHolo" -> input.checkHolo = v as Boolean
|
|
643
697
|
"checkED" -> input.checkED = v as Boolean
|
|
698
|
+
"checkBlackAndWhiteCopy" -> input.checkBlackAndWhiteCopy = v as Boolean
|
|
699
|
+
"checkDynaprint" -> input.checkDynaprint = v as Boolean
|
|
644
700
|
}
|
|
645
701
|
}
|
|
646
702
|
|
|
@@ -649,7 +705,9 @@ fun getLivenessParams(input: LivenessParams?) = input?.let {
|
|
|
649
705
|
"checkOVI" to input.checkOVI,
|
|
650
706
|
"checkMLI" to input.checkMLI,
|
|
651
707
|
"checkHolo" to input.checkHolo,
|
|
652
|
-
"checkED" to input.checkED
|
|
708
|
+
"checkED" to input.checkED,
|
|
709
|
+
"checkBlackAndWhiteCopy" to input.checkBlackAndWhiteCopy,
|
|
710
|
+
"checkDynaprint" to input.checkDynaprint,
|
|
653
711
|
).toJsonObject()
|
|
654
712
|
}
|
|
655
713
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
package cordova.plugin.documentreader
|
|
2
2
|
|
|
3
|
-
import android.annotation.SuppressLint
|
|
4
3
|
import android.app.Activity
|
|
5
4
|
import android.app.PendingIntent
|
|
5
|
+
import android.content.Context
|
|
6
6
|
import android.content.Intent
|
|
7
7
|
import android.content.IntentFilter
|
|
8
8
|
import android.nfc.NfcAdapter
|
|
@@ -47,14 +47,16 @@ import org.apache.cordova.PluginResult
|
|
|
47
47
|
import org.json.JSONArray
|
|
48
48
|
import org.json.JSONObject
|
|
49
49
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
50
|
+
lateinit var callbackContext: CallbackContext
|
|
51
|
+
|
|
52
|
+
lateinit var args: JSONArray
|
|
53
|
+
lateinit var binding: CordovaPlugin
|
|
54
|
+
val context: Context
|
|
55
|
+
get() = binding.cordova.context
|
|
56
|
+
val activity: Activity
|
|
57
|
+
get() = binding.cordova.activity
|
|
58
|
+
val lifecycle: Lifecycle
|
|
59
|
+
get() = (activity as AppCompatActivity).lifecycle
|
|
58
60
|
|
|
59
61
|
fun sendEvent(event: String, data: Any? = "") {
|
|
60
62
|
// These events are not working in cordova and ionic because they don't have a method
|
|
@@ -82,10 +84,34 @@ fun <T> argsNullable(index: Int): T? = if (args.get(index).toString() != "null")
|
|
|
82
84
|
args.get(index) as T
|
|
83
85
|
} else null
|
|
84
86
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
87
|
+
class DocumentReader : CordovaPlugin() {
|
|
88
|
+
init {
|
|
89
|
+
binding = this
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
override fun onNewIntent(intent: Intent) {
|
|
93
|
+
newIntent(intent)
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
override fun onActivityResult(requestCode: Int, resultCode: Int, intent: Intent?) {
|
|
97
|
+
myOnActivityResult(requestCode, resultCode, intent)
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
@Suppress("OVERRIDE_DEPRECATION")
|
|
101
|
+
override fun onRequestPermissionResult(requestCode: Int, permissions: Array<String>, grantResults: IntArray) {
|
|
102
|
+
myOnRequestPermissionsResult(requestCode, permissions, grantResults)
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
override fun execute(action: String, args: JSONArray, callbackContext: CallbackContext): Boolean {
|
|
106
|
+
exec(args, callbackContext)
|
|
107
|
+
return true
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
fun requestPermissions(@Suppress("UNUSED_PARAMETER") activity: Activity, permissions: Array<String>, requestCode: Int) = binding.cordova.requestPermissions(binding, requestCode, permissions)
|
|
112
|
+
fun startActivityForResult(@Suppress("UNUSED_PARAMETER") activity: Activity, intent: Intent, requestCode: Int) = binding.cordova.startActivityForResult(binding, intent, requestCode)
|
|
113
|
+
fun myOnRequestPermissionsResult(requestCode: Int, permissions: Array<String>, grantResults: IntArray) = onRequestPermissionsResult(requestCode, permissions, grantResults)
|
|
114
|
+
fun myOnActivityResult(requestCode: Int, resultCode: Int, intent: Intent?) = onActivityResult(requestCode, resultCode, intent)
|
|
89
115
|
|
|
90
116
|
fun exec(arguments: JSONArray, tempContext: CallbackContext) {
|
|
91
117
|
args = arguments
|
|
@@ -98,8 +124,6 @@ fun exec(arguments: JSONArray, tempContext: CallbackContext) {
|
|
|
98
124
|
when (action) {
|
|
99
125
|
"getDocumentReaderIsReady" -> getDocumentReaderIsReady(callback)
|
|
100
126
|
"getDocumentReaderStatus" -> getDocumentReaderStatus(callback)
|
|
101
|
-
"isAuthenticatorAvailableForUse" -> isAuthenticatorAvailableForUse(callback)
|
|
102
|
-
"isBlePermissionsGranted" -> isBlePermissionsGranted(callback)
|
|
103
127
|
"getRfidSessionStatus" -> getRfidSessionStatus(callback)
|
|
104
128
|
"setRfidSessionStatus" -> setRfidSessionStatus(callback)
|
|
105
129
|
"getTag" -> getTag(callback)
|
|
@@ -139,11 +163,13 @@ fun exec(arguments: JSONArray, tempContext: CallbackContext) {
|
|
|
139
163
|
"addPKDCertificates" -> addPKDCertificates(callback, args(0))
|
|
140
164
|
"clearPKDCertificates" -> clearPKDCertificates(callback)
|
|
141
165
|
"startNewSession" -> startNewSession(callback)
|
|
142
|
-
"
|
|
166
|
+
"connectBluetoothDevice" -> connectBluetoothDevice(callback)
|
|
143
167
|
"setLocalizationDictionary" -> setLocalizationDictionary(args(0))
|
|
144
168
|
"getLicense" -> getLicense(callback)
|
|
145
169
|
"getAvailableScenarios" -> getAvailableScenarios(callback)
|
|
146
170
|
"getIsRFIDAvailableForUse" -> getIsRFIDAvailableForUse(callback)
|
|
171
|
+
"isAuthenticatorAvailableForUse" -> isAuthenticatorAvailableForUse(callback)
|
|
172
|
+
"isAuthenticatorRFIDAvailableForUse" -> isAuthenticatorRFIDAvailableForUse(callback)
|
|
147
173
|
"getDocReaderVersion" -> getDocReaderVersion(callback)
|
|
148
174
|
"getDocReaderDocumentsDatabase" -> getDocReaderDocumentsDatabase(callback)
|
|
149
175
|
"textFieldValueByType" -> textFieldValueByType(callback, args(0), args(1))
|
|
@@ -164,6 +190,7 @@ fun exec(arguments: JSONArray, tempContext: CallbackContext) {
|
|
|
164
190
|
"containers" -> containers(callback, args(0), args(1))
|
|
165
191
|
"encryptedContainers" -> encryptedContainers(callback, args(0))
|
|
166
192
|
"finalizePackage" -> finalizePackage(callback)
|
|
193
|
+
"endBackendTransaction" -> endBackendTransaction(callback)
|
|
167
194
|
"getTranslation" -> getTranslation(callback, args(0), args(1))
|
|
168
195
|
}
|
|
169
196
|
}
|
|
@@ -174,14 +201,6 @@ interface Callback {
|
|
|
174
201
|
fun error(message: String)
|
|
175
202
|
}
|
|
176
203
|
|
|
177
|
-
@SuppressLint("StaticFieldLeak")
|
|
178
|
-
lateinit var activity: Activity
|
|
179
|
-
lateinit var lifecycleObserver: LifecycleEventObserver
|
|
180
|
-
val context
|
|
181
|
-
get() = activity
|
|
182
|
-
|
|
183
|
-
var backgroundRFIDEnabled = false
|
|
184
|
-
|
|
185
204
|
const val eventCompletion = "completion"
|
|
186
205
|
const val eventDatabaseProgress = "database_progress"
|
|
187
206
|
|
|
@@ -193,10 +212,6 @@ const val eventPACertificateCompletion = "pa_certificate_completion"
|
|
|
193
212
|
const val eventTACertificateCompletion = "ta_certificate_completion"
|
|
194
213
|
const val eventTASignatureCompletion = "ta_signature_completion"
|
|
195
214
|
|
|
196
|
-
const val bleOnServiceConnectedEvent = "bleOnServiceConnectedEvent"
|
|
197
|
-
const val bleOnServiceDisconnectedEvent = "bleOnServiceDisconnectedEvent"
|
|
198
|
-
const val bleOnDeviceReadyEvent = "bleOnDeviceReadyEvent"
|
|
199
|
-
|
|
200
215
|
const val eventVideoEncoderCompletion = "video_encoder_completion"
|
|
201
216
|
const val onCustomButtonTappedEvent = "onCustomButtonTappedEvent"
|
|
202
217
|
|
|
@@ -204,10 +219,6 @@ fun getDocumentReaderIsReady(callback: Callback) = callback.success(Instance().i
|
|
|
204
219
|
|
|
205
220
|
fun getDocumentReaderStatus(callback: Callback) = callback.success(Instance().status)
|
|
206
221
|
|
|
207
|
-
fun isAuthenticatorAvailableForUse(callback: Callback) = callback.success(Instance().isAuthenticatorAvailableForUse)
|
|
208
|
-
|
|
209
|
-
fun isBlePermissionsGranted(callback: Callback) = callback.success(isBlePermissionsGranted((activity)))
|
|
210
|
-
|
|
211
222
|
fun getRfidSessionStatus(callback: Callback) = callback.error("getRfidSessionStatus() is an ios-only method")
|
|
212
223
|
|
|
213
224
|
fun setRfidSessionStatus(callback: Callback) = callback.error("setRfidSessionStatus() is an ios-only method")
|
|
@@ -342,13 +353,6 @@ fun startNewSession(callback: Callback) {
|
|
|
342
353
|
callback.success()
|
|
343
354
|
}
|
|
344
355
|
|
|
345
|
-
fun startBluetoothService() = startBluetoothService(
|
|
346
|
-
activity,
|
|
347
|
-
{ sendEvent(bleOnServiceConnectedEvent, it) },
|
|
348
|
-
{ sendEvent(bleOnServiceDisconnectedEvent) },
|
|
349
|
-
{ sendEvent(bleOnDeviceReadyEvent) }
|
|
350
|
-
)
|
|
351
|
-
|
|
352
356
|
fun setLocalizationDictionary(dictionary: JSONObject) {
|
|
353
357
|
localizationCallbacks = LocalizationCallbacks { if (dictionary.has(it)) dictionary.getString(it) else null }
|
|
354
358
|
Instance().setLocalizationCallback(localizationCallbacks!!)
|
|
@@ -365,6 +369,10 @@ fun getAvailableScenarios(callback: Callback) {
|
|
|
365
369
|
|
|
366
370
|
fun getIsRFIDAvailableForUse(callback: Callback) = callback.success(Instance().isRFIDAvailableForUse)
|
|
367
371
|
|
|
372
|
+
fun isAuthenticatorAvailableForUse(callback: Callback) = callback.success(Instance().isAuthenticatorAvailableForUse)
|
|
373
|
+
|
|
374
|
+
fun isAuthenticatorRFIDAvailableForUse(callback: Callback) = callback.success(Instance().isAuthenticatorRFIDAvailableForUse)
|
|
375
|
+
|
|
368
376
|
fun getDocReaderVersion(callback: Callback) = callback.success(generateDocReaderVersion(Instance().version))
|
|
369
377
|
|
|
370
378
|
fun getDocReaderDocumentsDatabase(callback: Callback) = callback.success(Instance().version?.let { generateDocReaderDocumentsDatabase(it.database) })
|
|
@@ -405,6 +413,11 @@ fun encryptedContainers(callback: Callback, raw: String) = callback.success(from
|
|
|
405
413
|
|
|
406
414
|
fun finalizePackage(callback: Callback) = Instance().finalizePackage { action, info, error -> callback.success(generateFinalizePackageCompletion(action, info, error)) }
|
|
407
415
|
|
|
416
|
+
fun endBackendTransaction(callback: Callback) {
|
|
417
|
+
Instance().endBackendTransaction()
|
|
418
|
+
callback.success()
|
|
419
|
+
}
|
|
420
|
+
|
|
408
421
|
fun getTranslation(callback: Callback, className: String, value: Int) = when (className) {
|
|
409
422
|
"RFIDErrorCodes" -> callback.success(eRFID_ErrorCodes.getTranslation(context, value))
|
|
410
423
|
"LDSParsingErrorCodes" -> callback.success(eLDS_ParsingErrorCodes.getTranslation(context, value))
|
|
@@ -485,12 +498,18 @@ var requestType = RfidReaderRequestType(
|
|
|
485
498
|
)
|
|
486
499
|
|
|
487
500
|
@Suppress("DEPRECATION")
|
|
488
|
-
fun newIntent(intent: Intent)
|
|
501
|
+
fun newIntent(intent: Intent): Boolean {
|
|
502
|
+
if (intent.action != NfcAdapter.ACTION_TECH_DISCOVERED) return false
|
|
489
503
|
Instance().readRFID(
|
|
490
504
|
IsoDep.get(intent.getParcelableExtra(NfcAdapter.EXTRA_TAG)),
|
|
491
505
|
rfidReaderCompletion,
|
|
492
506
|
requestType.getRfidReaderRequest()
|
|
493
|
-
)
|
|
507
|
+
)
|
|
508
|
+
return true
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
var backgroundRFIDEnabled = false
|
|
512
|
+
lateinit var lifecycleObserver: LifecycleEventObserver
|
|
494
513
|
|
|
495
514
|
fun startForegroundDispatch() {
|
|
496
515
|
backgroundRFIDEnabled = true
|
|
@@ -499,9 +518,9 @@ fun startForegroundDispatch() {
|
|
|
499
518
|
filters[0]!!.addAction(NfcAdapter.ACTION_TECH_DISCOVERED)
|
|
500
519
|
filters[0]!!.addCategory(Intent.CATEGORY_DEFAULT)
|
|
501
520
|
val techList = arrayOf(arrayOf("android.nfc.tech.IsoDep"))
|
|
502
|
-
val intent = Intent(
|
|
521
|
+
val intent = Intent(activity, activity.javaClass)
|
|
503
522
|
val flag = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) PendingIntent.FLAG_MUTABLE else 0
|
|
504
|
-
val pendingIntent = PendingIntent.getActivity(
|
|
523
|
+
val pendingIntent = PendingIntent.getActivity(activity, 0, intent, flag)
|
|
505
524
|
|
|
506
525
|
if (lifecycle.currentState.isAtLeast(Lifecycle.State.RESUMED))
|
|
507
526
|
enableForegroundDispatch(pendingIntent, filters, techList)
|
|
@@ -512,7 +531,7 @@ fun startForegroundDispatch() {
|
|
|
512
531
|
else -> Unit
|
|
513
532
|
}
|
|
514
533
|
}
|
|
515
|
-
|
|
534
|
+
activity.runOnUiThread { lifecycle.addObserver(lifecycleObserver) }
|
|
516
535
|
}
|
|
517
536
|
|
|
518
537
|
fun enableForegroundDispatch(
|
|
@@ -521,15 +540,15 @@ fun enableForegroundDispatch(
|
|
|
521
540
|
techList: Array<Array<String>>
|
|
522
541
|
) = NfcAdapter.getDefaultAdapter(context).enableForegroundDispatch(activity, pendingIntent, filters, techList)
|
|
523
542
|
|
|
524
|
-
fun disableForegroundDispatch() = NfcAdapter.getDefaultAdapter(
|
|
543
|
+
fun disableForegroundDispatch() = NfcAdapter.getDefaultAdapter(context).disableForegroundDispatch(activity)
|
|
525
544
|
|
|
526
545
|
fun stopBackgroundRFID() {
|
|
527
546
|
if (!backgroundRFIDEnabled) return
|
|
528
547
|
backgroundRFIDEnabled = false
|
|
529
548
|
if (lifecycle.currentState.isAtLeast(Lifecycle.State.RESUMED))
|
|
530
549
|
disableForegroundDispatch()
|
|
531
|
-
|
|
550
|
+
activity.runOnUiThread { lifecycle.removeObserver(lifecycleObserver) }
|
|
532
551
|
}
|
|
533
552
|
|
|
534
553
|
// Weak references
|
|
535
|
-
var localizationCallbacks: LocalizationCallbacks? = null
|
|
554
|
+
var localizationCallbacks: LocalizationCallbacks? = null
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//
|
|
2
|
-
// JSONConstructor.
|
|
2
|
+
// JSONConstructor.kt
|
|
3
3
|
// DocumentReader
|
|
4
4
|
//
|
|
5
5
|
// Created by Pavel Masiuk on 21.09.2023.
|
|
@@ -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
|
|
@@ -46,6 +47,7 @@ import com.regula.documentreader.api.params.rfid.TccParams
|
|
|
46
47
|
import com.regula.documentreader.api.params.rfid.authorization.PAAttribute
|
|
47
48
|
import com.regula.documentreader.api.params.rfid.authorization.PAResourcesIssuer
|
|
48
49
|
import com.regula.documentreader.api.params.rfid.authorization.TAChallenge
|
|
50
|
+
import com.regula.documentreader.api.params.rfid.dg.DTCDataGroup
|
|
49
51
|
import com.regula.documentreader.api.params.rfid.dg.EDLDataGroups
|
|
50
52
|
import com.regula.documentreader.api.params.rfid.dg.EIDDataGroups
|
|
51
53
|
import com.regula.documentreader.api.params.rfid.dg.EPassportDataGroups
|
|
@@ -105,6 +107,8 @@ import cordova.plugin.documentreader.Convert.generateByteArray
|
|
|
105
107
|
import org.json.JSONArray
|
|
106
108
|
import org.json.JSONObject
|
|
107
109
|
|
|
110
|
+
val weakReferencesHolder = mutableListOf<Any>()
|
|
111
|
+
|
|
108
112
|
fun generateCompletion(action: Int, results: DocumentReaderResults?, error: RegulaException?, context: Context?) = object : JSONObject() { init {
|
|
109
113
|
put("action", action)
|
|
110
114
|
if (listOf(
|
|
@@ -174,6 +178,7 @@ fun transactionInfoFromJSON(temp: JSONObject?): TransactionInfo? {
|
|
|
174
178
|
|
|
175
179
|
if (input.has("transactionId")) result.transactionId = input.getString("transactionId")
|
|
176
180
|
if (input.has("tag")) result.tag = input.getString("tag")
|
|
181
|
+
if (input.has("sessionLogFolder")) result.sessionLogFolder = input.getString("sessionLogFolder")
|
|
177
182
|
|
|
178
183
|
return result
|
|
179
184
|
}
|
|
@@ -185,6 +190,7 @@ fun generateTransactionInfo(temp: TransactionInfo?): JSONObject? {
|
|
|
185
190
|
|
|
186
191
|
result.put("transactionId", input.transactionId)
|
|
187
192
|
result.put("tag", input.tag)
|
|
193
|
+
result.put("sessionLogFolder", input.sessionLogFolder)
|
|
188
194
|
|
|
189
195
|
return result
|
|
190
196
|
}
|
|
@@ -243,6 +249,17 @@ fun generateDocReaderConfig(temp: DocReaderConfig?): JSONObject? {
|
|
|
243
249
|
return result
|
|
244
250
|
}
|
|
245
251
|
|
|
252
|
+
fun bleDeviceConfigFromJSON(input: JSONObject): BleDeviceConfig {
|
|
253
|
+
var result = BleDeviceConfig(bluetooth)
|
|
254
|
+
|
|
255
|
+
if (input.has("customDb")) result = BleDeviceConfig(bluetooth, byteArrayFromBase64(input.getString("customDb")))
|
|
256
|
+
if (input.has("licenseUpdate")) result.setLicenseUpdate(input.getBoolean("licenseUpdate"))
|
|
257
|
+
if (input.has("delayedNNLoad")) result.isDelayedNNLoad = input.getBoolean("delayedNNLoad")
|
|
258
|
+
if (input.has("blackList")) result.blackList = input.getJSONObject("blackList")
|
|
259
|
+
|
|
260
|
+
return result
|
|
261
|
+
}
|
|
262
|
+
|
|
246
263
|
fun scannerConfigFromJSON(input: JSONObject): ScannerConfig {
|
|
247
264
|
val builder = if (input.has("scenario")) ScannerConfig.Builder(input.getString("scenario"))
|
|
248
265
|
else ScannerConfig.Builder(onlineProcessingConfigFromJSON(input.getJSONObject("onlineProcessingConfig"))!!)
|
|
@@ -274,6 +291,7 @@ fun recognizeConfigFromJSON(input: JSONObject): RecognizeConfig {
|
|
|
274
291
|
else RecognizeConfig.Builder(onlineProcessingConfigFromJSON(input.getJSONObject("onlineProcessingConfig"))!!)
|
|
275
292
|
|
|
276
293
|
if (input.has("oneShotIdentification")) builder.setOneShotIdentification(input.getBoolean("oneShotIdentification"))
|
|
294
|
+
if (input.has("dtc")) builder.setDTC(byteArrayFromBase64(input.getString("dtc"))!!)
|
|
277
295
|
if (input.has("livePortrait")) builder.setLivePortrait(bitmapFromBase64(input.getString("livePortrait"))!!)
|
|
278
296
|
if (input.has("extPortrait")) builder.setExtPortrait(bitmapFromBase64(input.getString("extPortrait"))!!)
|
|
279
297
|
if (input.has("image")) builder.setBitmap(bitmapFromBase64(input.getString("image"))!!)
|
|
@@ -302,6 +320,7 @@ fun generateRecognizeConfig(temp: RecognizeConfig?): JSONObject? {
|
|
|
302
320
|
result.put("scenario", input.scenario)
|
|
303
321
|
result.put("onlineProcessingConfig", generateOnlineProcessingConfig(input.onlineProcessingConfig))
|
|
304
322
|
result.put("oneShotIdentification", input.oneShotIdentification)
|
|
323
|
+
result.put("dtc", generateByteArray(input.dtc))
|
|
305
324
|
result.put("livePortrait", bitmapToBase64(input.livePortrait))
|
|
306
325
|
result.put("extPortrait", bitmapToBase64(input.extPortrait))
|
|
307
326
|
result.put("image", bitmapToBase64(input.bitmap))
|
|
@@ -325,6 +344,7 @@ fun backendProcessingConfigFromJSON(temp: JSONObject?): BackendProcessingConfig?
|
|
|
325
344
|
val result = BackendProcessingConfig(input.getString("url"))
|
|
326
345
|
if (input.has("httpHeaders")) result.httpHeaders = stringMapFromJson(input.getJSONObject("httpHeaders"))
|
|
327
346
|
if (input.has("rfidServerSideChipVerification")) result.rfidServerSideChipVerification = input.getBoolean("rfidServerSideChipVerification")
|
|
347
|
+
if (input.has("timeoutConnection")) result.timeoutConnection = input.getDouble("timeoutConnection")
|
|
328
348
|
|
|
329
349
|
return result
|
|
330
350
|
}
|
|
@@ -337,6 +357,7 @@ fun generateBackendProcessingConfig(temp: BackendProcessingConfig?): JSONObject?
|
|
|
337
357
|
result.put("url", input.url)
|
|
338
358
|
result.put("httpHeaders", generateStringMap(input.httpHeaders))
|
|
339
359
|
result.put("rfidServerSideChipVerification", input.rfidServerSideChipVerification)
|
|
360
|
+
result.put("timeoutConnection", input.timeoutConnection)
|
|
340
361
|
|
|
341
362
|
return result
|
|
342
363
|
}
|
|
@@ -350,6 +371,11 @@ fun onlineProcessingConfigFromJSON(temp: JSONObject?): OnlineProcessingConfig? {
|
|
|
350
371
|
if (input.has("url")) builder.setUrl(input.getString("url"))
|
|
351
372
|
if (input.has("imageCompressionQuality")) builder.setImageCompressionQuality(input.getDouble("imageCompressionQuality").toFloat())
|
|
352
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
|
+
}
|
|
353
379
|
|
|
354
380
|
return builder.build()
|
|
355
381
|
}
|
|
@@ -508,6 +534,14 @@ fun eIDDataGroupsFromJSON(input: JSONObject): EIDDataGroups {
|
|
|
508
534
|
|
|
509
535
|
fun generateEIDDataGroups(input: EIDDataGroups): JSONObject = getDataGroups(input)
|
|
510
536
|
|
|
537
|
+
fun dtcDataGroupFromJSON(input: JSONObject): DTCDataGroup {
|
|
538
|
+
val result = DTCDataGroup()
|
|
539
|
+
setDTCDataGroup(result, input)
|
|
540
|
+
return result
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
fun generateDTCDataGroup(input: DTCDataGroup): JSONObject = getDTCDataGroup(input)
|
|
544
|
+
|
|
511
545
|
fun rfidScenarioFromJSON(input: JSONObject): RfidScenario {
|
|
512
546
|
val result = RfidScenario()
|
|
513
547
|
setRfidScenario(result, input)
|
|
@@ -573,18 +607,6 @@ fun generateTypeface(temp: Typeface?, size: Int? = null): JSONObject? {
|
|
|
573
607
|
return result
|
|
574
608
|
}
|
|
575
609
|
|
|
576
|
-
fun bleDeviceConfigFromJSON(input: JSONObject): BleDeviceConfig {
|
|
577
|
-
val bleWrapper = bleManager
|
|
578
|
-
var result = BleDeviceConfig(bleWrapper)
|
|
579
|
-
|
|
580
|
-
if (input.has("customDb")) result = BleDeviceConfig(bleWrapper!!, byteArrayFromBase64(input.getString("customDb")))
|
|
581
|
-
if (input.has("licenseUpdate")) result.setLicenseUpdate(input.getBoolean("licenseUpdate"))
|
|
582
|
-
if (input.has("delayedNNLoad")) result.isDelayedNNLoad = input.getBoolean("delayedNNLoad")
|
|
583
|
-
if (input.has("blackList")) result.blackList = input.getJSONObject("blackList")
|
|
584
|
-
|
|
585
|
-
return result
|
|
586
|
-
}
|
|
587
|
-
|
|
588
610
|
fun imageInputDataFromJSON(temp: JSONObject?): ImageInputData? {
|
|
589
611
|
if (temp == null || !temp.has("image")) return null
|
|
590
612
|
val input: JSONObject = temp
|
|
@@ -1701,6 +1723,7 @@ fun generateDocumentReaderAuthenticityResult(temp: DocumentReaderAuthenticityRes
|
|
|
1701
1723
|
temp ?: return null
|
|
1702
1724
|
val input: DocumentReaderAuthenticityResult = temp
|
|
1703
1725
|
|
|
1726
|
+
@Suppress("DEPRECATION")
|
|
1704
1727
|
result.put("status", input.status)
|
|
1705
1728
|
result.put("checks", generateList(input.checks, ::generateDocumentReaderAuthenticityCheck, context))
|
|
1706
1729
|
|
|
@@ -2168,7 +2191,8 @@ fun documentReaderResultsFromJSON(temp: JSONObject?): DocumentReaderResults? {
|
|
|
2168
2191
|
result.documentType = listFromJSON(input.optJSONArray("documentType"), ::documentReaderDocumentTypeFromJSON)!!
|
|
2169
2192
|
result.status = documentReaderResultsStatusFromJSON(input.optJSONObject("status"))!!
|
|
2170
2193
|
result.vdsncData = vdsncDataFromJSON(input.optJSONObject("vdsncData")!!)
|
|
2171
|
-
result.
|
|
2194
|
+
result.dtcData = input.getString("dtcData")
|
|
2195
|
+
result.transactionInfo = transactionInfoFromJSON(input.optJSONObject("transactionInfo"))!!
|
|
2172
2196
|
|
|
2173
2197
|
return result
|
|
2174
2198
|
}
|
|
@@ -2196,6 +2220,7 @@ fun generateDocumentReaderResults(temp: DocumentReaderResults?, context: Context
|
|
|
2196
2220
|
result.put("documentType", generateList(input.documentType, ::generateDocumentReaderDocumentType))
|
|
2197
2221
|
result.put("status", generateDocumentReaderResultsStatus(input.status))
|
|
2198
2222
|
result.put("vdsncData", generateVDSNCData(input.vdsncData))
|
|
2223
|
+
result.put("dtcData", input.dtcData)
|
|
2199
2224
|
result.put("transactionInfo", generateTransactionInfo(input.transactionInfo))
|
|
2200
2225
|
|
|
2201
2226
|
return result
|
package/src/android/Utils.kt
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//
|
|
2
|
-
// Utils.
|
|
2
|
+
// Utils.kt
|
|
3
3
|
// DocumentReader
|
|
4
4
|
//
|
|
5
5
|
// Created by Pavel Masiuk on 21.09.2023.
|
|
@@ -225,7 +225,12 @@ fun CustomizationFont.setFont(editor: ParamsCustomization.CustomizationEditor, v
|
|
|
225
225
|
}
|
|
226
226
|
|
|
227
227
|
internal object Convert {
|
|
228
|
-
fun byteArrayFromBase64(base64: String?)
|
|
228
|
+
fun byteArrayFromBase64(base64: String?): ByteArray? {
|
|
229
|
+
var str = base64 ?: return null
|
|
230
|
+
if (str.startsWith("data")) str = str.substring(str.indexOf(",") + 1)
|
|
231
|
+
return Base64.decode(str, Base64.NO_WRAP)
|
|
232
|
+
}
|
|
233
|
+
|
|
229
234
|
fun generateByteArray(array: ByteArray?) = array?.let { Base64.encodeToString(it, Base64.NO_WRAP) }
|
|
230
235
|
|
|
231
236
|
fun bitmapFromBase64(base64: String?) = base64?.let {
|