@regulaforensics/cordova-plugin-document-reader-api 8.1.122-nightly → 8.1.131-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/example/config.xml +1 -1
- package/example/package.json +2 -2
- package/package.json +1 -1
- package/plugin.xml +11 -8
- package/src/android/BluetoothUtil.kt +7 -16
- package/src/android/Config.kt +154 -120
- package/src/android/DocumentReader.kt +20 -487
- package/src/android/JSONConstructor.kt +1270 -1719
- package/src/android/Main.kt +553 -0
- package/src/android/Utils.kt +73 -160
- package/src/android/build.gradle +1 -1
- package/src/ios/RGLWConfig.h +0 -8
- package/src/ios/RGLWConfig.m +44 -52
- package/src/ios/RGLWDocumentReader.h +3 -27
- package/src/ios/RGLWDocumentReader.m +11 -716
- package/src/ios/RGLWJSONConstructor.h +1 -8
- package/src/ios/RGLWJSONConstructor.m +12 -10
- package/src/ios/RGLWMain.h +36 -0
- package/src/ios/RGLWMain.m +591 -0
package/example/config.xml
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<?xml version='1.0' encoding='utf-8'?>
|
|
2
|
-
<widget android-packageName="com.regula.
|
|
2
|
+
<widget android-packageName="com.regula.dr.fullauthrfid" ios-CFBundleIdentifier="regula.DocumentReader" version="1.0.0" xmlns:android="http://schemas.android.com/apk/res/android" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
|
|
3
3
|
<name>DocumentReader</name>
|
|
4
4
|
<description>
|
|
5
5
|
A sample Regula Document Reader application for reading and validation of identification documents.
|
package/example/package.json
CHANGED
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
"author": "Regula Forensics Inc.",
|
|
14
14
|
"license": "commercial",
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@regulaforensics/cordova-plugin-document-reader-api": "8.1.
|
|
17
|
-
"@regulaforensics/cordova-plugin-document-reader-core-fullauthrfid": "8.1.
|
|
16
|
+
"@regulaforensics/cordova-plugin-document-reader-api": "8.1.131-nightly",
|
|
17
|
+
"@regulaforensics/cordova-plugin-document-reader-core-fullauthrfid": "8.1.323-nightly",
|
|
18
18
|
"cordova-android": "13.0.0",
|
|
19
19
|
"cordova-ios": "7.1.1",
|
|
20
20
|
"cordova-plugin-add-swift-support": "2.0.2",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@regulaforensics/cordova-plugin-document-reader-api",
|
|
3
|
-
"version": "8.1.
|
|
3
|
+
"version": "8.1.131-nightly",
|
|
4
4
|
"description": "Cordova plugin for reading and validation of identification documents (API framework)",
|
|
5
5
|
"cordova": {
|
|
6
6
|
"id": "@regulaforensics/cordova-plugin-document-reader-api",
|
package/plugin.xml
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<?xml version='1.0' encoding='utf-8'?>
|
|
2
|
-
<plugin id="@regulaforensics/cordova-plugin-document-reader-api" version="8.1.
|
|
2
|
+
<plugin id="@regulaforensics/cordova-plugin-document-reader-api" version="8.1.131-nightly" xmlns="http://apache.org/cordova/ns/plugins/1.0">
|
|
3
3
|
<name>DocumentReaderApi</name>
|
|
4
4
|
<description>Cordova plugin Document reader api</description>
|
|
5
5
|
<license>commercial</license>
|
|
@@ -22,12 +22,14 @@
|
|
|
22
22
|
<source-file src="src/ios/RGLWJSONConstructor.m" />
|
|
23
23
|
<header-file src="src/ios/RGLWConfig.h" />
|
|
24
24
|
<source-file src="src/ios/RGLWConfig.m" />
|
|
25
|
+
<header-file src="src/ios/RGLWMain.h" />
|
|
26
|
+
<source-file src="src/ios/RGLWMain.m" />
|
|
25
27
|
<podspec>
|
|
26
28
|
<config>
|
|
27
29
|
<source url="https://github.com/CocoaPods/Specs.git"/>
|
|
28
30
|
</config>
|
|
29
31
|
<pods>
|
|
30
|
-
<pod name="DocumentReaderNightly" spec="8.1.
|
|
32
|
+
<pod name="DocumentReaderNightly" spec="8.1.4653" />
|
|
31
33
|
</pods>
|
|
32
34
|
</podspec>
|
|
33
35
|
</platform>
|
|
@@ -36,14 +38,15 @@
|
|
|
36
38
|
<config-file parent="/*" target="res/xml/config.xml">
|
|
37
39
|
<preference name="GradlePluginKotlinEnabled" value="true" />
|
|
38
40
|
<feature name="DocumentReader">
|
|
39
|
-
<param name="android-package" value="
|
|
41
|
+
<param name="android-package" value="com.regula.plugin.documentreader.DocumentReader" />
|
|
40
42
|
</feature>
|
|
41
43
|
</config-file>
|
|
42
44
|
<framework src="src/android/build.gradle" custom="true" type="gradleReference" />
|
|
43
|
-
<source-file src="src/android/DocumentReader.kt" target-dir="java/
|
|
44
|
-
<source-file src="src/android/
|
|
45
|
-
<source-file src="src/android/
|
|
46
|
-
<source-file src="src/android/
|
|
47
|
-
<source-file src="src/android/
|
|
45
|
+
<source-file src="src/android/DocumentReader.kt" target-dir="java/com.regula.plugin.documentreader" />
|
|
46
|
+
<source-file src="src/android/Main.kt" target-dir="java/com.regula.plugin.documentreader" />
|
|
47
|
+
<source-file src="src/android/JSONConstructor.kt" target-dir="java/com.regula.plugin.documentreader" />
|
|
48
|
+
<source-file src="src/android/Config.kt" target-dir="java/com.regula.plugin.documentreader" />
|
|
49
|
+
<source-file src="src/android/Utils.kt" target-dir="java/com.regula.plugin.documentreader" />
|
|
50
|
+
<source-file src="src/android/BluetoothUtil.kt" target-dir="java/com.regula.plugin.documentreader" />
|
|
48
51
|
</platform>
|
|
49
52
|
</plugin>
|
|
@@ -1,13 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
// BluetoothUtil.kt
|
|
3
|
-
// DocumentReader
|
|
4
|
-
//
|
|
5
|
-
// Created by Pavel Masiuk on 21.09.2023.
|
|
6
|
-
// Copyright © 2023 Regula. All rights reserved.
|
|
7
|
-
//
|
|
8
|
-
@file:SuppressLint("MissingPermission")
|
|
9
|
-
|
|
10
|
-
package cordova.plugin.documentreader
|
|
1
|
+
package com.regula.plugin.documentreader
|
|
11
2
|
|
|
12
3
|
import android.Manifest.permission.ACCESS_FINE_LOCATION
|
|
13
4
|
import android.Manifest.permission.BLUETOOTH_CONNECT
|
|
@@ -45,7 +36,7 @@ lateinit var savedCallbackForPermissionResult: Callback
|
|
|
45
36
|
fun connectBluetoothDevice(callback: Callback) {
|
|
46
37
|
if (bluetooth?.isConnected == true) {
|
|
47
38
|
Log.e("REGULA", "Bluetooth device already connected, returning false")
|
|
48
|
-
callback
|
|
39
|
+
callback(false)
|
|
49
40
|
return
|
|
50
41
|
}
|
|
51
42
|
|
|
@@ -56,7 +47,7 @@ fun connectBluetoothDevice(callback: Callback) {
|
|
|
56
47
|
|
|
57
48
|
val timeout = object : TimerTask() {
|
|
58
49
|
override fun run() {
|
|
59
|
-
callback
|
|
50
|
+
callback(false)
|
|
60
51
|
bluetooth?.stopDeviceScan()
|
|
61
52
|
bluetooth?.disconnect()
|
|
62
53
|
}
|
|
@@ -68,12 +59,12 @@ fun connectBluetoothDevice(callback: Callback) {
|
|
|
68
59
|
context.bindService(bleIntent, object : ServiceConnection {
|
|
69
60
|
override fun onServiceConnected(name: ComponentName, service: IBinder) {
|
|
70
61
|
bluetooth = (service as RegulaBleService.LocalBinder).service.bleManager
|
|
71
|
-
if (bluetooth!!.isConnected) callback
|
|
62
|
+
if (bluetooth!!.isConnected) callback(true)
|
|
72
63
|
else bluetooth!!.addCallback(object : BleWrapperCallback() {
|
|
73
64
|
override fun onDeviceReady() {
|
|
74
65
|
timeout.cancel()
|
|
75
66
|
bluetooth!!.removeCallback(this)
|
|
76
|
-
callback
|
|
67
|
+
callback(true)
|
|
77
68
|
}
|
|
78
69
|
})
|
|
79
70
|
}
|
|
@@ -89,7 +80,7 @@ fun onRequestPermissionsResult(
|
|
|
89
80
|
): Boolean {
|
|
90
81
|
if (requestCode != BLE_ACCESS_PERMISSION || permissions.isEmpty()) return false
|
|
91
82
|
if (grantResults.isEmpty() || grantResults[0] != PERMISSION_GRANTED) {
|
|
92
|
-
savedCallbackForPermissionResult
|
|
83
|
+
savedCallbackForPermissionResult(false)
|
|
93
84
|
return true
|
|
94
85
|
}
|
|
95
86
|
connectBluetoothDevice(savedCallbackForPermissionResult)
|
|
@@ -106,7 +97,7 @@ fun onActivityResult(requestCode: Int, rc: Int, @Suppress("UNUSED_PARAMETER") da
|
|
|
106
97
|
if (resultCode == Activity.RESULT_OK)
|
|
107
98
|
connectBluetoothDevice(savedCallbackForPermissionResult)
|
|
108
99
|
else
|
|
109
|
-
savedCallbackForPermissionResult
|
|
100
|
+
savedCallbackForPermissionResult(false)
|
|
110
101
|
return true
|
|
111
102
|
}
|
|
112
103
|
return false
|
package/src/android/Config.kt
CHANGED
|
@@ -1,16 +1,7 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Config.kt
|
|
3
|
-
// DocumentReader
|
|
4
|
-
//
|
|
5
|
-
// Created by Pavel Masiuk on 21.09.2023.
|
|
6
|
-
// Copyright © 2023 Regula. All rights reserved.
|
|
7
|
-
//
|
|
8
|
-
|
|
9
1
|
@file:Suppress("EnumValuesSoftDeprecate")
|
|
10
2
|
|
|
11
|
-
package
|
|
3
|
+
package com.regula.plugin.documentreader
|
|
12
4
|
|
|
13
|
-
import android.content.Context
|
|
14
5
|
import android.graphics.Paint
|
|
15
6
|
import android.graphics.Typeface
|
|
16
7
|
import android.graphics.drawable.Drawable
|
|
@@ -32,13 +23,13 @@ import com.regula.documentreader.api.params.rfid.dg.DTCDataGroup
|
|
|
32
23
|
import com.regula.documentreader.api.params.rfid.dg.DataGroups
|
|
33
24
|
import com.regula.documentreader.api.params.rfid.dg.EIDDataGroups
|
|
34
25
|
import com.regula.documentreader.api.params.rfid.dg.EPassportDataGroups
|
|
35
|
-
import
|
|
36
|
-
import
|
|
26
|
+
import com.regula.plugin.documentreader.Convert.toBase64
|
|
27
|
+
import com.regula.plugin.documentreader.Convert.toDrawable
|
|
37
28
|
import org.json.JSONArray
|
|
38
29
|
import org.json.JSONObject
|
|
39
30
|
|
|
40
|
-
fun setFunctionality(
|
|
41
|
-
val editor =
|
|
31
|
+
fun setFunctionality(config: Functionality, input: JSONObject) = input.forEach { k, v ->
|
|
32
|
+
val editor = config.edit()
|
|
42
33
|
when (k) {
|
|
43
34
|
"pictureOnBoundsReady" -> editor.setPictureOnBoundsReady(v as Boolean)
|
|
44
35
|
"showTorchButton" -> editor.setShowTorchButton(v as Boolean)
|
|
@@ -67,43 +58,43 @@ fun setFunctionality(functionality: Functionality, opts: JSONObject) = opts.forE
|
|
|
67
58
|
"btDeviceName" -> editor.setBtDeviceName(v as String)
|
|
68
59
|
"zoomFactor" -> editor.setZoomFactor(v.toFloat())
|
|
69
60
|
"exposure" -> editor.setExposure(v.toFloat())
|
|
70
|
-
"excludedCamera2Models" -> editor.setExcludedCamera2Models(
|
|
61
|
+
"excludedCamera2Models" -> editor.setExcludedCamera2Models((v as JSONArray).toList())
|
|
71
62
|
"cameraSize" -> editor.setCameraSize(cameraSizeFromJSON(v as JSONObject).first, cameraSizeFromJSON(v).second)
|
|
72
63
|
}
|
|
73
64
|
editor.apply()
|
|
74
65
|
}
|
|
75
66
|
|
|
76
|
-
fun getFunctionality(
|
|
77
|
-
"pictureOnBoundsReady" to
|
|
78
|
-
"showTorchButton" to
|
|
79
|
-
"showCloseButton" to
|
|
80
|
-
"videoCaptureMotionControl" to
|
|
81
|
-
"showCaptureButton" to
|
|
82
|
-
"showChangeFrameButton" to
|
|
83
|
-
"showSkipNextPageButton" to
|
|
84
|
-
"useAuthenticator" to
|
|
85
|
-
"skipFocusingFrames" to
|
|
86
|
-
"showCameraSwitchButton" to
|
|
87
|
-
"displayMetadata" to
|
|
88
|
-
"isZoomEnabled" to
|
|
89
|
-
"isCameraTorchCheckDisabled" to
|
|
90
|
-
"recordScanningProcess" to
|
|
91
|
-
"manualMultipageMode" to
|
|
92
|
-
"torchTurnedOn" to
|
|
93
|
-
"showCaptureButtonDelayFromDetect" to
|
|
94
|
-
"showCaptureButtonDelayFromStart" to
|
|
95
|
-
"orientation" to
|
|
96
|
-
"captureMode" to
|
|
97
|
-
"cameraMode" to
|
|
98
|
-
"rfidTimeout" to
|
|
99
|
-
"forcePagesCount" to
|
|
100
|
-
"cameraFrame" to
|
|
101
|
-
"btDeviceName" to
|
|
102
|
-
"zoomFactor" to
|
|
103
|
-
"exposure" to
|
|
104
|
-
"excludedCamera2Models" to
|
|
105
|
-
"cameraSize" to generateCameraSize(
|
|
106
|
-
).
|
|
67
|
+
fun getFunctionality(input: Functionality) = mapOf(
|
|
68
|
+
"pictureOnBoundsReady" to input.isPictureOnBoundsReady,
|
|
69
|
+
"showTorchButton" to input.isShowTorchButton,
|
|
70
|
+
"showCloseButton" to input.isShowCloseButton,
|
|
71
|
+
"videoCaptureMotionControl" to input.isVideoCaptureMotionControl,
|
|
72
|
+
"showCaptureButton" to input.isShowCaptureButton,
|
|
73
|
+
"showChangeFrameButton" to input.isShowChangeFrameButton,
|
|
74
|
+
"showSkipNextPageButton" to input.isShowSkipNextPageButton,
|
|
75
|
+
"useAuthenticator" to input.isUseAuthenticator,
|
|
76
|
+
"skipFocusingFrames" to input.isSkipFocusingFrames,
|
|
77
|
+
"showCameraSwitchButton" to input.isShowCameraSwitchButton,
|
|
78
|
+
"displayMetadata" to input.isDisplayMetaData,
|
|
79
|
+
"isZoomEnabled" to input.isZoomEnabled,
|
|
80
|
+
"isCameraTorchCheckDisabled" to input.isCameraTorchCheckDisabled,
|
|
81
|
+
"recordScanningProcess" to input.doRecordProcessingVideo(),
|
|
82
|
+
"manualMultipageMode" to input.isManualMultipageMode,
|
|
83
|
+
"torchTurnedOn" to input.isTorchTurnedOn,
|
|
84
|
+
"showCaptureButtonDelayFromDetect" to input.showCaptureButtonDelayFromDetect,
|
|
85
|
+
"showCaptureButtonDelayFromStart" to input.showCaptureButtonDelayFromStart,
|
|
86
|
+
"orientation" to input.orientation,
|
|
87
|
+
"captureMode" to input.captureMode,
|
|
88
|
+
"cameraMode" to input.cameraMode,
|
|
89
|
+
"rfidTimeout" to input.rfidTimeout,
|
|
90
|
+
"forcePagesCount" to input.forcePagesCount,
|
|
91
|
+
"cameraFrame" to input.cameraFrame,
|
|
92
|
+
"btDeviceName" to input.btDeviceName,
|
|
93
|
+
"zoomFactor" to input.zoomFactor,
|
|
94
|
+
"exposure" to input.exposure,
|
|
95
|
+
"excludedCamera2Models" to input.excludedCamera2Models.toJson(),
|
|
96
|
+
"cameraSize" to generateCameraSize(input.cameraWidth, input.cameraHeight)
|
|
97
|
+
).toJson()
|
|
107
98
|
|
|
108
99
|
@Suppress("DEPRECATION")
|
|
109
100
|
fun setProcessParams(processParams: ProcessParam, opts: JSONObject) = opts.forEach { k, v ->
|
|
@@ -175,7 +166,7 @@ fun setProcessParams(processParams: ProcessParam, opts: JSONObject) = opts.forEa
|
|
|
175
166
|
"lcidIgnoreFilter" -> processParams.lcidIgnoreFilter = v.toIntArray()
|
|
176
167
|
"lcidFilter" -> processParams.lcidFilter = v.toIntArray()
|
|
177
168
|
"barcodeTypes" -> processParams.doBarcodes = barcodeTypeArrayFromJson(v as JSONArray)
|
|
178
|
-
"mrzFormatsFilter" -> processParams.mrzFormatsFilter =
|
|
169
|
+
"mrzFormatsFilter" -> processParams.mrzFormatsFilter = (v as JSONArray).toArray()
|
|
179
170
|
"customParams" -> processParams.customParams = v as JSONObject
|
|
180
171
|
"imageQA" -> setImageQA(processParams.imageQA, v as JSONObject)
|
|
181
172
|
"rfidParams" -> processParams.rfidParams = rfidParamsFromJSON(v as JSONObject)
|
|
@@ -250,13 +241,13 @@ fun getProcessParams(processParams: ProcessParam) = mapOf(
|
|
|
250
241
|
"timeoutFromFirstDocType" to processParams.timeoutFromFirstDocType,
|
|
251
242
|
"documentAreaMin" to processParams.documentAreaMin,
|
|
252
243
|
"timeoutLiveness" to processParams.timeoutLiveness,
|
|
253
|
-
"documentIDList" to processParams.documentIDList.
|
|
254
|
-
"fieldTypesFilter" to processParams.fieldTypesFilter.
|
|
255
|
-
"documentGroupFilter" to processParams.documentGroupFilter.
|
|
256
|
-
"lcidIgnoreFilter" to processParams.lcidIgnoreFilter.
|
|
257
|
-
"lcidFilter" to processParams.lcidFilter.
|
|
258
|
-
"resultTypeOutput" to processParams.resultTypeOutput.
|
|
259
|
-
"mrzFormatsFilter" to
|
|
244
|
+
"documentIDList" to processParams.documentIDList.toJson(),
|
|
245
|
+
"fieldTypesFilter" to processParams.fieldTypesFilter.toJson(),
|
|
246
|
+
"documentGroupFilter" to processParams.documentGroupFilter.toJson(),
|
|
247
|
+
"lcidIgnoreFilter" to processParams.lcidIgnoreFilter.toJson(),
|
|
248
|
+
"lcidFilter" to processParams.lcidFilter.toJson(),
|
|
249
|
+
"resultTypeOutput" to processParams.resultTypeOutput.toJson(),
|
|
250
|
+
"mrzFormatsFilter" to processParams.mrzFormatsFilter.toJson(),
|
|
260
251
|
"barcodeTypes" to generateBarcodeTypeArray(processParams.doBarcodes),
|
|
261
252
|
"imageQA" to getImageQA(processParams.imageQA),
|
|
262
253
|
"rfidParams" to generateRFIDParams(processParams.rfidParams),
|
|
@@ -264,9 +255,9 @@ fun getProcessParams(processParams: ProcessParam) = mapOf(
|
|
|
264
255
|
"backendProcessingConfig" to generateBackendProcessingConfig(processParams.backendProcessingConfig),
|
|
265
256
|
"authenticityParams" to getAuthenticityParams(processParams.authenticityParams),
|
|
266
257
|
"customParams" to processParams.customParams,
|
|
267
|
-
).
|
|
258
|
+
).toJson()
|
|
268
259
|
|
|
269
|
-
fun setCustomization(customization: ParamsCustomization, opts: JSONObject
|
|
260
|
+
fun setCustomization(customization: ParamsCustomization, opts: JSONObject) = opts.forEach { k, v ->
|
|
270
261
|
val editor = customization.edit()
|
|
271
262
|
when (k) {
|
|
272
263
|
"showStatusMessages" -> editor.setShowStatusMessages(v as Boolean)
|
|
@@ -304,29 +295,29 @@ fun setCustomization(customization: ParamsCustomization, opts: JSONObject, conte
|
|
|
304
295
|
"livenessAnimationPositionMultiplier" -> editor.setLivenessAnimationPositionMultiplier(v.toFloat())
|
|
305
296
|
"nextPageAnimationStartDelay" -> editor.setNextPageAnimationStartDelay(v.toFloat())
|
|
306
297
|
"nextPageAnimationEndDelay" -> editor.setNextPageAnimationEndDelay(v.toFloat())
|
|
307
|
-
"multipageAnimationFrontImage" -> editor.setMultipageAnimationFrontImage(v.toDrawable(
|
|
308
|
-
"multipageAnimationBackImage" -> editor.setMultipageAnimationBackImage(v.toDrawable(
|
|
309
|
-
"borderBackgroundImage" -> editor.setBorderBackgroundImage(v.toDrawable(
|
|
310
|
-
"helpAnimationImage" -> editor.setHelpAnimationImage(v.toDrawable(
|
|
311
|
-
"closeButtonImage" -> editor.setCloseButtonImage(v.toDrawable(
|
|
312
|
-
"captureButtonImage" -> editor.setCaptureButtonImage(v.toDrawable(
|
|
313
|
-
"changeFrameButtonCollapseImage" -> editor.setChangeFrameCollapseButtonImage(v.toDrawable(
|
|
314
|
-
"changeFrameButtonExpandImage" -> editor.setChangeFrameExpandButtonImage(v.toDrawable(
|
|
315
|
-
"cameraSwitchButtonImage" -> editor.setCameraSwitchButtonImage(v.toDrawable(
|
|
316
|
-
"torchButtonOnImage" -> editor.setTorchImageOn(v.toDrawable(
|
|
317
|
-
"torchButtonOffImage" -> editor.setTorchImageOff(v.toDrawable(
|
|
318
|
-
"livenessAnimationImage" -> editor.setLivenessAnimationImage(v.toDrawable(
|
|
319
|
-
"helpAnimationImageMatrix" -> editor.setHelpAnimationImageMatrix(v
|
|
320
|
-
"multipageAnimationFrontImageMatrix" -> editor.setMultipageAnimationFrontImageMatrix(v
|
|
321
|
-
"multipageAnimationBackImageMatrix" -> editor.setMultipageAnimationBackImageMatrix(v
|
|
322
|
-
"livenessAnimationImageMatrix" -> editor.setLivenessAnimationImageMatrix(v
|
|
323
|
-
"borderBackgroundImageMatrix" -> editor.setBorderBackgroundImageMatrix(v
|
|
298
|
+
"multipageAnimationFrontImage" -> editor.setMultipageAnimationFrontImage(v.toDrawable())
|
|
299
|
+
"multipageAnimationBackImage" -> editor.setMultipageAnimationBackImage(v.toDrawable())
|
|
300
|
+
"borderBackgroundImage" -> editor.setBorderBackgroundImage(v.toDrawable())
|
|
301
|
+
"helpAnimationImage" -> editor.setHelpAnimationImage(v.toDrawable())
|
|
302
|
+
"closeButtonImage" -> editor.setCloseButtonImage(v.toDrawable())
|
|
303
|
+
"captureButtonImage" -> editor.setCaptureButtonImage(v.toDrawable())
|
|
304
|
+
"changeFrameButtonCollapseImage" -> editor.setChangeFrameCollapseButtonImage(v.toDrawable())
|
|
305
|
+
"changeFrameButtonExpandImage" -> editor.setChangeFrameExpandButtonImage(v.toDrawable())
|
|
306
|
+
"cameraSwitchButtonImage" -> editor.setCameraSwitchButtonImage(v.toDrawable())
|
|
307
|
+
"torchButtonOnImage" -> editor.setTorchImageOn(v.toDrawable())
|
|
308
|
+
"torchButtonOffImage" -> editor.setTorchImageOff(v.toDrawable())
|
|
309
|
+
"livenessAnimationImage" -> editor.setLivenessAnimationImage(v.toDrawable())
|
|
310
|
+
"helpAnimationImageMatrix" -> editor.setHelpAnimationImageMatrix(matrixFromJSON(v as JSONArray?)).setHelpAnimationImageScaleType(ImageView.ScaleType.MATRIX)
|
|
311
|
+
"multipageAnimationFrontImageMatrix" -> editor.setMultipageAnimationFrontImageMatrix(matrixFromJSON(v as JSONArray?)).setMultipageAnimationFrontImageScaleType(ImageView.ScaleType.MATRIX)
|
|
312
|
+
"multipageAnimationBackImageMatrix" -> editor.setMultipageAnimationBackImageMatrix(matrixFromJSON(v as JSONArray?)).setMultipageAnimationBackImageScaleType(ImageView.ScaleType.MATRIX)
|
|
313
|
+
"livenessAnimationImageMatrix" -> editor.setLivenessAnimationImageMatrix(matrixFromJSON(v as JSONArray?)).setLivenessAnimationImageScaleType(ImageView.ScaleType.MATRIX)
|
|
314
|
+
"borderBackgroundImageMatrix" -> editor.setBorderBackgroundImageMatrix(matrixFromJSON(v as JSONArray?)).setBorderBackgroundImageScaleType(ImageView.ScaleType.MATRIX)
|
|
324
315
|
"customLabelStatus" -> editor.setCustomLabelStatus(SpannableString(v as String))
|
|
325
316
|
"cameraFrameLineCap" -> editor.setCameraFrameLineCap(Paint.Cap.values()[v.toInt()])
|
|
326
317
|
"uiCustomizationLayer" -> editor.setUiCustomizationLayer(JSONObject(v.toString()))
|
|
327
318
|
"colors" -> setColors(editor, v as JSONObject)
|
|
328
319
|
"fonts" -> setFonts(editor, v as JSONObject)
|
|
329
|
-
"images" -> setImages(editor, v as JSONObject
|
|
320
|
+
"images" -> setImages(editor, v as JSONObject)
|
|
330
321
|
"statusTextFont" -> {
|
|
331
322
|
val font = typefaceFromJSON(v as JSONObject)
|
|
332
323
|
editor.setStatusTextFont(font.first)
|
|
@@ -355,17 +346,17 @@ fun getCustomization(customization: ParamsCustomization) = mapOf(
|
|
|
355
346
|
"activityIndicatorSize" to customization.activityIndicatorSize,
|
|
356
347
|
"status" to customization.status,
|
|
357
348
|
"resultStatus" to customization.resultStatus,
|
|
358
|
-
"cameraFrameDefaultColor" to customization.cameraFrameDefaultColor.
|
|
359
|
-
"cameraFrameActiveColor" to customization.cameraFrameActiveColor.
|
|
360
|
-
"statusTextColor" to customization.statusTextColor.
|
|
361
|
-
"resultStatusTextColor" to customization.resultStatusTextColor.
|
|
362
|
-
"resultStatusBackgroundColor" to customization.resultStatusBackgroundColor.
|
|
363
|
-
"multipageButtonBackgroundColor" to customization.multipageButtonBackgroundColor.
|
|
364
|
-
"tintColor" to customization.tintColor.
|
|
365
|
-
"activityIndicatorColor" to customization.activityIndicatorColor.
|
|
366
|
-
"statusBackgroundColor" to customization.statusBackgroundColor.
|
|
367
|
-
"cameraPreviewBackgroundColor" to customization.cameraPreviewBackgroundColor.
|
|
368
|
-
"backgroundMaskColor" to customization.backgroundMaskColor.
|
|
349
|
+
"cameraFrameDefaultColor" to customization.cameraFrameDefaultColor.colorToLong(),
|
|
350
|
+
"cameraFrameActiveColor" to customization.cameraFrameActiveColor.colorToLong(),
|
|
351
|
+
"statusTextColor" to customization.statusTextColor.colorToLong(),
|
|
352
|
+
"resultStatusTextColor" to customization.resultStatusTextColor.colorToLong(),
|
|
353
|
+
"resultStatusBackgroundColor" to customization.resultStatusBackgroundColor.colorToLong(),
|
|
354
|
+
"multipageButtonBackgroundColor" to customization.multipageButtonBackgroundColor.colorToLong(),
|
|
355
|
+
"tintColor" to customization.tintColor.colorToLong(),
|
|
356
|
+
"activityIndicatorColor" to customization.activityIndicatorColor.colorToLong(),
|
|
357
|
+
"statusBackgroundColor" to customization.statusBackgroundColor.colorToLong(),
|
|
358
|
+
"cameraPreviewBackgroundColor" to customization.cameraPreviewBackgroundColor.colorToLong(),
|
|
359
|
+
"backgroundMaskColor" to customization.backgroundMaskColor.colorToLong(),
|
|
369
360
|
"statusPositionMultiplier" to customization.statusPositionMultiplier,
|
|
370
361
|
"resultStatusPositionMultiplier" to customization.resultStatusPositionMultiplier,
|
|
371
362
|
"backgroundMaskAlpha" to customization.backgroundMaskAlpha,
|
|
@@ -378,32 +369,32 @@ fun getCustomization(customization: ParamsCustomization) = mapOf(
|
|
|
378
369
|
"livenessAnimationPositionMultiplier" to customization.livenessAnimationPositionMultiplier,
|
|
379
370
|
"nextPageAnimationStartDelay" to customization.nextPageAnimationStartDelay,
|
|
380
371
|
"nextPageAnimationEndDelay" to customization.nextPageAnimationEndDelay,
|
|
381
|
-
"multipageAnimationFrontImage" to customization.multipageAnimationFrontImage.
|
|
382
|
-
"multipageAnimationBackImage" to customization.multipageAnimationBackImage.
|
|
383
|
-
"borderBackgroundImage" to customization.borderBackgroundImage.
|
|
384
|
-
"helpAnimationImage" to customization.helpAnimationImageDrawable.
|
|
385
|
-
"closeButtonImage" to customization.closeButtonDrawable.
|
|
386
|
-
"captureButtonImage" to customization.captureButtonDrawable.
|
|
387
|
-
"changeFrameButtonCollapseImage" to customization.changeFrameCollapseButtonDrawable.
|
|
388
|
-
"changeFrameButtonExpandImage" to customization.changeFrameExpandButtonDrawable.
|
|
389
|
-
"cameraSwitchButtonImage" to customization.cameraSwitchButtonDrawable.
|
|
390
|
-
"torchButtonOnImage" to customization.torchImageOnDrawable.
|
|
391
|
-
"torchButtonOffImage" to customization.torchImageOffDrawable.
|
|
392
|
-
"livenessAnimationImage" to customization.livenessAnimationImage.
|
|
393
|
-
"helpAnimationImageMatrix" to customization.helpAnimationImageMatrix
|
|
394
|
-
"multipageAnimationFrontImageMatrix" to customization.multipageAnimationFrontImageMatrix
|
|
395
|
-
"multipageAnimationBackImageMatrix" to customization.multipageAnimationBackImageMatrix
|
|
396
|
-
"livenessAnimationImageMatrix" to customization.livenessAnimationImageMatrix
|
|
397
|
-
"borderBackgroundImageMatrix" to customization.borderBackgroundImageMatrix
|
|
372
|
+
"multipageAnimationFrontImage" to customization.multipageAnimationFrontImage.toBase64(),
|
|
373
|
+
"multipageAnimationBackImage" to customization.multipageAnimationBackImage.toBase64(),
|
|
374
|
+
"borderBackgroundImage" to customization.borderBackgroundImage.toBase64(),
|
|
375
|
+
"helpAnimationImage" to customization.helpAnimationImageDrawable.toBase64(),
|
|
376
|
+
"closeButtonImage" to customization.closeButtonDrawable.toBase64(),
|
|
377
|
+
"captureButtonImage" to customization.captureButtonDrawable.toBase64(),
|
|
378
|
+
"changeFrameButtonCollapseImage" to customization.changeFrameCollapseButtonDrawable.toBase64(),
|
|
379
|
+
"changeFrameButtonExpandImage" to customization.changeFrameExpandButtonDrawable.toBase64(),
|
|
380
|
+
"cameraSwitchButtonImage" to customization.cameraSwitchButtonDrawable.toBase64(),
|
|
381
|
+
"torchButtonOnImage" to customization.torchImageOnDrawable.toBase64(),
|
|
382
|
+
"torchButtonOffImage" to customization.torchImageOffDrawable.toBase64(),
|
|
383
|
+
"livenessAnimationImage" to customization.livenessAnimationImage.toBase64(),
|
|
384
|
+
"helpAnimationImageMatrix" to generateMatrix(customization.helpAnimationImageMatrix),
|
|
385
|
+
"multipageAnimationFrontImageMatrix" to generateMatrix(customization.multipageAnimationFrontImageMatrix),
|
|
386
|
+
"multipageAnimationBackImageMatrix" to generateMatrix(customization.multipageAnimationBackImageMatrix),
|
|
387
|
+
"livenessAnimationImageMatrix" to generateMatrix(customization.livenessAnimationImageMatrix),
|
|
388
|
+
"borderBackgroundImageMatrix" to generateMatrix(customization.borderBackgroundImageMatrix),
|
|
398
389
|
"statusTextFont" to generateTypeface(customization.statusTextFont, customization.statusTextSize),
|
|
399
390
|
"resultStatusTextFont" to generateTypeface(customization.resultStatusTextFont, customization.resultStatusTextSize),
|
|
400
391
|
"customLabelStatus" to customization.customLabelStatus?.toString(),
|
|
401
|
-
"cameraFrameLineCap" to
|
|
392
|
+
"cameraFrameLineCap" to customization.cameraFrameLineCap.ordinal,
|
|
402
393
|
"uiCustomizationLayer" to customization.uiCustomizationLayer,
|
|
403
394
|
"colors" to getColors(customization.colors),
|
|
404
395
|
"fonts" to getFonts(customization.typeFaces, customization.fontSizes),
|
|
405
396
|
"images" to getImages(customization.images)
|
|
406
|
-
).
|
|
397
|
+
).toJson()
|
|
407
398
|
|
|
408
399
|
fun setRfidScenario(rfidScenario: RfidScenario, opts: JSONObject) = opts.forEach { k, v ->
|
|
409
400
|
when (k) {
|
|
@@ -527,7 +518,7 @@ fun getRfidScenario(rfidScenario: RfidScenario) = mapOf(
|
|
|
527
518
|
"eIDDataGroups" to getDataGroups(rfidScenario.eIDDataGroups()),
|
|
528
519
|
"eDLDataGroups" to getDataGroups(rfidScenario.eDLDataGroups()),
|
|
529
520
|
"dtcDataGroups" to getDTCDataGroup(rfidScenario.DTCDataGroup())
|
|
530
|
-
).
|
|
521
|
+
).toJson()
|
|
531
522
|
|
|
532
523
|
fun setDataGroups(dataGroup: DataGroups, opts: JSONObject) = opts.forEach { k, v ->
|
|
533
524
|
val value = v as Boolean
|
|
@@ -592,7 +583,7 @@ fun getDataGroups(dataGroup: DataGroups): JSONObject {
|
|
|
592
583
|
result["DG20"] = dataGroup.isDG20
|
|
593
584
|
result["DG21"] = dataGroup.isDG21
|
|
594
585
|
}
|
|
595
|
-
return result.
|
|
586
|
+
return result.toJson()
|
|
596
587
|
}
|
|
597
588
|
|
|
598
589
|
fun setDTCDataGroup(dataGroup: DTCDataGroup, opts: JSONObject) = opts.forEach { k, v ->
|
|
@@ -612,7 +603,7 @@ fun getDTCDataGroup(dataGroup: DTCDataGroup) = mapOf(
|
|
|
612
603
|
"DG22" to dataGroup.isDG22,
|
|
613
604
|
"DG23" to dataGroup.isDG23,
|
|
614
605
|
"DG24" to dataGroup.isDG24,
|
|
615
|
-
).
|
|
606
|
+
).toJson()
|
|
616
607
|
|
|
617
608
|
fun setImageQA(input: ImageQA, opts: JSONObject) = opts.forEach { k, v ->
|
|
618
609
|
when (k) {
|
|
@@ -639,10 +630,10 @@ fun getImageQA(input: ImageQA) = mapOf(
|
|
|
639
630
|
"angleThreshold" to input.angleThreshold,
|
|
640
631
|
"documentPositionIndent" to input.documentPositionIndent,
|
|
641
632
|
"brightnessThreshold" to input.brightnessThreshold,
|
|
642
|
-
"expectedPass" to input.expectedPass.
|
|
633
|
+
"expectedPass" to input.expectedPass.toJson(),
|
|
643
634
|
"glaresCheckParams" to generateGlaresCheckParams(input.glaresCheckParams),
|
|
644
635
|
"occlusionCheck" to input.occlusionCheck,
|
|
645
|
-
).
|
|
636
|
+
).toJson()
|
|
646
637
|
|
|
647
638
|
fun setAuthenticityParams(input: AuthenticityParams, opts: JSONObject) = opts.forEach { k, v ->
|
|
648
639
|
when (k) {
|
|
@@ -686,7 +677,7 @@ fun getAuthenticityParams(input: AuthenticityParams?) = input?.let {
|
|
|
686
677
|
"checkLetterScreen" to it.checkLetterScreen,
|
|
687
678
|
"checkSecurityText" to it.checkSecurityText,
|
|
688
679
|
"livenessParams" to getLivenessParams(it.livenessParams)
|
|
689
|
-
).
|
|
680
|
+
).toJson()
|
|
690
681
|
}
|
|
691
682
|
|
|
692
683
|
fun setLivenessParams(input: LivenessParams, opts: JSONObject) = opts.forEach { k, v ->
|
|
@@ -708,7 +699,7 @@ fun getLivenessParams(input: LivenessParams?) = input?.let {
|
|
|
708
699
|
"checkED" to input.checkED,
|
|
709
700
|
"checkBlackAndWhiteCopy" to input.checkBlackAndWhiteCopy,
|
|
710
701
|
"checkDynaprint" to input.checkDynaprint,
|
|
711
|
-
).
|
|
702
|
+
).toJson()
|
|
712
703
|
}
|
|
713
704
|
|
|
714
705
|
fun setColors(input: ParamsCustomization.CustomizationEditor, opts: JSONObject) = opts.forEach { key, v ->
|
|
@@ -734,7 +725,7 @@ fun getColors(input: Map<CustomizationColor, Long>) = mapOf(
|
|
|
734
725
|
"rfidProcessingScreenProgressBarBackground" to input[CustomizationColor.RFID_PROCESSING_SCREEN_PROGRESS_BAR_BACKGROUND],
|
|
735
726
|
"rfidProcessingScreenResultLabelText" to input[CustomizationColor.RFID_PROCESSING_SCREEN_RESULT_LABEL_TEXT],
|
|
736
727
|
"rfidProcessingScreenLoadingBar" to input[CustomizationColor.RFID_PROCESSING_SCREEN_LOADING_BAR],
|
|
737
|
-
).
|
|
728
|
+
).toJson()
|
|
738
729
|
|
|
739
730
|
fun setFonts(input: ParamsCustomization.CustomizationEditor, opts: JSONObject) = opts.forEach { key, value ->
|
|
740
731
|
when (key) {
|
|
@@ -745,17 +736,60 @@ fun setFonts(input: ParamsCustomization.CustomizationEditor, opts: JSONObject) =
|
|
|
745
736
|
}
|
|
746
737
|
|
|
747
738
|
fun getFonts(fonts: Map<CustomizationFont, Typeface>, sizes: Map<CustomizationFont, Int>) = mapOf(
|
|
748
|
-
"rfidProcessingScreenHintLabel" to CustomizationFont.RFID_PROCESSING_SCREEN_HINT_LABEL.
|
|
749
|
-
"rfidProcessingScreenProgressLabel" to CustomizationFont.RFID_PROCESSING_SCREEN_PROGRESS_LABEL.
|
|
750
|
-
"rfidProcessingScreenResultLabel" to CustomizationFont.RFID_PROCESSING_SCREEN_RESULT_LABEL.
|
|
751
|
-
).
|
|
739
|
+
"rfidProcessingScreenHintLabel" to CustomizationFont.RFID_PROCESSING_SCREEN_HINT_LABEL.getFont(fonts, sizes),
|
|
740
|
+
"rfidProcessingScreenProgressLabel" to CustomizationFont.RFID_PROCESSING_SCREEN_PROGRESS_LABEL.getFont(fonts, sizes),
|
|
741
|
+
"rfidProcessingScreenResultLabel" to CustomizationFont.RFID_PROCESSING_SCREEN_RESULT_LABEL.getFont(fonts, sizes),
|
|
742
|
+
).toJson()
|
|
752
743
|
|
|
753
|
-
fun setImages(input: ParamsCustomization.CustomizationEditor, opts: JSONObject
|
|
744
|
+
fun setImages(input: ParamsCustomization.CustomizationEditor, opts: JSONObject) = opts.forEach { key, v ->
|
|
754
745
|
when (key) {
|
|
755
|
-
"rfidProcessingScreenFailureImage" -> input.setImage(CustomizationImage.RFID_PROCESSING_SCREEN_FAILURE_IMAGE, v.toDrawable(
|
|
746
|
+
"rfidProcessingScreenFailureImage" -> input.setImage(CustomizationImage.RFID_PROCESSING_SCREEN_FAILURE_IMAGE, v.toDrawable())
|
|
756
747
|
}
|
|
757
748
|
}
|
|
758
749
|
|
|
759
750
|
fun getImages(input: Map<CustomizationImage, Drawable>) = mapOf(
|
|
760
|
-
"rfidProcessingScreenFailureImage" to (input[CustomizationImage.RFID_PROCESSING_SCREEN_FAILURE_IMAGE] ?: ContextCompat.getDrawable(context, com.regula.documentreader.api.R.drawable.reg_ic_error)).
|
|
761
|
-
).
|
|
751
|
+
"rfidProcessingScreenFailureImage" to (input[CustomizationImage.RFID_PROCESSING_SCREEN_FAILURE_IMAGE] ?: ContextCompat.getDrawable(context, com.regula.documentreader.api.R.drawable.reg_ic_error)).toBase64(),
|
|
752
|
+
).toJson()
|
|
753
|
+
|
|
754
|
+
fun CustomizationFont.getFont(fonts: Map<CustomizationFont, Typeface>, sizes: Map<CustomizationFont, Int>) =
|
|
755
|
+
generateTypeface(fonts[this], sizes[this])
|
|
756
|
+
|
|
757
|
+
fun CustomizationFont.setFont(editor: ParamsCustomization.CustomizationEditor, value: Any?) {
|
|
758
|
+
val font = typefaceFromJSON(value as JSONObject)
|
|
759
|
+
editor.setFont(this, font.first)
|
|
760
|
+
font.second?.let { editor.setFontSize(this, it) }
|
|
761
|
+
}
|
|
762
|
+
|
|
763
|
+
fun Any.toInt() = when (this) {
|
|
764
|
+
is Double -> toInt()
|
|
765
|
+
is Long -> toInt()
|
|
766
|
+
is String -> Integer.parseInt(this)
|
|
767
|
+
else -> this as Int
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
fun Any.toLong() = when (this) {
|
|
771
|
+
is Double -> toLong()
|
|
772
|
+
is Int -> toLong()
|
|
773
|
+
else -> this as Long
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
fun Any.toFloat() = when (this) {
|
|
777
|
+
is Int -> toFloat()
|
|
778
|
+
is Double -> toFloat()
|
|
779
|
+
else -> this as Float
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
fun Any.toDouble() = when (this) {
|
|
783
|
+
is Int -> toDouble()
|
|
784
|
+
is Long -> toDouble()
|
|
785
|
+
else -> this as Double
|
|
786
|
+
}
|
|
787
|
+
|
|
788
|
+
fun Any?.toColor() = this?.let {
|
|
789
|
+
"#" + toLong().toString(16)
|
|
790
|
+
}
|
|
791
|
+
|
|
792
|
+
fun String?.colorToLong() = this?.let {
|
|
793
|
+
if (this[0] == '#') this.substring(1).toLong(16)
|
|
794
|
+
else this.toLong(16)
|
|
795
|
+
}
|