@regulaforensics/cordova-plugin-document-reader-api 6.9.1 → 7.2.0
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/README.md +10 -40
- package/example/README.md +32 -0
- package/example/config.xml +5 -1
- package/example/package.json +7 -10
- package/example/www/js/index.js +85 -159
- package/package.json +1 -1
- package/plugin.xml +8 -8
- package/src/android/BluetoothUtil.kt +78 -74
- package/src/android/Config.kt +692 -0
- package/src/android/DocumentReader.kt +524 -0
- package/src/android/JSONConstructor.kt +2198 -0
- package/src/android/Utils.kt +261 -0
- package/src/android/build.gradle +3 -3
- package/src/ios/RGLWConfig.h +48 -0
- package/src/ios/RGLWConfig.m +1312 -0
- package/src/ios/RGLWDocumentReader.h +14 -11
- package/src/ios/RGLWDocumentReader.m +384 -579
- package/src/ios/RGLWJSONConstructor.h +173 -69
- package/src/ios/RGLWJSONConstructor.m +1832 -786
- package/www/DocumentReader.js +869 -278
- package/src/android/DocumentReader.java +0 -1118
- package/src/android/Helpers.java +0 -259
- package/src/android/JSONConstructor.java +0 -1119
- package/src/android/RegulaConfig.java +0 -830
- package/src/ios/RGLWRegulaConfig.h +0 -26
- package/src/ios/RGLWRegulaConfig.m +0 -1152
|
@@ -0,0 +1,692 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Config.java
|
|
3
|
+
// DocumentReader
|
|
4
|
+
//
|
|
5
|
+
// Created by Pavel Masiuk on 21.09.2023.
|
|
6
|
+
// Copyright © 2023 Regula. All rights reserved.
|
|
7
|
+
//
|
|
8
|
+
|
|
9
|
+
package cordova.plugin.documentreader
|
|
10
|
+
|
|
11
|
+
import android.content.Context
|
|
12
|
+
import android.graphics.Paint
|
|
13
|
+
import android.graphics.Typeface
|
|
14
|
+
import android.graphics.drawable.Drawable
|
|
15
|
+
import android.text.SpannableString
|
|
16
|
+
import android.widget.ImageView
|
|
17
|
+
import androidx.core.content.ContextCompat
|
|
18
|
+
import com.regula.documentreader.api.enums.CustomizationColor
|
|
19
|
+
import com.regula.documentreader.api.enums.CustomizationFont
|
|
20
|
+
import com.regula.documentreader.api.enums.CustomizationImage
|
|
21
|
+
import com.regula.documentreader.api.params.AuthenticityParams
|
|
22
|
+
import com.regula.documentreader.api.params.Functionality
|
|
23
|
+
import com.regula.documentreader.api.params.ImageQA
|
|
24
|
+
import com.regula.documentreader.api.params.LivenessParams
|
|
25
|
+
import com.regula.documentreader.api.params.ParamsCustomization
|
|
26
|
+
import com.regula.documentreader.api.params.ProcessParam
|
|
27
|
+
import com.regula.documentreader.api.params.RfidScenario
|
|
28
|
+
import com.regula.documentreader.api.params.rfid.dg.DataGroups
|
|
29
|
+
import com.regula.documentreader.api.params.rfid.dg.EIDDataGroups
|
|
30
|
+
import com.regula.documentreader.api.params.rfid.dg.EPassportDataGroups
|
|
31
|
+
import cordova.plugin.documentreader.Convert.toDrawable
|
|
32
|
+
import cordova.plugin.documentreader.Convert.toString
|
|
33
|
+
import org.json.JSONArray
|
|
34
|
+
import org.json.JSONObject
|
|
35
|
+
|
|
36
|
+
fun setFunctionality(functionality: Functionality, opts: JSONObject) = opts.forEach { k, v ->
|
|
37
|
+
val editor = functionality.edit()
|
|
38
|
+
when (k) {
|
|
39
|
+
"pictureOnBoundsReady" -> editor.setPictureOnBoundsReady(v as Boolean)
|
|
40
|
+
"showTorchButton" -> editor.setShowTorchButton(v as Boolean)
|
|
41
|
+
"showCloseButton" -> editor.setShowCloseButton(v as Boolean)
|
|
42
|
+
"videoCaptureMotionControl" -> editor.setVideoCaptureMotionControl(v as Boolean)
|
|
43
|
+
"showCaptureButton" -> editor.setShowCaptureButton(v as Boolean)
|
|
44
|
+
"showChangeFrameButton" -> editor.setShowChangeFrameButton(v as Boolean)
|
|
45
|
+
"showSkipNextPageButton" -> editor.setShowSkipNextPageButton(v as Boolean)
|
|
46
|
+
"useAuthenticator" -> editor.setUseAuthenticator(v as Boolean)
|
|
47
|
+
"skipFocusingFrames" -> editor.setSkipFocusingFrames(v as Boolean)
|
|
48
|
+
"showCameraSwitchButton" -> editor.setShowCameraSwitchButton(v as Boolean)
|
|
49
|
+
"displayMetadata" -> editor.setDisplayMetadata(v as Boolean)
|
|
50
|
+
"isZoomEnabled" -> editor.setZoomEnabled(v as Boolean)
|
|
51
|
+
"isCameraTorchCheckDisabled" -> editor.setIsCameraTorchCheckDisabled(v as Boolean)
|
|
52
|
+
"recordScanningProcess" -> editor.setDoRecordProcessingVideo(v as Boolean)
|
|
53
|
+
"manualMultipageMode" -> editor.setManualMultipageMode(v as Boolean)
|
|
54
|
+
"showCaptureButtonDelayFromDetect" -> editor.setShowCaptureButtonDelayFromDetect(v.toLong())
|
|
55
|
+
"showCaptureButtonDelayFromStart" -> editor.setShowCaptureButtonDelayFromStart(v.toLong())
|
|
56
|
+
"orientation" -> editor.setOrientation(v.toInt())
|
|
57
|
+
"captureMode" -> editor.setCaptureMode(v.toInt())
|
|
58
|
+
"cameraMode" -> editor.setCameraMode(v.toInt())
|
|
59
|
+
"rfidTimeout" -> editor.setRfidTimeout(v.toInt())
|
|
60
|
+
"forcePagesCount" -> editor.setForcePagesCount(v.toInt())
|
|
61
|
+
"cameraFrame" -> editor.setCameraFrame(v as String)
|
|
62
|
+
"btDeviceName" -> editor.setBtDeviceName(v as String)
|
|
63
|
+
"zoomFactor" -> editor.setZoomFactor(v.toFloat())
|
|
64
|
+
"exposure" -> editor.setExposure(v.toFloat())
|
|
65
|
+
"excludedCamera2Models" -> editor.setExcludedCamera2Models(stringListFromJson(v as JSONArray))
|
|
66
|
+
"cameraSize" -> editor.setCameraSize(cameraSizeFromJSON(v as JSONObject).first, cameraSizeFromJSON(v).second)
|
|
67
|
+
}
|
|
68
|
+
editor.apply()
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
fun getFunctionality(functionality: Functionality) = mapOf(
|
|
72
|
+
"pictureOnBoundsReady" to functionality.isPictureOnBoundsReady,
|
|
73
|
+
"showTorchButton" to functionality.isShowTorchButton,
|
|
74
|
+
"showCloseButton" to functionality.isShowCloseButton,
|
|
75
|
+
"videoCaptureMotionControl" to functionality.isVideoCaptureMotionControl,
|
|
76
|
+
"showCaptureButton" to functionality.isShowCaptureButton,
|
|
77
|
+
"showChangeFrameButton" to functionality.isShowChangeFrameButton,
|
|
78
|
+
"showSkipNextPageButton" to functionality.isShowSkipNextPageButton,
|
|
79
|
+
"useAuthenticator" to functionality.isUseAuthenticator,
|
|
80
|
+
"skipFocusingFrames" to functionality.isSkipFocusingFrames,
|
|
81
|
+
"showCameraSwitchButton" to functionality.isShowCameraSwitchButton,
|
|
82
|
+
"displayMetadata" to functionality.isDisplayMetaData,
|
|
83
|
+
"isZoomEnabled" to functionality.isZoomEnabled,
|
|
84
|
+
"isCameraTorchCheckDisabled" to functionality.isCameraTorchCheckDisabled,
|
|
85
|
+
"recordScanningProcess" to functionality.doRecordProcessingVideo(),
|
|
86
|
+
"manualMultipageMode" to functionality.isManualMultipageMode,
|
|
87
|
+
"showCaptureButtonDelayFromDetect" to functionality.showCaptureButtonDelayFromDetect,
|
|
88
|
+
"showCaptureButtonDelayFromStart" to functionality.showCaptureButtonDelayFromStart,
|
|
89
|
+
"orientation" to functionality.orientation,
|
|
90
|
+
"captureMode" to functionality.captureMode,
|
|
91
|
+
"cameraMode" to functionality.cameraMode,
|
|
92
|
+
"rfidTimeout" to functionality.rfidTimeout,
|
|
93
|
+
"forcePagesCount" to functionality.forcePagesCount,
|
|
94
|
+
"cameraFrame" to functionality.cameraFrame,
|
|
95
|
+
"btDeviceName" to functionality.btDeviceName,
|
|
96
|
+
"zoomFactor" to functionality.zoomFactor,
|
|
97
|
+
"exposure" to functionality.exposure,
|
|
98
|
+
"excludedCamera2Models" to generateList(functionality.excludedCamera2Models),
|
|
99
|
+
"cameraSize" to generateCameraSize(functionality.cameraWidth, functionality.cameraHeight)
|
|
100
|
+
).toJsonObject()
|
|
101
|
+
|
|
102
|
+
@Suppress("DEPRECATION")
|
|
103
|
+
fun setProcessParams(processParams: ProcessParam, opts: JSONObject) = opts.forEach { k, v ->
|
|
104
|
+
when (k) {
|
|
105
|
+
"multipageProcessing" -> processParams.multipageProcessing = v as Boolean
|
|
106
|
+
"logs" -> processParams.setLogs(v as Boolean)
|
|
107
|
+
"debugSaveImages" -> processParams.debugSaveImages = v as Boolean
|
|
108
|
+
"debugSaveLogs" -> processParams.debugSaveLogs = v as Boolean
|
|
109
|
+
"returnUncroppedImage" -> processParams.returnUncroppedImage = v as Boolean
|
|
110
|
+
"uvTorchEnabled" -> processParams.uvTorchEnabled = v as Boolean
|
|
111
|
+
"debugSaveCroppedImages" -> processParams.debugSaveCroppedImages = v as Boolean
|
|
112
|
+
"disableFocusingCheck" -> processParams.disableFocusingCheck = v as Boolean
|
|
113
|
+
"debugSaveRFIDSession" -> processParams.debugSaveRFIDSession = v as Boolean
|
|
114
|
+
"doublePageSpread" -> processParams.doublePageSpread = v as Boolean
|
|
115
|
+
"manualCrop" -> processParams.manualCrop = v as Boolean
|
|
116
|
+
"integralImage" -> processParams.integralImage = v as Boolean
|
|
117
|
+
"returnCroppedBarcode" -> processParams.returnCroppedBarcode = v as Boolean
|
|
118
|
+
"checkRequiredTextFields" -> processParams.checkRequiredTextFields = v as Boolean
|
|
119
|
+
"depersonalizeLog" -> processParams.depersonalizeLog = v as Boolean
|
|
120
|
+
"generateDoublePageSpreadImage" -> processParams.generateDoublePageSpreadImage = v as Boolean
|
|
121
|
+
"alreadyCropped" -> processParams.alreadyCropped = v as Boolean
|
|
122
|
+
"matchTextFieldMask" -> processParams.matchTextFieldMask = v as Boolean
|
|
123
|
+
"updateOCRValidityByGlare" -> processParams.updateOCRValidityByGlare = v as Boolean
|
|
124
|
+
"noGraphics" -> processParams.noGraphics = v as Boolean
|
|
125
|
+
"multiDocOnImage" -> processParams.multiDocOnImage = v as Boolean
|
|
126
|
+
"forceReadMrzBeforeLocate" -> processParams.forceReadMrzBeforeLocate = v as Boolean
|
|
127
|
+
"parseBarcodes" -> processParams.parseBarcodes = v as Boolean
|
|
128
|
+
"shouldReturnPackageForReprocess" -> processParams.shouldReturnPackageForReprocess = v as Boolean
|
|
129
|
+
"disablePerforationOCR" -> processParams.disablePerforationOCR = v as Boolean
|
|
130
|
+
"respectImageQuality" -> processParams.respectImageQuality = v as Boolean
|
|
131
|
+
"splitNames" -> processParams.splitNames = v as Boolean
|
|
132
|
+
"doDetectCan" -> processParams.doDetectCan = v as Boolean
|
|
133
|
+
"useFaceApi" -> processParams.useFaceApi = v as Boolean
|
|
134
|
+
"useAuthenticityCheck" -> processParams.useAuthenticityCheck = v as Boolean
|
|
135
|
+
"checkHologram" -> processParams.checkHologram = v as Boolean
|
|
136
|
+
"measureSystem" -> processParams.measureSystem = v.toInt()
|
|
137
|
+
"barcodeParserType" -> processParams.barcodeParserType = v.toInt()
|
|
138
|
+
"perspectiveAngle" -> processParams.perspectiveAngle = v.toInt()
|
|
139
|
+
"minDPI" -> processParams.minDPI = v.toInt()
|
|
140
|
+
"imageDpiOutMax" -> processParams.imageDpiOutMax = v.toInt()
|
|
141
|
+
"forceDocID" -> processParams.forceDocID = v.toInt()
|
|
142
|
+
"forceDocFormat" -> processParams.forceDocFormat = v.toInt()
|
|
143
|
+
"shiftExpiryDate" -> processParams.shiftExpiryDate = v.toInt()
|
|
144
|
+
"minimalHolderAge" -> processParams.minimalHolderAge = v.toInt()
|
|
145
|
+
"imageOutputMaxHeight" -> processParams.imageOutputMaxHeight = v.toInt()
|
|
146
|
+
"imageOutputMaxWidth" -> processParams.imageOutputMaxWidth = v.toInt()
|
|
147
|
+
"processAuth" -> processParams.processAuth = v.toInt()
|
|
148
|
+
"convertCase" -> processParams.convertCase = v.toInt()
|
|
149
|
+
"dateFormat" -> processParams.dateFormat = v as String
|
|
150
|
+
"scenario" -> processParams.scenario = v as String
|
|
151
|
+
"captureButtonScenario" -> processParams.captureButtonScenario = v as String
|
|
152
|
+
"sessionLogFolder" -> processParams.sessionLogFolder = v as String
|
|
153
|
+
"timeout" -> processParams.timeout = v.toDouble()
|
|
154
|
+
"timeoutFromFirstDetect" -> processParams.timeoutFromFirstDetect = v.toDouble()
|
|
155
|
+
"timeoutFromFirstDocType" -> processParams.timeoutFromFirstDocType = v.toDouble()
|
|
156
|
+
"documentAreaMin" -> processParams.documentAreaMin = v.toDouble()
|
|
157
|
+
"documentIDList" -> processParams.documentIDList = v.toIntArray()
|
|
158
|
+
"fieldTypesFilter" -> processParams.fieldTypesFilter = v.toIntArray()
|
|
159
|
+
"resultTypeOutput" -> processParams.resultTypeOutput = v.toIntArray()
|
|
160
|
+
"documentGroupFilter" -> processParams.documentGroupFilter = v.toIntArray()
|
|
161
|
+
"lcidIgnoreFilter" -> processParams.lcidIgnoreFilter = v.toIntArray()
|
|
162
|
+
"lcidFilter" -> processParams.lcidFilter = v.toIntArray()
|
|
163
|
+
"barcodeTypes" -> processParams.doBarcodes = barcodeTypeArrayFromJson(v as JSONArray)
|
|
164
|
+
"mrzFormatsFilter" -> processParams.mrzFormatsFilter = stringArrayFromJson(v as JSONArray)
|
|
165
|
+
"customParams" -> processParams.customParams = v as JSONObject
|
|
166
|
+
"imageQA" -> setImageQA(processParams.imageQA, v as JSONObject)
|
|
167
|
+
"rfidParams" -> processParams.rfidParams = rfidParamsFromJSON(v as JSONObject)
|
|
168
|
+
"faceApiParams" -> processParams.faceApiParams = faceApiParamsFromJSON(v as JSONObject)
|
|
169
|
+
"backendProcessingConfig" -> processParams.backendProcessingConfig = backendProcessingConfigFromJSON(v as JSONObject)
|
|
170
|
+
"authenticityParams" -> {
|
|
171
|
+
if (processParams.authenticityParams == null) processParams.authenticityParams = AuthenticityParams.defaultParams()
|
|
172
|
+
setAuthenticityParams(processParams.authenticityParams!!, v as JSONObject)
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
@Suppress("DEPRECATION")
|
|
178
|
+
fun getProcessParams(processParams: ProcessParam) = mapOf(
|
|
179
|
+
"multipageProcessing" to processParams.multipageProcessing,
|
|
180
|
+
"logs" to processParams.isLogEnable,
|
|
181
|
+
"debugSaveImages" to processParams.debugSaveImages,
|
|
182
|
+
"debugSaveLogs" to processParams.debugSaveLogs,
|
|
183
|
+
"returnUncroppedImage" to processParams.returnUncroppedImage,
|
|
184
|
+
"uvTorchEnabled" to processParams.uvTorchEnabled,
|
|
185
|
+
"debugSaveCroppedImages" to processParams.debugSaveCroppedImages,
|
|
186
|
+
"disableFocusingCheck" to processParams.disableFocusingCheck,
|
|
187
|
+
"debugSaveRFIDSession" to processParams.debugSaveRFIDSession,
|
|
188
|
+
"doublePageSpread" to processParams.doublePageSpread,
|
|
189
|
+
"manualCrop" to processParams.manualCrop,
|
|
190
|
+
"integralImage" to processParams.integralImage,
|
|
191
|
+
"returnCroppedBarcode" to processParams.returnCroppedBarcode,
|
|
192
|
+
"checkRequiredTextFields" to processParams.checkRequiredTextFields,
|
|
193
|
+
"depersonalizeLog" to processParams.depersonalizeLog,
|
|
194
|
+
"generateDoublePageSpreadImage" to processParams.generateDoublePageSpreadImage,
|
|
195
|
+
"alreadyCropped" to processParams.alreadyCropped,
|
|
196
|
+
"matchTextFieldMask" to processParams.matchTextFieldMask,
|
|
197
|
+
"updateOCRValidityByGlare" to processParams.updateOCRValidityByGlare,
|
|
198
|
+
"noGraphics" to processParams.noGraphics,
|
|
199
|
+
"multiDocOnImage" to processParams.multiDocOnImage,
|
|
200
|
+
"forceReadMrzBeforeLocate" to processParams.forceReadMrzBeforeLocate,
|
|
201
|
+
"parseBarcodes" to processParams.parseBarcodes,
|
|
202
|
+
"shouldReturnPackageForReprocess" to processParams.shouldReturnPackageForReprocess,
|
|
203
|
+
"disablePerforationOCR" to processParams.disablePerforationOCR,
|
|
204
|
+
"respectImageQuality" to processParams.respectImageQuality,
|
|
205
|
+
"splitNames" to processParams.splitNames,
|
|
206
|
+
"doDetectCan" to processParams.doDetectCan,
|
|
207
|
+
"useFaceApi" to processParams.useFaceApi,
|
|
208
|
+
"useAuthenticityCheck" to processParams.useAuthenticityCheck,
|
|
209
|
+
"checkHologram" to processParams.checkHologram,
|
|
210
|
+
"measureSystem" to processParams.measureSystem,
|
|
211
|
+
"barcodeParserType" to processParams.barcodeParserType,
|
|
212
|
+
"perspectiveAngle" to processParams.perspectiveAngle,
|
|
213
|
+
"minDPI" to processParams.minDPI,
|
|
214
|
+
"imageDpiOutMax" to processParams.imageDpiOutMax,
|
|
215
|
+
"forceDocID" to processParams.forceDocID,
|
|
216
|
+
"forceDocFormat" to processParams.forceDocFormat,
|
|
217
|
+
"shiftExpiryDate" to processParams.shiftExpiryDate,
|
|
218
|
+
"minimalHolderAge" to processParams.minimalHolderAge,
|
|
219
|
+
"imageOutputMaxHeight" to processParams.imageOutputMaxHeight,
|
|
220
|
+
"imageOutputMaxWidth" to processParams.imageOutputMaxWidth,
|
|
221
|
+
"processAuth" to processParams.processAuth,
|
|
222
|
+
"convertCase" to processParams.convertCase,
|
|
223
|
+
"dateFormat" to processParams.dateFormat,
|
|
224
|
+
"scenario" to processParams.scenario,
|
|
225
|
+
"captureButtonScenario" to processParams.captureButtonScenario,
|
|
226
|
+
"sessionLogFolder" to processParams.sessionLogFolder,
|
|
227
|
+
"timeout" to processParams.timeout,
|
|
228
|
+
"timeoutFromFirstDetect" to processParams.timeoutFromFirstDetect,
|
|
229
|
+
"timeoutFromFirstDocType" to processParams.timeoutFromFirstDocType,
|
|
230
|
+
"documentAreaMin" to processParams.documentAreaMin,
|
|
231
|
+
"documentIDList" to processParams.documentIDList.generate(),
|
|
232
|
+
"fieldTypesFilter" to processParams.fieldTypesFilter.generate(),
|
|
233
|
+
"documentGroupFilter" to processParams.documentGroupFilter.generate(),
|
|
234
|
+
"lcidIgnoreFilter" to processParams.lcidIgnoreFilter.generate(),
|
|
235
|
+
"lcidFilter" to processParams.lcidFilter.generate(),
|
|
236
|
+
"resultTypeOutput" to processParams.resultTypeOutput.generate(),
|
|
237
|
+
"mrzFormatsFilter" to generateArray(processParams.mrzFormatsFilter),
|
|
238
|
+
"barcodeTypes" to generateBarcodeTypeArray(processParams.doBarcodes),
|
|
239
|
+
"imageQA" to getImageQA(processParams.imageQA),
|
|
240
|
+
"rfidParams" to generateRFIDParams(processParams.rfidParams),
|
|
241
|
+
"faceApiParams" to generateFaceApiParams(processParams.faceApiParams),
|
|
242
|
+
"backendProcessingConfig" to generateBackendProcessingConfig(processParams.backendProcessingConfig),
|
|
243
|
+
"authenticityParams" to getAuthenticityParams(processParams.authenticityParams),
|
|
244
|
+
"customParams" to processParams.customParams,
|
|
245
|
+
).toJsonObject()
|
|
246
|
+
|
|
247
|
+
fun setCustomization(customization: ParamsCustomization, opts: JSONObject, context: Context) = opts.forEach { k, v ->
|
|
248
|
+
val editor = customization.edit()
|
|
249
|
+
when (k) {
|
|
250
|
+
"showStatusMessages" -> editor.setShowStatusMessages(v as Boolean)
|
|
251
|
+
"showResultStatusMessages" -> editor.setShowResultStatusMessages(v as Boolean)
|
|
252
|
+
"showHelpAnimation" -> editor.setShowHelpAnimation(v as Boolean)
|
|
253
|
+
"showNextPageAnimation" -> editor.setShowNextPageAnimation(v as Boolean)
|
|
254
|
+
"showBackgroundMask" -> editor.setShowBackgroundMask(v as Boolean)
|
|
255
|
+
"cameraFrameBorderWidth" -> editor.setCameraFrameBorderWidth(v.toInt())
|
|
256
|
+
"cameraFrameLineLength" -> editor.setCameraFrameLineLength(v.toInt())
|
|
257
|
+
"cameraFrameShapeType" -> editor.setCameraFrameShapeType(v.toInt())
|
|
258
|
+
"cameraFrameOffsetWidth" -> editor.setCameraFrameOffsetWidth(v.toInt())
|
|
259
|
+
"activityIndicatorSize" -> editor.setActivityIndicatorSize(v.toInt())
|
|
260
|
+
"status" -> editor.setStatus(v as String)
|
|
261
|
+
"resultStatus" -> editor.setResultStatus(v as String)
|
|
262
|
+
"cameraFrameDefaultColor" -> editor.setCameraFrameDefaultColor(v.toColor())
|
|
263
|
+
"cameraFrameActiveColor" -> editor.setCameraFrameActiveColor(v.toColor())
|
|
264
|
+
"statusTextColor" -> editor.setStatusTextColor(v.toColor())
|
|
265
|
+
"resultStatusTextColor" -> editor.setResultStatusTextColor(v.toColor())
|
|
266
|
+
"resultStatusBackgroundColor" -> editor.setResultStatusBackgroundColor(v.toColor())
|
|
267
|
+
"multipageButtonBackgroundColor" -> editor.setMultipageButtonBackgroundColor(v.toColor())
|
|
268
|
+
"tintColor" -> editor.setTintColor(v.toColor())
|
|
269
|
+
"activityIndicatorColor" -> editor.setActivityIndicatorColor(v.toColor())
|
|
270
|
+
"statusBackgroundColor" -> editor.setStatusBackgroundColor(v.toColor())
|
|
271
|
+
"cameraPreviewBackgroundColor" -> editor.setCameraPreviewBackgroundColor(v.toColor())
|
|
272
|
+
"statusPositionMultiplier" -> editor.setStatusPositionMultiplier(v.toFloat())
|
|
273
|
+
"resultStatusPositionMultiplier" -> editor.setResultStatusPositionMultiplier(v.toFloat())
|
|
274
|
+
"toolbarSize" -> editor.setToolbarSize(v.toFloat())
|
|
275
|
+
"backgroundMaskAlpha" -> editor.setBackgroundMaskAlpha(v.toFloat())
|
|
276
|
+
"customStatusPositionMultiplier" -> editor.setCustomStatusPositionMultiplier(v.toFloat())
|
|
277
|
+
"cameraFrameVerticalPositionMultiplier" -> editor.setCameraFrameVerticalPositionMultiplier(v.toFloat())
|
|
278
|
+
"cameraFrameLandscapeAspectRatio" -> editor.setCameraFrameLandscapeAspectRatio(v.toFloat())
|
|
279
|
+
"cameraFramePortraitAspectRatio" -> editor.setCameraFramePortraitAspectRatio(v.toFloat())
|
|
280
|
+
"cameraFrameCornerRadius" -> editor.setCameraFrameCornerRadius(v.toFloat())
|
|
281
|
+
"livenessAnimationPositionMultiplier" -> editor.setLivenessAnimationPositionMultiplier(v.toFloat())
|
|
282
|
+
"multipageAnimationFrontImage" -> editor.setMultipageAnimationFrontImage(v.toDrawable(context))
|
|
283
|
+
"multipageAnimationBackImage" -> editor.setMultipageAnimationBackImage(v.toDrawable(context))
|
|
284
|
+
"borderBackgroundImage" -> editor.setBorderBackgroundImage(v.toDrawable(context))
|
|
285
|
+
"helpAnimationImage" -> editor.setHelpAnimationImage(v.toDrawable(context))
|
|
286
|
+
"closeButtonImage" -> editor.setCloseButtonImage(v.toDrawable(context))
|
|
287
|
+
"captureButtonImage" -> editor.setCaptureButtonImage(v.toDrawable(context))
|
|
288
|
+
"changeFrameButtonCollapseImage" -> editor.setChangeFrameCollapseButtonImage(v.toDrawable(context))
|
|
289
|
+
"changeFrameButtonExpandImage" -> editor.setChangeFrameExpandButtonImage(v.toDrawable(context))
|
|
290
|
+
"cameraSwitchButtonImage" -> editor.setCameraSwitchButtonImage(v.toDrawable(context))
|
|
291
|
+
"torchButtonOnImage" -> editor.setTorchImageOn(v.toDrawable(context))
|
|
292
|
+
"torchButtonOffImage" -> editor.setTorchImageOff(v.toDrawable(context))
|
|
293
|
+
"livenessAnimationImage" -> editor.setLivenessAnimationImage(v.toDrawable(context))
|
|
294
|
+
"helpAnimationImageMatrix" -> editor.setHelpAnimationImageMatrix(v.toMatrix()).setHelpAnimationImageScaleType(ImageView.ScaleType.MATRIX)
|
|
295
|
+
"multipageAnimationFrontImageMatrix" -> editor.setMultipageAnimationFrontImageMatrix(v.toMatrix()).setMultipageAnimationFrontImageScaleType(ImageView.ScaleType.MATRIX)
|
|
296
|
+
"multipageAnimationBackImageMatrix" -> editor.setMultipageAnimationBackImageMatrix(v.toMatrix()).setMultipageAnimationBackImageScaleType(ImageView.ScaleType.MATRIX)
|
|
297
|
+
"livenessAnimationImageMatrix" -> editor.setLivenessAnimationImageMatrix(v.toMatrix()).setLivenessAnimationImageScaleType(ImageView.ScaleType.MATRIX)
|
|
298
|
+
"borderBackgroundImageMatrix" -> editor.setBorderBackgroundImageMatrix(v.toMatrix()).setBorderBackgroundImageScaleType(ImageView.ScaleType.MATRIX)
|
|
299
|
+
"customLabelStatus" -> editor.setCustomLabelStatus(SpannableString(v as String))
|
|
300
|
+
"cameraFrameLineCap" -> editor.setCameraFrameLineCap(Paint.Cap.values()[v.toInt()])
|
|
301
|
+
"uiCustomizationLayer" -> editor.setUiCustomizationLayer(v as JSONObject)
|
|
302
|
+
"colors" -> setColors(editor, v as JSONObject)
|
|
303
|
+
"fonts" -> setFonts(editor, v as JSONObject)
|
|
304
|
+
"images" -> setImages(editor, v as JSONObject, context)
|
|
305
|
+
"statusTextFont" -> {
|
|
306
|
+
val font = typefaceFromJSON(v as JSONObject)
|
|
307
|
+
editor.setStatusTextFont(font.first)
|
|
308
|
+
font.second?.let { editor.setStatusTextSize(it) }
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
"resultStatusTextFont" -> {
|
|
312
|
+
val font = typefaceFromJSON(v as JSONObject)
|
|
313
|
+
editor.setResultStatusTextFont(font.first)
|
|
314
|
+
font.second?.let { editor.setResultStatusTextSize(it) }
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
editor.applyImmediately(context)
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
fun getCustomization(customization: ParamsCustomization) = mapOf(
|
|
321
|
+
"showStatusMessages" to customization.isShowStatusMessages,
|
|
322
|
+
"showResultStatusMessages" to customization.isShowResultStatusMessages,
|
|
323
|
+
"showHelpAnimation" to customization.isShowHelpAnimation,
|
|
324
|
+
"showNextPageAnimation" to customization.isShowNextPageAnimation,
|
|
325
|
+
"showBackgroundMask" to customization.isShowBackgroundMask,
|
|
326
|
+
"cameraFrameBorderWidth" to customization.cameraFrameBorderWidth,
|
|
327
|
+
"cameraFrameLineLength" to customization.cameraFrameLineLength,
|
|
328
|
+
"cameraFrameShapeType" to customization.cameraFrameShapeType,
|
|
329
|
+
"cameraFrameOffsetWidth" to customization.cameraFrameOffsetWidth,
|
|
330
|
+
"activityIndicatorSize" to customization.activityIndicatorSize,
|
|
331
|
+
"status" to customization.status,
|
|
332
|
+
"resultStatus" to customization.resultStatus,
|
|
333
|
+
"cameraFrameDefaultColor" to customization.cameraFrameDefaultColor.toLong(),
|
|
334
|
+
"cameraFrameActiveColor" to customization.cameraFrameActiveColor.toLong(),
|
|
335
|
+
"statusTextColor" to customization.statusTextColor.toLong(),
|
|
336
|
+
"resultStatusTextColor" to customization.resultStatusTextColor.toLong(),
|
|
337
|
+
"resultStatusBackgroundColor" to customization.resultStatusBackgroundColor.toLong(),
|
|
338
|
+
"multipageButtonBackgroundColor" to customization.multipageButtonBackgroundColor.toLong(),
|
|
339
|
+
"tintColor" to customization.tintColor.toLong(),
|
|
340
|
+
"activityIndicatorColor" to customization.activityIndicatorColor.toLong(),
|
|
341
|
+
"statusBackgroundColor" to customization.statusBackgroundColor.toLong(),
|
|
342
|
+
"cameraPreviewBackgroundColor" to customization.cameraPreviewBackgroundColor.toLong(),
|
|
343
|
+
"statusPositionMultiplier" to customization.statusPositionMultiplier,
|
|
344
|
+
"resultStatusPositionMultiplier" to customization.resultStatusPositionMultiplier,
|
|
345
|
+
"backgroundMaskAlpha" to customization.backgroundMaskAlpha,
|
|
346
|
+
"toolbarSize" to customization.toolbarSize,
|
|
347
|
+
"customStatusPositionMultiplier" to customization.customStatusPositionMultiplier,
|
|
348
|
+
"cameraFrameVerticalPositionMultiplier" to customization.cameraFrameVerticalPositionMultiplier,
|
|
349
|
+
"cameraFrameLandscapeAspectRatio" to customization.cameraFrameLandscapeAspectRatio,
|
|
350
|
+
"cameraFramePortraitAspectRatio" to customization.cameraFramePortraitAspectRatio,
|
|
351
|
+
"cameraFrameCornerRadius" to customization.cameraFrameCornerRadius,
|
|
352
|
+
"livenessAnimationPositionMultiplier" to customization.livenessAnimationPositionMultiplier,
|
|
353
|
+
"multipageAnimationFrontImage" to customization.multipageAnimationFrontImage.toString(),
|
|
354
|
+
"multipageAnimationBackImage" to customization.multipageAnimationBackImage.toString(),
|
|
355
|
+
"borderBackgroundImage" to customization.borderBackgroundImage.toString(),
|
|
356
|
+
"helpAnimationImage" to customization.helpAnimationImageDrawable.toString(),
|
|
357
|
+
"closeButtonImage" to customization.closeButtonDrawable.toString(),
|
|
358
|
+
"captureButtonImage" to customization.captureButtonDrawable.toString(),
|
|
359
|
+
"changeFrameButtonCollapseImage" to customization.changeFrameCollapseButtonDrawable.toString(),
|
|
360
|
+
"changeFrameButtonExpandImage" to customization.changeFrameExpandButtonDrawable.toString(),
|
|
361
|
+
"cameraSwitchButtonImage" to customization.cameraSwitchButtonDrawable.toString(),
|
|
362
|
+
"torchButtonOnImage" to customization.torchImageOnDrawable.toString(),
|
|
363
|
+
"torchButtonOffImage" to customization.torchImageOffDrawable.toString(),
|
|
364
|
+
"livenessAnimationImage" to customization.livenessAnimationImage.toString(),
|
|
365
|
+
"helpAnimationImageMatrix" to customization.helpAnimationImageMatrix.generate(),
|
|
366
|
+
"multipageAnimationFrontImageMatrix" to customization.multipageAnimationFrontImageMatrix.generate(),
|
|
367
|
+
"multipageAnimationBackImageMatrix" to customization.multipageAnimationBackImageMatrix.generate(),
|
|
368
|
+
"livenessAnimationImageMatrix" to customization.livenessAnimationImageMatrix.generate(),
|
|
369
|
+
"borderBackgroundImageMatrix" to customization.borderBackgroundImageMatrix.generate(),
|
|
370
|
+
"statusTextFont" to generateTypeface(customization.statusTextFont, customization.statusTextSize),
|
|
371
|
+
"resultStatusTextFont" to generateTypeface(customization.resultStatusTextFont, customization.resultStatusTextSize),
|
|
372
|
+
"customLabelStatus" to customization.customLabelStatus?.toString(),
|
|
373
|
+
"cameraFrameLineCap" to paintCapToInt(customization.cameraFrameLineCap),
|
|
374
|
+
"uiCustomizationLayer" to customization.uiCustomizationLayer,
|
|
375
|
+
"colors" to getColors(customization.colors),
|
|
376
|
+
"fonts" to getFonts(customization.typeFaces, customization.fontSizes),
|
|
377
|
+
"images" to getImages(customization.images)
|
|
378
|
+
).toJsonObject()
|
|
379
|
+
|
|
380
|
+
fun setRfidScenario(rfidScenario: RfidScenario, opts: JSONObject) = opts.forEach { k, v ->
|
|
381
|
+
when (k) {
|
|
382
|
+
"paceStaticBinding" -> rfidScenario.isPaceStaticBinding = v as Boolean
|
|
383
|
+
"onlineTA" -> rfidScenario.isOnlineTA = v as Boolean
|
|
384
|
+
"writeEid" -> rfidScenario.isWriteEid = v as Boolean
|
|
385
|
+
"universalAccessRights" -> rfidScenario.isUniversalAccessRights = v as Boolean
|
|
386
|
+
"authorizedRestrictedIdentification" -> rfidScenario.isAuthorizedRestrictedIdentification = v as Boolean
|
|
387
|
+
"auxVerificationCommunityID" -> rfidScenario.isAuxVerificationCommunityID = v as Boolean
|
|
388
|
+
"auxVerificationDateOfBirth" -> rfidScenario.isAuxVerificationDateOfBirth = v as Boolean
|
|
389
|
+
"skipAA" -> rfidScenario.isSkipAA = v as Boolean
|
|
390
|
+
"strictProcessing" -> rfidScenario.isStrictProcessing = v as Boolean
|
|
391
|
+
"pkdDSCertPriority" -> rfidScenario.isPkdDSCertPriority = v as Boolean
|
|
392
|
+
"pkdUseExternalCSCA" -> rfidScenario.isPkdUseExternalCSCA = v as Boolean
|
|
393
|
+
"trustedPKD" -> rfidScenario.isTrustedPKD = v as Boolean
|
|
394
|
+
"passiveAuth" -> rfidScenario.isPassiveAuth = v as Boolean
|
|
395
|
+
"useSFI" -> rfidScenario.isUseSFI = v as Boolean
|
|
396
|
+
"readEPassport" -> rfidScenario.isReadEPassport = v as Boolean
|
|
397
|
+
"readEID" -> rfidScenario.isReadEID = v as Boolean
|
|
398
|
+
"readEDL" -> rfidScenario.isReadEDL = v as Boolean
|
|
399
|
+
"authorizedSTSignature" -> rfidScenario.isAuthorizedSTSignature = v as Boolean
|
|
400
|
+
"authorizedSTQSignature" -> rfidScenario.isAuthorizedSTQSignature = v as Boolean
|
|
401
|
+
"authorizedWriteDG17" -> rfidScenario.isAuthorizedWriteDG17 = v as Boolean
|
|
402
|
+
"authorizedWriteDG18" -> rfidScenario.isAuthorizedWriteDG18 = v as Boolean
|
|
403
|
+
"authorizedWriteDG19" -> rfidScenario.isAuthorizedWriteDG19 = v as Boolean
|
|
404
|
+
"authorizedWriteDG20" -> rfidScenario.isAuthorizedWriteDG20 = v as Boolean
|
|
405
|
+
"authorizedWriteDG21" -> rfidScenario.isAuthorizedWriteDG21 = v as Boolean
|
|
406
|
+
"authorizedVerifyAge" -> rfidScenario.isAuthorizedVerifyAge = v as Boolean
|
|
407
|
+
"authorizedVerifyCommunityID" -> rfidScenario.isAuthorizedVerifyCommunityID = v as Boolean
|
|
408
|
+
"authorizedPrivilegedTerminal" -> rfidScenario.isAuthorizedPrivilegedTerminal = v as Boolean
|
|
409
|
+
"authorizedCANAllowed" -> rfidScenario.isAuthorizedCANAllowed = v as Boolean
|
|
410
|
+
"authorizedPINManagement" -> rfidScenario.isAuthorizedPINManagment = v as Boolean
|
|
411
|
+
"authorizedInstallCert" -> rfidScenario.isAuthorizedInstallCert = v as Boolean
|
|
412
|
+
"authorizedInstallQCert" -> rfidScenario.isAuthorizedInstallQCert = v as Boolean
|
|
413
|
+
"applyAmendments" -> rfidScenario.isApplyAmendments = v as Boolean
|
|
414
|
+
"autoSettings" -> rfidScenario.isAutoSettings = v as Boolean
|
|
415
|
+
"proceedReadingAlways" -> rfidScenario.proceedReadingAlways = v as Boolean
|
|
416
|
+
"signManagementAction" -> rfidScenario.signManagementAction = v.toInt()
|
|
417
|
+
"readingBuffer" -> rfidScenario.readingBuffer = v.toInt()
|
|
418
|
+
"onlineTAToSignDataType" -> rfidScenario.onlineTAToSignDataType = v.toInt()
|
|
419
|
+
"profilerType" -> rfidScenario.profilerType = v.toInt()
|
|
420
|
+
"authProcType" -> rfidScenario.authProcType = v.toInt()
|
|
421
|
+
"baseSMProcedure" -> rfidScenario.baseSMProcedure = v.toInt()
|
|
422
|
+
"pacePasswordType" -> rfidScenario.pacePasswordType = v.toInt()
|
|
423
|
+
"terminalType" -> rfidScenario.terminalType = v.toInt()
|
|
424
|
+
"defaultReadingBufferSize" -> rfidScenario.defaultReadingBufferSize = v.toInt()
|
|
425
|
+
"password" -> rfidScenario.password = v as String
|
|
426
|
+
"pkdPA" -> rfidScenario.pkdPA = v as String
|
|
427
|
+
"pkdEAC" -> rfidScenario.pkdEAC = v as String
|
|
428
|
+
"mrz" -> rfidScenario.mrz = v as String
|
|
429
|
+
"eSignPINDefault" -> rfidScenario.seteSignPINDefault(v as String)
|
|
430
|
+
"eSignPINNewValue" -> rfidScenario.seteSignPINNewValue(v as String)
|
|
431
|
+
"ePassportDataGroups" -> setDataGroups(rfidScenario.ePassportDataGroups(), v as JSONObject)
|
|
432
|
+
"eIDDataGroups" -> setDataGroups(rfidScenario.eIDDataGroups(), v as JSONObject)
|
|
433
|
+
"eDLDataGroups" -> setDataGroups(rfidScenario.eDLDataGroups(), v as JSONObject)
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
fun getRfidScenario(rfidScenario: RfidScenario) = mapOf(
|
|
438
|
+
"paceStaticBinding" to rfidScenario.isPaceStaticBinding,
|
|
439
|
+
"onlineTA" to rfidScenario.isOnlineTA,
|
|
440
|
+
"writeEid" to rfidScenario.isWriteEid,
|
|
441
|
+
"universalAccessRights" to rfidScenario.isUniversalAccessRights,
|
|
442
|
+
"authorizedRestrictedIdentification" to rfidScenario.isAuthorizedRestrictedIdentification,
|
|
443
|
+
"auxVerificationCommunityID" to rfidScenario.isAuxVerificationCommunityID,
|
|
444
|
+
"auxVerificationDateOfBirth" to rfidScenario.isAuxVerificationDateOfBirth,
|
|
445
|
+
"skipAA" to rfidScenario.isSkipAA,
|
|
446
|
+
"strictProcessing" to rfidScenario.isStrictProcessing,
|
|
447
|
+
"pkdDSCertPriority" to rfidScenario.isPkdDSCertPriority,
|
|
448
|
+
"pkdUseExternalCSCA" to rfidScenario.isPkdUseExternalCSCA,
|
|
449
|
+
"trustedPKD" to rfidScenario.isTrustedPKD,
|
|
450
|
+
"passiveAuth" to rfidScenario.isPassiveAuth,
|
|
451
|
+
"useSFI" to rfidScenario.isUseSFI,
|
|
452
|
+
"readEPassport" to rfidScenario.isReadEPassport,
|
|
453
|
+
"readEID" to rfidScenario.isReadEID,
|
|
454
|
+
"readEDL" to rfidScenario.isReadEDL,
|
|
455
|
+
"authorizedSTSignature" to rfidScenario.isAuthorizedSTSignature,
|
|
456
|
+
"authorizedSTQSignature" to rfidScenario.isAuthorizedSTQSignature,
|
|
457
|
+
"authorizedWriteDG17" to rfidScenario.isAuthorizedWriteDG17,
|
|
458
|
+
"authorizedWriteDG18" to rfidScenario.isAuthorizedWriteDG18,
|
|
459
|
+
"authorizedWriteDG19" to rfidScenario.isAuthorizedWriteDG19,
|
|
460
|
+
"authorizedWriteDG20" to rfidScenario.isAuthorizedWriteDG20,
|
|
461
|
+
"authorizedWriteDG21" to rfidScenario.isAuthorizedWriteDG21,
|
|
462
|
+
"authorizedVerifyAge" to rfidScenario.isAuthorizedVerifyAge,
|
|
463
|
+
"authorizedVerifyCommunityID" to rfidScenario.isAuthorizedVerifyCommunityID,
|
|
464
|
+
"authorizedPrivilegedTerminal" to rfidScenario.isAuthorizedPrivilegedTerminal,
|
|
465
|
+
"authorizedCANAllowed" to rfidScenario.isAuthorizedCANAllowed,
|
|
466
|
+
"authorizedPINManagement" to rfidScenario.isAuthorizedPINManagment,
|
|
467
|
+
"authorizedInstallCert" to rfidScenario.isAuthorizedInstallCert,
|
|
468
|
+
"authorizedInstallQCert" to rfidScenario.isAuthorizedInstallQCert,
|
|
469
|
+
"applyAmendments" to rfidScenario.isApplyAmendments,
|
|
470
|
+
"autoSettings" to rfidScenario.isAutoSettings,
|
|
471
|
+
"proceedReadingAlways" to rfidScenario.proceedReadingAlways,
|
|
472
|
+
"signManagementAction" to rfidScenario.signManagementAction,
|
|
473
|
+
"readingBuffer" to rfidScenario.readingBuffer,
|
|
474
|
+
"onlineTAToSignDataType" to rfidScenario.onlineTAToSignDataType,
|
|
475
|
+
"profilerType" to rfidScenario.profilerType,
|
|
476
|
+
"authProcType" to rfidScenario.authProcType,
|
|
477
|
+
"baseSMProcedure" to rfidScenario.baseSMProcedure,
|
|
478
|
+
"pacePasswordType" to rfidScenario.pacePasswordType,
|
|
479
|
+
"terminalType" to rfidScenario.terminalType,
|
|
480
|
+
"defaultReadingBufferSize" to rfidScenario.defaultReadingBufferSize,
|
|
481
|
+
"password" to rfidScenario.password,
|
|
482
|
+
"pkdPA" to rfidScenario.pkdPA,
|
|
483
|
+
"pkdEAC" to rfidScenario.pkdEAC,
|
|
484
|
+
"mrz" to rfidScenario.mrz,
|
|
485
|
+
"eSignPINDefault" to rfidScenario.geteSignPINDefault(),
|
|
486
|
+
"eSignPINNewValue" to rfidScenario.geteSignPINNewValue(),
|
|
487
|
+
"ePassportDataGroups" to getDataGroups(rfidScenario.ePassportDataGroups()),
|
|
488
|
+
"eIDDataGroups" to getDataGroups(rfidScenario.eIDDataGroups()),
|
|
489
|
+
"eDLDataGroups" to getDataGroups(rfidScenario.eDLDataGroups())
|
|
490
|
+
).toJsonObject()
|
|
491
|
+
|
|
492
|
+
fun setDataGroups(dataGroup: DataGroups, opts: JSONObject) = opts.forEach { k, v ->
|
|
493
|
+
val value = v as Boolean
|
|
494
|
+
when (k) {
|
|
495
|
+
"DG1" -> dataGroup.isDG1 = value
|
|
496
|
+
"DG2" -> dataGroup.isDG2 = value
|
|
497
|
+
"DG3" -> dataGroup.isDG3 = value
|
|
498
|
+
"DG4" -> dataGroup.isDG4 = value
|
|
499
|
+
"DG5" -> dataGroup.isDG5 = value
|
|
500
|
+
"DG6" -> dataGroup.isDG6 = value
|
|
501
|
+
"DG7" -> dataGroup.isDG7 = value
|
|
502
|
+
"DG8" -> dataGroup.isDG8 = value
|
|
503
|
+
"DG9" -> dataGroup.isDG9 = value
|
|
504
|
+
"DG10" -> dataGroup.isDG10 = value
|
|
505
|
+
"DG11" -> dataGroup.isDG11 = value
|
|
506
|
+
"DG12" -> dataGroup.isDG12 = value
|
|
507
|
+
"DG13" -> dataGroup.isDG13 = value
|
|
508
|
+
"DG14" -> dataGroup.isDG14 = value
|
|
509
|
+
}
|
|
510
|
+
if (dataGroup is EPassportDataGroups) when (k) {
|
|
511
|
+
"DG15" -> dataGroup.isDG15 = value
|
|
512
|
+
"DG16" -> dataGroup.isDG16 = value
|
|
513
|
+
}
|
|
514
|
+
if (dataGroup is EIDDataGroups) when (k) {
|
|
515
|
+
"DG15" -> dataGroup.isDG15 = value
|
|
516
|
+
"DG16" -> dataGroup.isDG16 = value
|
|
517
|
+
"DG17" -> dataGroup.isDG17 = value
|
|
518
|
+
"DG18" -> dataGroup.isDG18 = value
|
|
519
|
+
"DG19" -> dataGroup.isDG19 = value
|
|
520
|
+
"DG20" -> dataGroup.isDG20 = value
|
|
521
|
+
"DG21" -> dataGroup.isDG21 = value
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
fun getDataGroups(dataGroup: DataGroups): JSONObject {
|
|
526
|
+
val result = mutableMapOf(
|
|
527
|
+
"DG1" to dataGroup.isDG1,
|
|
528
|
+
"DG2" to dataGroup.isDG2,
|
|
529
|
+
"DG3" to dataGroup.isDG3,
|
|
530
|
+
"DG4" to dataGroup.isDG4,
|
|
531
|
+
"DG5" to dataGroup.isDG5,
|
|
532
|
+
"DG6" to dataGroup.isDG6,
|
|
533
|
+
"DG7" to dataGroup.isDG7,
|
|
534
|
+
"DG8" to dataGroup.isDG8,
|
|
535
|
+
"DG9" to dataGroup.isDG9,
|
|
536
|
+
"DG10" to dataGroup.isDG10,
|
|
537
|
+
"DG11" to dataGroup.isDG11,
|
|
538
|
+
"DG12" to dataGroup.isDG12,
|
|
539
|
+
"DG13" to dataGroup.isDG13,
|
|
540
|
+
"DG14" to dataGroup.isDG14
|
|
541
|
+
)
|
|
542
|
+
if (dataGroup is EPassportDataGroups) {
|
|
543
|
+
result["DG15"] = dataGroup.isDG15
|
|
544
|
+
result["DG16"] = dataGroup.isDG16
|
|
545
|
+
}
|
|
546
|
+
if (dataGroup is EIDDataGroups) {
|
|
547
|
+
result["DG15"] = dataGroup.isDG15
|
|
548
|
+
result["DG16"] = dataGroup.isDG16
|
|
549
|
+
result["DG17"] = dataGroup.isDG17
|
|
550
|
+
result["DG18"] = dataGroup.isDG18
|
|
551
|
+
result["DG19"] = dataGroup.isDG19
|
|
552
|
+
result["DG20"] = dataGroup.isDG20
|
|
553
|
+
result["DG21"] = dataGroup.isDG21
|
|
554
|
+
}
|
|
555
|
+
return result.toJsonObject()
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
fun setImageQA(input: ImageQA, opts: JSONObject) = opts.forEach { k, v ->
|
|
559
|
+
when (k) {
|
|
560
|
+
"focusCheck" -> input.focusCheck = v as Boolean
|
|
561
|
+
"glaresCheck" -> input.glaresCheck = v as Boolean
|
|
562
|
+
"colornessCheck" -> input.colornessCheck = v as Boolean
|
|
563
|
+
"screenCapture" -> input.screenCapture = v as Boolean
|
|
564
|
+
"dpiThreshold" -> input.dpiThreshold = v.toInt()
|
|
565
|
+
"angleThreshold" -> input.angleThreshold = v.toInt()
|
|
566
|
+
"documentPositionIndent" -> input.documentPositionIndent = v.toInt()
|
|
567
|
+
"brightnessThreshold" -> input.brightnessThreshold = v.toDouble()
|
|
568
|
+
"expectedPass" -> input.expectedPass = v.toIntArray()
|
|
569
|
+
"glaresCheckParams" -> input.glaresCheckParams = glaresCheckParamsFromJSON(v as JSONObject)
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
fun getImageQA(input: ImageQA) = mapOf(
|
|
574
|
+
"focusCheck" to input.focusCheck,
|
|
575
|
+
"glaresCheck" to input.glaresCheck,
|
|
576
|
+
"colornessCheck" to input.colornessCheck,
|
|
577
|
+
"screenCapture" to input.screenCapture,
|
|
578
|
+
"dpiThreshold" to input.dpiThreshold,
|
|
579
|
+
"angleThreshold" to input.angleThreshold,
|
|
580
|
+
"documentPositionIndent" to input.documentPositionIndent,
|
|
581
|
+
"brightnessThreshold" to input.brightnessThreshold,
|
|
582
|
+
"expectedPass" to input.expectedPass.generate(),
|
|
583
|
+
"glaresCheckParams" to generateGlaresCheckParams(input.glaresCheckParams),
|
|
584
|
+
).toJsonObject()
|
|
585
|
+
|
|
586
|
+
fun setAuthenticityParams(input: AuthenticityParams, opts: JSONObject) = opts.forEach { k, v ->
|
|
587
|
+
when (k) {
|
|
588
|
+
"useLivenessCheck" -> input.useLivenessCheck = v as Boolean
|
|
589
|
+
"checkUVLuminiscence" -> input.checkUVLuminiscence = v as Boolean
|
|
590
|
+
"checkIRB900" -> input.checkIRB900 = v as Boolean
|
|
591
|
+
"checkImagePatterns" -> input.checkImagePatterns = v as Boolean
|
|
592
|
+
"checkFibers" -> input.checkFibers = v as Boolean
|
|
593
|
+
"checkExtMRZ" -> input.checkExtMRZ = v as Boolean
|
|
594
|
+
"checkExtOCR" -> input.checkExtOCR = v as Boolean
|
|
595
|
+
"checkAxial" -> input.checkAxial = v as Boolean
|
|
596
|
+
"checkBarcodeFormat" -> input.checkBarcodeFormat = v as Boolean
|
|
597
|
+
"checkIRVisibility" -> input.checkIRVisibility = v as Boolean
|
|
598
|
+
"checkIPI" -> input.checkIPI = v as Boolean
|
|
599
|
+
"checkPhotoEmbedding" -> input.checkPhotoEmbedding = v as Boolean
|
|
600
|
+
"checkPhotoComparison" -> input.checkPhotoComparison = v as Boolean
|
|
601
|
+
"checkLetterScreen" -> input.checkLetterScreen = v as Boolean
|
|
602
|
+
"livenessParams" -> {
|
|
603
|
+
if (input.livenessParams == null) input.livenessParams = LivenessParams.defaultParams()
|
|
604
|
+
setLivenessParams(input.livenessParams!!, v as JSONObject)
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
fun getAuthenticityParams(input: AuthenticityParams?) = input?.let {
|
|
610
|
+
mapOf(
|
|
611
|
+
"useLivenessCheck" to it.useLivenessCheck,
|
|
612
|
+
"checkUVLuminiscence" to it.checkUVLuminiscence,
|
|
613
|
+
"checkIRB900" to input.checkIRB900,
|
|
614
|
+
"checkImagePatterns" to it.checkImagePatterns,
|
|
615
|
+
"checkFibers" to it.checkFibers,
|
|
616
|
+
"checkExtMRZ" to it.checkExtMRZ,
|
|
617
|
+
"checkExtOCR" to it.checkExtOCR,
|
|
618
|
+
"checkAxial" to it.checkAxial,
|
|
619
|
+
"checkBarcodeFormat" to it.checkBarcodeFormat,
|
|
620
|
+
"checkIRVisibility" to it.checkIRVisibility,
|
|
621
|
+
"checkIPI" to it.checkIPI,
|
|
622
|
+
"checkPhotoEmbedding" to it.checkPhotoEmbedding,
|
|
623
|
+
"checkPhotoComparison" to it.checkPhotoComparison,
|
|
624
|
+
"checkLetterScreen" to it.checkLetterScreen,
|
|
625
|
+
"livenessParams" to getLivenessParams(it.livenessParams)
|
|
626
|
+
).toJsonObject()
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
fun setLivenessParams(input: LivenessParams, opts: JSONObject) = opts.forEach { k, v ->
|
|
630
|
+
when (k) {
|
|
631
|
+
"checkOVI" -> input.checkOVI = v as Boolean
|
|
632
|
+
"checkMLI" -> input.checkMLI = v as Boolean
|
|
633
|
+
"checkHolo" -> input.checkHolo = v as Boolean
|
|
634
|
+
"checkED" -> input.checkED = v as Boolean
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
fun getLivenessParams(input: LivenessParams?) = input?.let {
|
|
639
|
+
mapOf(
|
|
640
|
+
"checkOVI" to input.checkOVI,
|
|
641
|
+
"checkMLI" to input.checkMLI,
|
|
642
|
+
"checkHolo" to input.checkHolo,
|
|
643
|
+
"checkED" to input.checkED
|
|
644
|
+
).toJsonObject()
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
fun setColors(input: ParamsCustomization.CustomizationEditor, opts: JSONObject) = opts.forEach { key, v ->
|
|
648
|
+
val value = v.toLong()
|
|
649
|
+
when (key) {
|
|
650
|
+
"rfidProcessingScreenBackground" -> input.setColor(CustomizationColor.RFID_PROCESSING_SCREEN_BACKGROUND, value)
|
|
651
|
+
"rfidProcessingScreenHintLabelText" -> input.setColor(CustomizationColor.RFID_PROCESSING_SCREEN_HINT_LABEL_TEXT, value)
|
|
652
|
+
"rfidProcessingScreenHintLabelBackground" -> input.setColor(CustomizationColor.RFID_PROCESSING_SCREEN_HINT_LABEL_BACKGROUND, value)
|
|
653
|
+
"rfidProcessingScreenProgressLabelText" -> input.setColor(CustomizationColor.RFID_PROCESSING_SCREEN_PROGRESS_LABEL_TEXT, value)
|
|
654
|
+
"rfidProcessingScreenProgressBar" -> input.setColor(CustomizationColor.RFID_PROCESSING_SCREEN_PROGRESS_BAR, value)
|
|
655
|
+
"rfidProcessingScreenProgressBarBackground" -> input.setColor(CustomizationColor.RFID_PROCESSING_SCREEN_PROGRESS_BAR_BACKGROUND, value)
|
|
656
|
+
"rfidProcessingScreenResultLabelText" -> input.setColor(CustomizationColor.RFID_PROCESSING_SCREEN_RESULT_LABEL_TEXT, value)
|
|
657
|
+
}
|
|
658
|
+
}
|
|
659
|
+
|
|
660
|
+
fun getColors(input: Map<CustomizationColor, Long>) = mapOf(
|
|
661
|
+
"rfidProcessingScreenBackground" to input[CustomizationColor.RFID_PROCESSING_SCREEN_BACKGROUND],
|
|
662
|
+
"rfidProcessingScreenHintLabelText" to input[CustomizationColor.RFID_PROCESSING_SCREEN_HINT_LABEL_TEXT],
|
|
663
|
+
"rfidProcessingScreenHintLabelBackground" to input[CustomizationColor.RFID_PROCESSING_SCREEN_HINT_LABEL_BACKGROUND],
|
|
664
|
+
"rfidProcessingScreenProgressLabelText" to input[CustomizationColor.RFID_PROCESSING_SCREEN_PROGRESS_LABEL_TEXT],
|
|
665
|
+
"rfidProcessingScreenProgressBar" to input[CustomizationColor.RFID_PROCESSING_SCREEN_PROGRESS_BAR],
|
|
666
|
+
"rfidProcessingScreenProgressBarBackground" to input[CustomizationColor.RFID_PROCESSING_SCREEN_PROGRESS_BAR_BACKGROUND],
|
|
667
|
+
"rfidProcessingScreenResultLabelText" to input[CustomizationColor.RFID_PROCESSING_SCREEN_RESULT_LABEL_TEXT],
|
|
668
|
+
).toJsonObject()
|
|
669
|
+
|
|
670
|
+
fun setFonts(input: ParamsCustomization.CustomizationEditor, opts: JSONObject) = opts.forEach { key, value ->
|
|
671
|
+
when (key) {
|
|
672
|
+
"rfidProcessingScreenHintLabel" -> CustomizationFont.RFID_PROCESSING_SCREEN_HINT_LABEL.setFont(input, value)
|
|
673
|
+
"rfidProcessingScreenProgressLabel" -> CustomizationFont.RFID_PROCESSING_SCREEN_PROGRESS_LABEL.setFont(input, value)
|
|
674
|
+
"rfidProcessingScreenResultLabel" -> CustomizationFont.RFID_PROCESSING_SCREEN_RESULT_LABEL.setFont(input, value)
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
fun getFonts(fonts: Map<CustomizationFont, Typeface>, sizes: Map<CustomizationFont, Int>) = mapOf(
|
|
679
|
+
"rfidProcessingScreenHintLabel" to CustomizationFont.RFID_PROCESSING_SCREEN_HINT_LABEL.generate(fonts, sizes),
|
|
680
|
+
"rfidProcessingScreenProgressLabel" to CustomizationFont.RFID_PROCESSING_SCREEN_PROGRESS_LABEL.generate(fonts, sizes),
|
|
681
|
+
"rfidProcessingScreenResultLabel" to CustomizationFont.RFID_PROCESSING_SCREEN_RESULT_LABEL.generate(fonts, sizes),
|
|
682
|
+
).toJsonObject()
|
|
683
|
+
|
|
684
|
+
fun setImages(input: ParamsCustomization.CustomizationEditor, opts: JSONObject, context: Context) = opts.forEach { key, v ->
|
|
685
|
+
when (key) {
|
|
686
|
+
"rfidProcessingScreenFailureImage" -> input.setImage(CustomizationImage.RFID_PROCESSING_SCREEN_FAILURE_IMAGE, v.toDrawable(context))
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
|
|
690
|
+
fun getImages(input: Map<CustomizationImage, Drawable>) = mapOf(
|
|
691
|
+
"rfidProcessingScreenFailureImage" to (input[CustomizationImage.RFID_PROCESSING_SCREEN_FAILURE_IMAGE] ?: ContextCompat.getDrawable(context, com.regula.documentreader.api.R.drawable.reg_ic_error)).toString(),
|
|
692
|
+
).toJsonObject()
|