@regulaforensics/react-native-document-reader-api 9.11.946-rc → 9.11.947-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.
@@ -0,0 +1,1171 @@
1
+ import UIKit
2
+ import AVFoundation
3
+ import DocumentReader
4
+
5
+ // MARK: - ImageQA
6
+
7
+ public extension ImageQA {
8
+ static func decode(_ it: Any?) -> Self? {
9
+ guard let it = it as? [String: Any] else { return nil }
10
+ return Self().update(it)
11
+ }
12
+ @discardableResult
13
+ func update(_ it: [String: Any]) -> Self {
14
+ for (k, v) in it {
15
+ switch k {
16
+ case("dpiThreshold"): self.dpiThreshold = v as? NSNumber
17
+ case("angleThreshold"): self.angleThreshold = v as? NSNumber
18
+ case("focusCheck"): self.focusCheck = v as? NSNumber
19
+ case("glaresCheck"): self.glaresCheck = v as? NSNumber
20
+ case("colornessCheck"): self.colornessCheck = v as? NSNumber
21
+ case("screenCapture"): self.screenCapture = v as? NSNumber
22
+ case("expectedPass"): self.expectedPass = (v as! [Int]).map { ImageQualityCheckType.decode($0) }
23
+ case("documentPositionIndent"): self.documentPositionIndent = v as? NSNumber
24
+ case("glaresCheckParams"): self.glaresCheckParams = ImageQA.GlaresCheckParams.decode(v)
25
+ case("brightnessThreshold"): self.brightnessThreshold = v as? NSNumber
26
+ case("occlusionCheck"): self.occlusionCheck = v as? NSNumber
27
+ case("occlusionCheckParams"): self.occlusionCheckParams = ImageQA.OcclusionCheckParams.decode(v)
28
+ default: break
29
+ }
30
+ }
31
+ return self
32
+ }
33
+ func encode() -> [String: Any?] {
34
+ return [
35
+ "dpiThreshold": self.dpiThreshold,
36
+ "angleThreshold": self.angleThreshold,
37
+ "focusCheck": self.focusCheck,
38
+ "glaresCheck": self.glaresCheck,
39
+ "colornessCheck": self.colornessCheck,
40
+ "screenCapture": self.screenCapture,
41
+ "expectedPass": self.expectedPass?.map { $0.encode() },
42
+ "documentPositionIndent": self.documentPositionIndent,
43
+ "glaresCheckParams": self.glaresCheckParams?.encode(),
44
+ "brightnessThreshold": self.brightnessThreshold,
45
+ "occlusionCheck": self.occlusionCheck,
46
+ "occlusionCheckParams": self.occlusionCheckParams?.encode(),
47
+ ]
48
+ }
49
+ }
50
+
51
+ // MARK: - Authenticity
52
+
53
+ public extension AuthenticityParams {
54
+ static func decode(_ it: Any?) -> Self? {
55
+ guard let it = it as? [String: Any] else { return nil }
56
+ return Self.default().update(it)
57
+ }
58
+ @discardableResult
59
+ func update(_ it: [String: Any]) -> Self {
60
+ for (k, v) in it {
61
+ switch k {
62
+ case("useLivenessCheck"): self.useLivenessCheck = v as? NSNumber
63
+ case("checkUVLuminiscence"): self.checkUVLuminiscence = v as? NSNumber
64
+ case("checkIRB900"): self.checkIRB900 = v as? NSNumber
65
+ case("checkImagePatterns"): self.checkImagePatterns = v as? NSNumber
66
+ case("checkFibers"): self.checkFibers = v as? NSNumber
67
+ case("checkExtMRZ"): self.checkExtMRZ = v as? NSNumber
68
+ case("checkExtOCR"): self.checkExtOCR = v as? NSNumber
69
+ case("checkAxial"): self.checkAxial = v as? NSNumber
70
+ case("checkBarcodeFormat"): self.checkBarcodeFormat = v as? NSNumber
71
+ case("checkIRVisibility"): self.checkIRVisibility = v as? NSNumber
72
+ case("checkIPI"): self.checkIPI = v as? NSNumber
73
+ case("checkPhotoEmbedding"): self.checkPhotoEmbedding = v as? NSNumber
74
+ case("checkPhotoComparison"): self.checkPhotoComparison = v as? NSNumber
75
+ case("checkLetterScreen"): self.checkLetterScreen = v as? NSNumber
76
+ case("checkSecurityText"): self.checkSecurityText = v as? NSNumber
77
+ case("checkProperties"): self.checkProperties = v as? NSNumber
78
+ case("livenessParams"): self.livenessParams = (self.livenessParams ?? LivenessParams.default()).update(v as! [String: Any])
79
+ case("propertiesParams"): self.propertiesParams = (self.propertiesParams ?? AuthenticityPropertiesParams.default()).update(v as! [String: Any])
80
+ default: break
81
+ }
82
+ }
83
+ return self
84
+ }
85
+ func encode() -> [String: Any?] {
86
+ return [
87
+ "useLivenessCheck": self.useLivenessCheck,
88
+ "checkUVLuminiscence": self.checkUVLuminiscence,
89
+ "checkIRB900": self.checkIRB900,
90
+ "checkImagePatterns": self.checkImagePatterns,
91
+ "checkFibers": self.checkFibers,
92
+ "checkExtMRZ": self.checkExtMRZ,
93
+ "checkExtOCR": self.checkExtOCR,
94
+ "checkAxial": self.checkAxial,
95
+ "checkBarcodeFormat": self.checkBarcodeFormat,
96
+ "checkIRVisibility": self.checkIRVisibility,
97
+ "checkIPI": self.checkIPI,
98
+ "checkPhotoEmbedding": self.checkPhotoEmbedding,
99
+ "checkPhotoComparison": self.checkPhotoComparison,
100
+ "checkLetterScreen": self.checkLetterScreen,
101
+ "checkSecurityText": self.checkSecurityText,
102
+ "checkProperties": self.checkProperties,
103
+ "livenessParams": self.livenessParams?.encode(),
104
+ "propertiesParams": self.propertiesParams?.encode(),
105
+ ]
106
+ }
107
+ }
108
+
109
+ public extension LivenessParams {
110
+ static func decode(_ it: Any?) -> Self? {
111
+ guard let it = it as? [String: Any] else { return nil }
112
+ return Self.default().update(it)
113
+ }
114
+ @discardableResult
115
+ func update(_ it: [String: Any]) -> Self {
116
+ for (k, v) in it {
117
+ switch k {
118
+ case("checkOVI"): self.checkOVI = v as? NSNumber
119
+ case("checkMLI"): self.checkMLI = v as? NSNumber
120
+ case("checkHolo"): self.checkHolo = v as? NSNumber
121
+ case("checkED"): self.checkED = v as? NSNumber
122
+ case("checkBlackAndWhiteCopy"): self.checkBlackAndWhiteCopy = v as? NSNumber
123
+ case("checkDynaprint"): self.checkDynaprint = v as? NSNumber
124
+ case("checkGeometry"): self.checkGeometry = v as? NSNumber
125
+ case("checkBarcodeBackground"): self.checkBarcodeBackground = v as? NSNumber
126
+ default: break
127
+ }
128
+ }
129
+ return self
130
+ }
131
+ func encode() -> [String: Any?] {
132
+ return [
133
+ "checkOVI": self.checkOVI,
134
+ "checkMLI": self.checkMLI,
135
+ "checkHolo": self.checkHolo,
136
+ "checkED": self.checkED,
137
+ "checkBlackAndWhiteCopy": self.checkBlackAndWhiteCopy,
138
+ "checkDynaprint": self.checkDynaprint,
139
+ "checkGeometry": self.checkGeometry,
140
+ "checkBarcodeBackground": self.checkBarcodeBackground,
141
+ ]
142
+ }
143
+ }
144
+
145
+ public extension AuthenticityPropertiesParams {
146
+ static func decode(_ it: Any?) -> Self? {
147
+ guard let it = it as? [String: Any] else { return nil }
148
+ return Self.default().update(it)
149
+ }
150
+ @discardableResult
151
+ func update(_ it: [String: Any]) -> Self {
152
+ for (k, v) in it {
153
+ switch k {
154
+ case("checkHoldersSignature"): self.checkHoldersSignature = v as? NSNumber
155
+ case("checkDocumentDamage"): self.checkDocumentDamage = v as? NSNumber
156
+ default: break
157
+ }
158
+ }
159
+ return self
160
+ }
161
+ func encode() -> [String: Any?] {
162
+ return [
163
+ "checkHoldersSignature": self.checkHoldersSignature,
164
+ "checkDocumentDamage": self.checkDocumentDamage,
165
+ ]
166
+ }
167
+ }
168
+
169
+ public extension DTCDataGroup {
170
+ static func decode(_ it: Any?) -> Self? {
171
+ guard let it = it as? [String: Any] else { return nil }
172
+ return Self().update(it)
173
+ }
174
+ @discardableResult
175
+ func update(_ it: [String: Any]) -> Self {
176
+ for (k, v) in it {
177
+ switch k {
178
+ case("DG17"): self.dG17 = v as! Bool
179
+ case("DG18"): self.dG18 = v as! Bool
180
+ case("DG22"): self.dG22 = v as! Bool
181
+ case("DG23"): self.dG23 = v as! Bool
182
+ case("DG24"): self.dG24 = v as! Bool
183
+ default: break
184
+ }
185
+ }
186
+ return self
187
+ }
188
+ func encode() -> [String: Any?] {
189
+ return [
190
+ "DG17": self.dG17,
191
+ "DG18": self.dG18,
192
+ "DG22": self.dG22,
193
+ "DG23": self.dG23,
194
+ "DG24": self.dG24,
195
+ ]
196
+ }
197
+ }
198
+
199
+ // MARK: - RFID
200
+
201
+ public extension RFIDScenario {
202
+ static func decode(_ it: Any?) -> Self? {
203
+ guard let it = it as? [String: Any] else { return nil }
204
+ return Self().update(it)
205
+ }
206
+ @discardableResult
207
+ func update(_ it: [String: Any]) -> Self {
208
+ for (k, v) in it {
209
+ switch k {
210
+ case("paceStaticBinding"): self.paceStaticBinding = v as! Bool
211
+ case("onlineTA"): self.onlineTA = v as! Bool
212
+ case("writeEid"): self.writeEid = v as! Bool
213
+ case("universalAccessRights"): self.universalAccessRights = v as! Bool
214
+ case("authorizedRestrictedIdentification"): self.authorizedRestrictedIdentification = v as! Bool
215
+ case("auxVerificationCommunityID"): self.auxVerificationCommunityID = v as! Bool
216
+ case("auxVerificationDateOfBirth"): self.auxVerificationDateOfBirth = v as! Bool
217
+ case("skipAA"): self.skipAA = v as! Bool
218
+ case("strictProcessing"): self.strictProcessing = v as! Bool
219
+ case("pkdDSCertPriority"): self.pkdDSCertPriority = v as! Bool
220
+ case("pkdUseExternalCSCA"): self.pkdUseExternalCSCA = v as! Bool
221
+ case("trustedPKD"): self.trustedPKD = v as! Bool
222
+ case("passiveAuth"): self.passiveAuth = v as! Bool
223
+ case("useSFI"): self.useSFI = v as! Bool
224
+ case("readEPassport"): self.readEPassport = v as! Bool
225
+ case("readEID"): self.readEID = v as! Bool
226
+ case("readEDL"): self.readEDL = v as! Bool
227
+ case("authorizedSTSignature"): self.authorizedSTSignature = v as! Bool
228
+ case("authorizedSTQSignature"): self.authorizedSTQSignature = v as! Bool
229
+ case("authorizedWriteDG17"): self.authorizedWriteDG17 = v as! Bool
230
+ case("authorizedWriteDG18"): self.authorizedWriteDG18 = v as! Bool
231
+ case("authorizedWriteDG19"): self.authorizedWriteDG19 = v as! Bool
232
+ case("authorizedWriteDG20"): self.authorizedWriteDG20 = v as! Bool
233
+ case("authorizedWriteDG21"): self.authorizedWriteDG21 = v as! Bool
234
+ case("authorizedVerifyAge"): self.authorizedVerifyAge = v as! Bool
235
+ case("authorizedVerifyCommunityID"): self.authorizedVerifyCommunityID = v as! Bool
236
+ case("authorizedPrivilegedTerminal"): self.authorizedPrivilegedTerminal = v as! Bool
237
+ case("authorizedCANAllowed"): self.authorizedCANAllowed = v as! Bool
238
+ case("authorizedPINManagement"): self.authorizedPINManagment = v as! Bool
239
+ case("authorizedInstallCert"): self.authorizedInstallCert = v as! Bool
240
+ case("authorizedInstallQCert"): self.authorizedInstallQCert = v as! Bool
241
+ case("applyAmendments"): self.applyAmendments = v as! Bool
242
+ case("autoSettings"): self.autoSettings = v as! Bool
243
+ case("proceedReadingAlways"): self.proceedReadingAlways = v as! Bool
244
+ case("readDTC"): self.readDTC = v as! Bool
245
+ case("mrzStrictCheck"): self.mrzStrictCheck = v as? NSNumber
246
+ case("loadCRLFromRemote"): self.loadCRLFromRemote = v as! Bool
247
+ case("independentSODStatus"): self.independentSODStatus = v as? NSNumber
248
+ case("readUser"): self.readUser = v as? NSNumber
249
+ case("signManagementAction"): self.signManagementAction = ESignManagementAction(rawValue: v as! Int)!
250
+ case("readingBuffer"): self.readingBuffer = RFIDReadingBufferSize(rawValue: v as! Int)!
251
+ case("onlineTAToSignDataType"): self.onlineTAToSignDataType = v as! Int32
252
+ case("profilerType"): self.profilerType = RFIDSdkProfilerType(rawValue: v as! UInt32)
253
+ case("authProcType"): self.authProcType = RFIDAuthenticationProcedureType(rawValue: v as! Int)!
254
+ case("baseSMProcedure"): self.baseSMProcedure = RFIDAccessControlProcedureType(rawValue: v as! Int)!
255
+ case("pacePasswordType"): self.pacePasswordType = RFIDPasswordType(rawValue: v as! Int)!
256
+ case("terminalType"): self.terminalType = RFIDTerminalType(rawValue: v as! Int)!
257
+ case("defaultReadingBufferSize"): self.defaultReadingBufferSize = v as! Int32
258
+ case("password"): self.password = v as! String
259
+ case("pkdPA"): self.pkdPA = v as! String
260
+ case("pkdEAC"): self.pkdEAC = v as! String
261
+ case("mrz"): self.mrz = v as! String
262
+ case("eSignPINDefault"): self.eSignPINDefault = v as! String
263
+ case("eSignPINNewValue"): self.eSignPINNewValue = v as! String
264
+ case("cardAccess"): self.cardAccess = v as? String
265
+ case("mrzHash"): self.mrzHash = v as! String
266
+ case("documentNumber"): self.documentNumber = v as? String
267
+ case("dateOfBirth"): self.dateOfBirth = v as? String
268
+ case("dateOfExpiry"): self.dateOfExpiry = v as? String
269
+ case("defaultUserPIN"): self.defaultUserPIN = v as? String
270
+ case("eDLDataGroups"): self.eDLDataGroups.update(v as! [String: Any])
271
+ case("ePassportDataGroups"): self.ePassportDataGroups.update(v as! [String: Any])
272
+ case("eIDDataGroups"): self.eIDDataGroups.update(v as! [String: Any])
273
+ case("dtcDataGroups"): self.dtcDataGroups.update(v as! [String: Any])
274
+ default: break
275
+ }
276
+ }
277
+ return self
278
+ }
279
+ func encode() -> [String: Any?] {
280
+ return [
281
+ "paceStaticBinding": self.paceStaticBinding,
282
+ "onlineTA": self.onlineTA,
283
+ "writeEid": self.writeEid,
284
+ "universalAccessRights": self.universalAccessRights,
285
+ "authorizedRestrictedIdentification": self.authorizedRestrictedIdentification,
286
+ "auxVerificationCommunityID": self.auxVerificationCommunityID,
287
+ "auxVerificationDateOfBirth": self.auxVerificationDateOfBirth,
288
+ "skipAA": self.skipAA,
289
+ "strictProcessing": self.strictProcessing,
290
+ "pkdDSCertPriority": self.pkdDSCertPriority,
291
+ "pkdUseExternalCSCA": self.pkdUseExternalCSCA,
292
+ "trustedPKD": self.trustedPKD,
293
+ "passiveAuth": self.passiveAuth,
294
+ "useSFI": self.useSFI,
295
+ "readEPassport": self.readEPassport,
296
+ "readEID": self.readEID,
297
+ "readEDL": self.readEDL,
298
+ "authorizedSTSignature": self.authorizedSTSignature,
299
+ "authorizedSTQSignature": self.authorizedSTQSignature,
300
+ "authorizedWriteDG17": self.authorizedWriteDG17,
301
+ "authorizedWriteDG18": self.authorizedWriteDG18,
302
+ "authorizedWriteDG19": self.authorizedWriteDG19,
303
+ "authorizedWriteDG20": self.authorizedWriteDG20,
304
+ "authorizedWriteDG21": self.authorizedWriteDG21,
305
+ "authorizedVerifyAge": self.authorizedVerifyAge,
306
+ "authorizedVerifyCommunityID": self.authorizedVerifyCommunityID,
307
+ "authorizedPrivilegedTerminal": self.authorizedPrivilegedTerminal,
308
+ "authorizedCANAllowed": self.authorizedCANAllowed,
309
+ "authorizedPINManagement": self.authorizedPINManagment,
310
+ "authorizedInstallCert": self.authorizedInstallCert,
311
+ "authorizedInstallQCert": self.authorizedInstallQCert,
312
+ "applyAmendments": self.applyAmendments,
313
+ "autoSettings": self.autoSettings,
314
+ "proceedReadingAlways": self.proceedReadingAlways,
315
+ "readDTC": self.readDTC,
316
+ "mrzStrictCheck": self.mrzStrictCheck,
317
+ "loadCRLFromRemote": self.loadCRLFromRemote,
318
+ "independentSODStatus": self.independentSODStatus,
319
+ "readUser": self.readUser,
320
+ "signManagementAction": self.signManagementAction.rawValue,
321
+ "readingBuffer": self.readingBuffer.rawValue,
322
+ "onlineTAToSignDataType": self.onlineTAToSignDataType,
323
+ "profilerType": self.profilerType.rawValue,
324
+ "authProcType": self.authProcType.rawValue,
325
+ "baseSMProcedure": self.baseSMProcedure.rawValue,
326
+ "pacePasswordType": self.pacePasswordType.rawValue,
327
+ "terminalType": self.terminalType.rawValue,
328
+ "defaultReadingBufferSize": self.defaultReadingBufferSize,
329
+ "password": self.password,
330
+ "pkdPA": self.pkdPA,
331
+ "pkdEAC": self.pkdEAC,
332
+ "mrz": self.mrz,
333
+ "eSignPINDefault": self.eSignPINDefault,
334
+ "eSignPINNewValue": self.eSignPINNewValue,
335
+ "cardAccess": self.cardAccess,
336
+ "mrzHash": self.mrzHash,
337
+ "documentNumber": self.documentNumber,
338
+ "dateOfBirth": self.dateOfBirth,
339
+ "dateOfExpiry": self.dateOfExpiry,
340
+ "defaultUserPIN": self.defaultUserPIN,
341
+ "eDLDataGroups": self.eDLDataGroups.encode(),
342
+ "ePassportDataGroups": self.ePassportDataGroups.encode(),
343
+ "eIDDataGroups": self.eIDDataGroups.encode(),
344
+ "dtcDataGroups": self.dtcDataGroups.encode(),
345
+ ]
346
+ }
347
+ }
348
+
349
+ // MARK: - Customization
350
+
351
+ public extension Customization {
352
+ static func decode(_ it: Any?) -> Self? {
353
+ guard let it = it as? [String: Any] else { return nil }
354
+ return Self().update(it)
355
+ }
356
+ @discardableResult
357
+ func update(_ it: [String: Any]) -> Self {
358
+ for (k, v) in it {
359
+ switch k {
360
+ case("theme"): self.theme = CustomizationTheme(rawValue: v as! Int)!
361
+ case("showStatusMessages"): self.showStatusMessages = v as! Bool
362
+ case("showResultStatusMessages"): self.showResultStatusMessages = v as! Bool
363
+ case("showHelpAnimation"): self.showHelpAnimation = v as! Bool
364
+ case("showNextPageAnimation"): self.showNextPageAnimation = v as! Bool
365
+ case("showBackgroundMask"): self.showBackgroundMask = v as! Bool
366
+ case("cameraFrameBorderWidth"): self.cameraFrameBorderWidth = v as! CGFloat
367
+ case("cameraFrameLineLength"): self.cameraFrameLineLength = v as! CGFloat
368
+ case("cameraFrameShapeType"): self.cameraFrameShapeType = CameraFrameShapeType(rawValue: v as! Int)!
369
+ case("cameraFrameOffsetWidth"): self.cameraFrameOffsetWidth = v as! CGFloat
370
+ case("nextPageAnimationStartDelay"): self.nextPageAnimationStartDelay = v as! TimeInterval
371
+ case("nextPageAnimationEndDelay"): self.nextPageAnimationEndDelay = v as! TimeInterval
372
+ case("status"): self.status = v as? String
373
+ case("resultStatus"): self.resultStatus = v as? String
374
+ case("multipageButtonText"): self.multipageButtonText = v as? String
375
+ case("cameraFrameDefaultColor"): self.cameraFrameDefaultColor = UIColor.decode(v)!
376
+ case("cameraFrameActiveColor"): self.cameraFrameActiveColor = UIColor.decode(v)!
377
+ case("statusTextColor"): self.statusTextColor = UIColor.decode(v)
378
+ case("resultStatusTextColor"): self.resultStatusTextColor = UIColor.decode(v)!
379
+ case("resultStatusBackgroundColor"): self.resultStatusBackgroundColor = UIColor.decode(v)
380
+ case("multipageButtonBackgroundColor"): self.multipageButtonBackgroundColor = UIColor.decode(v)
381
+ case("tintColor"): self.tintColor = UIColor.decode(v)!
382
+ case("activityIndicatorColor"): self.activityIndicatorColor = UIColor.decode(v)
383
+ case("statusBackgroundColor"): self.statusBackgroundColor = UIColor.decode(v)
384
+ case("cameraPreviewBackgroundColor"): self.cameraPreviewBackgroundColor = UIColor.decode(v)
385
+ case("backgroundMaskColor"): self.backgroundMaskColor = UIColor.decode(v)
386
+ case("multipageButtonTextColor"): self.multipageButtonTextColor = UIColor.decode(v)
387
+ case("statusPositionMultiplier"): self.statusPositionMultiplier = v as! CGFloat
388
+ case("resultStatusPositionMultiplier"): self.resultStatusPositionMultiplier = v as! CGFloat
389
+ case("backgroundMaskAlpha"): self.backgroundMaskAlpha = v as! CGFloat
390
+ case("toolbarSize"): self.toolbarSize = v as! CGFloat
391
+ case("customStatusPositionMultiplier"): self.customStatusPositionMultiplier = v as! CGFloat
392
+ case("cameraFrameVerticalPositionMultiplier"): self.cameraFrameVerticalPositionMultiplier = v as! CGFloat
393
+ case("cameraFrameLandscapeAspectRatio"): self.cameraFrameLandscapeAspectRatio = v as! CGFloat
394
+ case("cameraFramePortraitAspectRatio"): self.cameraFramePortraitAspectRatio = v as! CGFloat
395
+ case("cameraFrameCornerRadius"): self.cameraFrameCornerRadius = v as! CGFloat
396
+ case("livenessAnimationPositionMultiplier"): self.livenessAnimationPositionMultiplier = v as! CGFloat
397
+ case("activityIndicatorPortraitPositionMultiplier"): self.activityIndicatorPortraitPositionMultiplier = v as! CGFloat
398
+ case("activityIndicatorLandscapePositionMultiplier"): self.activityIndicatorLandscapePositionMultiplier = v as! CGFloat
399
+ case("cameraPreviewVerticalPositionMultiplier"): self.previewLayerPositionMultiplier = v as! CGFloat
400
+ case("multipageButtonPositionMultiplier"): self.multipageButtonPositionMultiplier = v as! CGFloat
401
+ case("multipageAnimationFrontImage"): self.multipageAnimationFrontImage = UIImage.decode(v)
402
+ case("multipageAnimationBackImage"): self.multipageAnimationBackImage = UIImage.decode(v)
403
+ case("borderBackgroundImage"): self.borderBackgroundImage = UIImage.decode(v)
404
+ case("helpAnimationImage"): self.helpAnimationImage = UIImage.decode(v)
405
+ case("closeButtonImage"): self.closeButtonImage = UIImage.decode(v)
406
+ case("captureButtonImage"): self.captureButtonImage = UIImage.decode(v)
407
+ case("changeFrameButtonCollapseImage"): self.changeFrameButtonCollapseImage = UIImage.decode(v)
408
+ case("changeFrameButtonExpandImage"): self.changeFrameButtonExpandImage = UIImage.decode(v)
409
+ case("cameraSwitchButtonImage"): self.cameraSwitchButtonImage = UIImage.decode(v)
410
+ case("torchButtonOnImage"): self.torchButtonOnImage = UIImage.decode(v)
411
+ case("torchButtonOffImage"): self.torchButtonOffImage = UIImage.decode(v)
412
+ case("livenessAnimationImage"): self.livenessAnimationImage = UIImage.decode(v)
413
+ case("multipageButtonImage"): self.multipageButtonImage = UIImage.decode(v)
414
+ case("statusTextFont"): self.setValue(UIFont.decode(v), forKey: "statusTextFont")
415
+ case("resultStatusTextFont"): self.setValue(UIFont.decode(v), forKey: "resultStatusTextFont")
416
+ case("multipageButtonTextFont"): self.multipageButtonTextFont = UIFont.decode(v)
417
+ case("customLabelStatus"): self.customLabelStatus = NSAttributedString(string: v as! String)
418
+ case("cameraFrameLineCap"): self.cameraFrameLineCap = CGLineCap(rawValue: v as! Int32)!
419
+ case("uiCustomizationLayer"): self.customUILayerJSON = v as? [AnyHashable: Any]
420
+ case("helpAnimationImageContentMode"): self.helpAnimationImageContentMode = UIView.ContentMode(rawValue: v as! Int)!
421
+ case("multipageAnimationFrontImageContentMode"): self.multipageAnimationFrontImageContentMode = UIView.ContentMode(rawValue: v as! Int)!
422
+ case("multipageAnimationBackImageContentMode"): self.multipageAnimationBackImageContentMode = UIView.ContentMode(rawValue: v as! Int)!
423
+ case("livenessAnimationImageContentMode"): self.livenessAnimationImageContentMode = UIView.ContentMode(rawValue: v as! Int)!
424
+ case("borderBackgroundImageContentMode"): self.borderBackgroundImageContentMode = UIView.ContentMode(rawValue: v as! Int)!
425
+ case("colors"):
426
+ let dict = self.uiConfiguration!.value(forKey: "colors") as! NSMutableDictionary
427
+ for (k, v) in v as! [String: Any] {
428
+ if let key = DocReader.CustomizationColor.fromDartKey(k) { dict[key.rawValue] = UIColor.decode(v) }
429
+ }
430
+ case("fonts"):
431
+ let dict = self.uiConfiguration!.value(forKey: "fonts") as! NSMutableDictionary
432
+ for (k, v) in v as! [String: Any] {
433
+ if let key = DocReader.CustomizationFont.fromDartKey(k) { dict[key.rawValue] = UIFont.decode(v) }
434
+ }
435
+ case("images"):
436
+ let dict = self.uiConfiguration!.value(forKey: "images") as! NSMutableDictionary
437
+ for (k, v) in v as! [String: Any] {
438
+ if let key = DocReader.CustomizationImage.fromDartKey(k) { dict[key.rawValue] = UIImage.decode(v) }
439
+ }
440
+ case("timings"):
441
+ let dict = self.uiConfiguration!.value(forKey: "timings") as! NSMutableDictionary
442
+ for (k, v) in v as! [String: Any] {
443
+ if let key = DocReader.CustomizationTiming.fromDartKey(k) { dict[key.rawValue] = v }
444
+ }
445
+ case("contentModes"):
446
+ let dict = self.uiConfiguration!.value(forKey: "contentModes") as! NSMutableDictionary
447
+ for (k, v) in v as! [String: Any] {
448
+ if let key = DocReader.CustomizationContentMode.fromDartKey(k) { dict[key.rawValue] = v }
449
+ }
450
+ default: break
451
+ }
452
+ }
453
+ return self
454
+ }
455
+ func encode() -> [String: Any?] {
456
+ let contentModes = self.uiConfiguration?.value(forKey: "contentModes") as? NSDictionary
457
+ let timings = self.uiConfiguration?.value(forKey: "timings") as? NSDictionary
458
+ let images = self.uiConfiguration?.value(forKey: "images") as? NSDictionary
459
+ let fonts = self.uiConfiguration?.value(forKey: "fonts") as? NSDictionary
460
+ let colors = self.uiConfiguration?.value(forKey: "colors") as? NSDictionary
461
+ return [
462
+ "theme": self.theme.rawValue,
463
+ "showStatusMessages": self.showStatusMessages,
464
+ "showResultStatusMessages": self.showResultStatusMessages,
465
+ "showHelpAnimation": self.showHelpAnimation,
466
+ "showNextPageAnimation": self.showNextPageAnimation,
467
+ "showBackgroundMask": self.showBackgroundMask,
468
+ "cameraFrameBorderWidth": self.cameraFrameBorderWidth,
469
+ "cameraFrameLineLength": self.cameraFrameLineLength,
470
+ "cameraFrameShapeType": self.cameraFrameShapeType.rawValue,
471
+ "cameraFrameOffsetWidth": self.cameraFrameOffsetWidth,
472
+ "nextPageAnimationStartDelay": self.nextPageAnimationStartDelay,
473
+ "nextPageAnimationEndDelay": self.nextPageAnimationEndDelay,
474
+ "status": self.status,
475
+ "resultStatus": self.resultStatus,
476
+ "multipageButtonText": self.multipageButtonText,
477
+ "cameraFrameDefaultColor": self.cameraFrameDefaultColor.encode(),
478
+ "cameraFrameActiveColor": self.cameraFrameActiveColor.encode(),
479
+ "statusTextColor": self.statusTextColor?.encode(),
480
+ "resultStatusTextColor": self.resultStatusTextColor.encode(),
481
+ "resultStatusBackgroundColor": self.resultStatusBackgroundColor?.encode(),
482
+ "multipageButtonBackgroundColor": self.multipageButtonBackgroundColor?.encode(),
483
+ "tintColor": self.tintColor.encode(),
484
+ "activityIndicatorColor": self.activityIndicatorColor?.encode(),
485
+ "statusBackgroundColor": self.statusBackgroundColor?.encode(),
486
+ "cameraPreviewBackgroundColor": self.cameraPreviewBackgroundColor?.encode(),
487
+ "backgroundMaskColor": self.backgroundMaskColor?.encode(),
488
+ "multipageButtonTextColor": self.multipageButtonTextColor?.encode(),
489
+ "statusPositionMultiplier": self.statusPositionMultiplier,
490
+ "resultStatusPositionMultiplier": self.resultStatusPositionMultiplier,
491
+ "backgroundMaskAlpha": self.backgroundMaskAlpha,
492
+ "toolbarSize": self.toolbarSize,
493
+ "customStatusPositionMultiplier": self.customStatusPositionMultiplier,
494
+ "cameraFrameVerticalPositionMultiplier": self.cameraFrameVerticalPositionMultiplier,
495
+ "cameraFrameLandscapeAspectRatio": self.cameraFrameLandscapeAspectRatio,
496
+ "cameraFramePortraitAspectRatio": self.cameraFramePortraitAspectRatio,
497
+ "cameraFrameCornerRadius": self.cameraFrameCornerRadius,
498
+ "livenessAnimationPositionMultiplier": self.livenessAnimationPositionMultiplier,
499
+ "activityIndicatorPortraitPositionMultiplier": self.activityIndicatorPortraitPositionMultiplier,
500
+ "activityIndicatorLandscapePositionMultiplier": self.activityIndicatorLandscapePositionMultiplier,
501
+ "cameraPreviewVerticalPositionMultiplier": self.previewLayerPositionMultiplier,
502
+ "multipageButtonPositionMultiplier": self.multipageButtonPositionMultiplier,
503
+ "multipageAnimationFrontImage": self.multipageAnimationFrontImage?.encode(),
504
+ "multipageAnimationBackImage": self.multipageAnimationBackImage?.encode(),
505
+ "borderBackgroundImage": self.borderBackgroundImage?.encode(),
506
+ "helpAnimationImage": self.helpAnimationImage?.encode(),
507
+ "closeButtonImage": self.closeButtonImage?.encode(),
508
+ "captureButtonImage": self.captureButtonImage?.encode(),
509
+ "changeFrameButtonCollapseImage": self.changeFrameButtonCollapseImage?.encode(),
510
+ "changeFrameButtonExpandImage": self.changeFrameButtonExpandImage?.encode(),
511
+ "cameraSwitchButtonImage": self.cameraSwitchButtonImage?.encode(),
512
+ "torchButtonOnImage": self.torchButtonOnImage?.encode(),
513
+ "torchButtonOffImage": self.torchButtonOffImage?.encode(),
514
+ "livenessAnimationImage": self.livenessAnimationImage?.encode(),
515
+ "multipageButtonImage": self.multipageButtonImage?.encode(),
516
+ "statusTextFont": self.statusTextFont.encode(),
517
+ "resultStatusTextFont": self.resultStatusTextFont.encode(),
518
+ "multipageButtonTextFont": self.multipageButtonTextFont?.encode(),
519
+ "customLabelStatus": self.customLabelStatus?.string,
520
+ "cameraFrameLineCap": self.cameraFrameLineCap.rawValue,
521
+ "uiCustomizationLayer": self.customUILayerJSON,
522
+ "helpAnimationImageContentMode": self.helpAnimationImageContentMode.rawValue,
523
+ "multipageAnimationFrontImageContentMode": self.multipageAnimationFrontImageContentMode.rawValue,
524
+ "multipageAnimationBackImageContentMode": self.multipageAnimationBackImageContentMode.rawValue,
525
+ "livenessAnimationImageContentMode": self.livenessAnimationImageContentMode.rawValue,
526
+ "borderBackgroundImageContentMode": self.borderBackgroundImageContentMode.rawValue,
527
+ "colors": [
528
+ "rfidProcessingScreenBackground": (colors?[DocReader.CustomizationColor.rfidProcessingScreenBackground.rawValue] as? UIColor)?.encode(),
529
+ "rfidProcessingScreenHintLabelText": (colors?[DocReader.CustomizationColor.rfidProcessingScreenHintLabelText.rawValue] as? UIColor)?.encode(),
530
+ "rfidProcessingScreenHintLabelBackground": (colors?[DocReader.CustomizationColor.rfidProcessingScreenHintLabelBackground.rawValue] as? UIColor)?.encode(),
531
+ "rfidProcessingScreenProgressLabelText": (colors?[DocReader.CustomizationColor.rfidProcessingScreenProgressLabelText.rawValue] as? UIColor)?.encode(),
532
+ "rfidProcessingScreenProgressBar": (colors?[DocReader.CustomizationColor.rfidProcessingScreenProgressBar.rawValue] as? UIColor)?.encode(),
533
+ "rfidProcessingScreenProgressBarBackground": (colors?[DocReader.CustomizationColor.rfidProcessingScreenProgressBarBackground.rawValue] as? UIColor)?.encode(),
534
+ "rfidProcessingScreenResultLabelText": (colors?[DocReader.CustomizationColor.rfidProcessingScreenResultLabelText.rawValue] as? UIColor)?.encode(),
535
+ "rfidProcessingScreenLoadingBar": (colors?[DocReader.CustomizationColor.rfidProcessingScreenLoadingBar.rawValue] as? UIColor)?.encode(),
536
+ "mdlProcessingScreenBackground": (colors?[DocReader.CustomizationColor.mdlProcessingScreenBackground.rawValue] as? UIColor)?.encode(),
537
+ "mdlProcessingScreenHintLabelText": (colors?[DocReader.CustomizationColor.mdlProcessingScreenHintLabelText.rawValue] as? UIColor)?.encode(),
538
+ "mdlProcessingScreenHintLabelBackground": (colors?[DocReader.CustomizationColor.mdlProcessingScreenHintLabelBackground.rawValue] as? UIColor)?.encode(),
539
+ "mdlProcessingScreenProgressLabelText": (colors?[DocReader.CustomizationColor.mdlProcessingScreenProgressLabelText.rawValue] as? UIColor)?.encode(),
540
+ "mdlProcessingScreenResultLabelText": (colors?[DocReader.CustomizationColor.mdlProcessingScreenResultLabelText.rawValue] as? UIColor)?.encode(),
541
+ "mdlProcessingScreenLoadingBar": (colors?[DocReader.CustomizationColor.mdlProcessingScreenLoadingBar.rawValue] as? UIColor)?.encode(),
542
+ "nextPageIdCardFront": (colors?[DocReader.CustomizationColor.nextPageIdCardFront.rawValue] as? UIColor)?.encode(),
543
+ "nextPageIdCardBack": (colors?[DocReader.CustomizationColor.nextPageIdCardBack.rawValue] as? UIColor)?.encode(),
544
+ "nextPagePassportShift": (colors?[DocReader.CustomizationColor.nextPagePassportShift.rawValue] as? UIColor)?.encode(),
545
+ "nextPagePassportFlip": (colors?[DocReader.CustomizationColor.nextPagePassportFlip.rawValue] as? UIColor)?.encode()
546
+ ],
547
+ "fonts": [
548
+ "rfidProcessingScreenHintLabel": (fonts?[DocReader.CustomizationFont.rfidProcessingScreenHintLabel.rawValue] as? UIFont)?.encode(),
549
+ "rfidProcessingScreenProgressLabel": (fonts?[DocReader.CustomizationFont.rfidProcessingScreenProgressLabel.rawValue] as? UIFont)?.encode(),
550
+ "rfidProcessingScreenResultLabel": (fonts?[DocReader.CustomizationFont.rfidProcessingScreenResultLabel.rawValue] as? UIFont)?.encode(),
551
+ "mdlProcessingScreenHintLabel": (fonts?[DocReader.CustomizationFont.mdlProcessingScreenHintLabel.rawValue] as? UIFont)?.encode(),
552
+ "mdlProcessingScreenProgressLabel": (fonts?[DocReader.CustomizationFont.mdlProcessingScreenProgressLabel.rawValue] as? UIFont)?.encode(),
553
+ "mdlProcessingScreenResultLabel": (fonts?[DocReader.CustomizationFont.mdlProcessingScreenResultLabel.rawValue] as? UIFont)?.encode()
554
+ ],
555
+ "images": [
556
+ "helpAnimation": (images?[DocReader.CustomizationImage.helpAnimation.rawValue] as? UIImage)?.encode(),
557
+ "livenessAnimation": (images?[DocReader.CustomizationImage.livenessAnimation.rawValue] as? UIImage)?.encode(),
558
+ "borderBackground": (images?[DocReader.CustomizationImage.borderBackground.rawValue] as? UIImage)?.encode(),
559
+ "torchButtonOn": (images?[DocReader.CustomizationImage.torchButtonOn.rawValue] as? UIImage)?.encode(),
560
+ "torchButtonOff": (images?[DocReader.CustomizationImage.torchButtonOff.rawValue] as? UIImage)?.encode(),
561
+ "captureButton": (images?[DocReader.CustomizationImage.captureButton.rawValue] as? UIImage)?.encode(),
562
+ "switchButton": (images?[DocReader.CustomizationImage.switchButton.rawValue] as? UIImage)?.encode(),
563
+ "closeButton": (images?[DocReader.CustomizationImage.closeButton.rawValue] as? UIImage)?.encode(),
564
+ "multipageButton": (images?[DocReader.CustomizationImage.multipageButton.rawValue] as? UIImage)?.encode(),
565
+ "rfidProcessingScreenFailureImage": (images?[DocReader.CustomizationImage.rfidProcessingScreenFailure.rawValue] as? UIImage)?.encode(),
566
+ "mdlProcessingScreenFailureImage": (images?[DocReader.CustomizationImage.mdlProcessingScreenFailure.rawValue] as? UIImage)?.encode(),
567
+ "nextPageIdCardFront": (images?[DocReader.CustomizationImage.nextPageIdCardFront.rawValue] as? UIImage)?.encode(),
568
+ "nextPageIdCardBack": (images?[DocReader.CustomizationImage.nextPageIdCardBack.rawValue] as? UIImage)?.encode(),
569
+ "nextPagePassportShift": (images?[DocReader.CustomizationImage.nextPagePassportShift.rawValue] as? UIImage)?.encode(),
570
+ "nextPagePassportFlipStart": (images?[DocReader.CustomizationImage.nextPagePassportFlipStart.rawValue] as? UIImage)?.encode(),
571
+ "nextPagePassportFlipClean": (images?[DocReader.CustomizationImage.nextPagePassportFlipClean.rawValue] as? UIImage)?.encode(),
572
+ "nextPagePassportFlipTop": (images?[DocReader.CustomizationImage.nextPagePassportFlipTop.rawValue] as? UIImage)?.encode(),
573
+ "nextPagePassportFlipBottom": (images?[DocReader.CustomizationImage.nextPagePassportFlipBottom.rawValue] as? UIImage)?.encode()
574
+ ],
575
+ "timings": [
576
+ "nextPageIdCardStartDelay": timings?[DocReader.CustomizationTiming.nextPageIdCardStartDelay.rawValue],
577
+ "nextPageIdCardEndDelay": timings?[DocReader.CustomizationTiming.nextPageIdCardEndDelay.rawValue],
578
+ "nextPagePassportShiftStartDelay": timings?[DocReader.CustomizationTiming.nextPagePassportShiftStartDelay.rawValue],
579
+ "nextPagePassportShiftEndDelay": timings?[DocReader.CustomizationTiming.nextPagePassportShiftEndDelay.rawValue],
580
+ "nextPagePassportFlipStartDelay": timings?[DocReader.CustomizationTiming.nextPagePassportFlipStartDelay.rawValue],
581
+ "nextPagePassportFlipEndDelay": timings?[DocReader.CustomizationTiming.nextPagePassportFlipEndDelay.rawValue]
582
+ ],
583
+ "contentModes": [
584
+ "nextPageIdCardFront": contentModes?[DocReader.CustomizationContentMode.nextPageIdCardFront.rawValue],
585
+ "nextPageIdCardBack": contentModes?[DocReader.CustomizationContentMode.nextPageIdCardBack.rawValue]
586
+ ],
587
+ ]
588
+ }
589
+ }
590
+
591
+ // MARK: - Functionality
592
+
593
+ public extension Functionality {
594
+ static func decode(_ it: Any?) -> Self? {
595
+ guard let it = it as? [String: Any] else { return nil }
596
+ return Self().update(it)
597
+ }
598
+ @discardableResult
599
+ func update(_ it: [String: Any]) -> Self {
600
+ for (k, v) in it {
601
+ switch k {
602
+ case("showTorchButton"): self.showTorchButton = v as! Bool
603
+ case("showCloseButton"): self.showCloseButton = v as! Bool
604
+ case("videoCaptureMotionControl"): self.videoCaptureMotionControl = v as! Bool
605
+ case("showCaptureButton"): self.showCaptureButton = v as! Bool
606
+ case("showChangeFrameButton"): self.showChangeFrameButton = v as! Bool
607
+ case("showSkipNextPageButton"): self.showSkipNextPageButton = v as! Bool
608
+ case("useAuthenticator"): self.isUseAuthenticator = v as! Bool
609
+ case("skipFocusingFrames"): self.skipFocusingFrames = v as! Bool
610
+ case("showCameraSwitchButton"): self.showCameraSwitchButton = v as! Bool
611
+ case("displayMetadata"): self.showMetadataInfo = v as! Bool
612
+ case("isZoomEnabled"): self.isZoomEnabled = v as! Bool
613
+ case("recordScanningProcess"): self.recordScanningProcess = v as! Bool
614
+ case("manualMultipageMode"): self.manualMultipageMode = v as! Bool
615
+ case("singleResult"): self.singleResult = v as! Bool
616
+ case("torchTurnedOn"): self.torchTurnedOn = v as! Bool
617
+ case("preventScreenRecording"): self.preventScreenRecording = v as! Bool
618
+ case("homeIndicatorAutoHide"): self.homeIndicatorAutoHide = v as! Bool
619
+ case("showCaptureButtonDelayFromDetect"): self.showCaptureButtonDelayFromDetect = v as! TimeInterval
620
+ case("showCaptureButtonDelayFromStart"): self.showCaptureButtonDelayFromStart = v as! TimeInterval
621
+ case("forcePagesCount"): self.forcePagesCount = v as? NSNumber
622
+ case("orientation"): self.orientation = UIInterfaceOrientationMask.decode(v)
623
+ case("captureMode"): self.captureMode = CaptureMode(rawValue: v as! Int)!
624
+ case("cameraPositionIOS"): self.cameraPosition = AVCaptureDevice.Position(rawValue: v as! Int)!
625
+ case("cameraFrame"): self.cameraFrame = DocReaderFrame.decode(v)
626
+ case("btDeviceName"): self.btDeviceName = v as? String
627
+ case("zoomFactor"): self.zoomFactor = v as! CGFloat
628
+ case("mdlTimeout"): self.mDLTimeout = v as! TimeInterval
629
+ case("videoSessionPreset"): self.videoSessionPreset = AVCaptureSession.Preset.decode(v)
630
+ case("videoOutputSettings"): self.videoOutputSettings = v as? [String: Any]
631
+ default: break
632
+ }
633
+ }
634
+ return self
635
+ }
636
+ func encode() -> [String: Any?] {
637
+ return [
638
+ "showTorchButton": self.showTorchButton,
639
+ "showCloseButton": self.showCloseButton,
640
+ "videoCaptureMotionControl": self.videoCaptureMotionControl,
641
+ "showCaptureButton": self.showCaptureButton,
642
+ "showChangeFrameButton": self.showChangeFrameButton,
643
+ "showSkipNextPageButton": self.showSkipNextPageButton,
644
+ "useAuthenticator": self.isUseAuthenticator,
645
+ "skipFocusingFrames": self.skipFocusingFrames,
646
+ "showCameraSwitchButton": self.showCameraSwitchButton,
647
+ "displayMetadata": self.showMetadataInfo,
648
+ "isZoomEnabled": self.isZoomEnabled,
649
+ "recordScanningProcess": self.recordScanningProcess,
650
+ "manualMultipageMode": self.manualMultipageMode,
651
+ "singleResult": self.singleResult,
652
+ "torchTurnedOn": self.torchTurnedOn,
653
+ "preventScreenRecording": self.preventScreenRecording,
654
+ "homeIndicatorAutoHide": self.homeIndicatorAutoHide,
655
+ "showCaptureButtonDelayFromDetect": self.showCaptureButtonDelayFromDetect,
656
+ "showCaptureButtonDelayFromStart": self.showCaptureButtonDelayFromStart,
657
+ "forcePagesCount": self.forcePagesCount,
658
+ "orientation": self.orientation.encode(),
659
+ "captureMode": self.captureMode.rawValue,
660
+ "cameraPositionIOS": self.cameraPosition.rawValue,
661
+ "cameraFrame": self.cameraFrame.encode(),
662
+ "btDeviceName": self.btDeviceName,
663
+ "zoomFactor": self.zoomFactor,
664
+ "mdlTimeout": self.mDLTimeout,
665
+ "videoSessionPreset": self.videoSessionPreset?.encode(),
666
+ "videoOutputSettings": self.videoOutputSettings,
667
+ ]
668
+ }
669
+ }
670
+
671
+ // MARK: - ProcessParams
672
+
673
+ public extension ProcessParams {
674
+ static func decode(_ it: Any?) -> Self? {
675
+ guard let it = it as? [String: Any] else { return nil }
676
+ return Self().update(it)
677
+ }
678
+ @discardableResult
679
+ func update(_ it: [String: Any]) -> Self {
680
+ for (k, v) in it {
681
+ switch k {
682
+ case("multipageProcessing"): self.multipageProcessing = v as? NSNumber
683
+ case("logs"): self.logs = v as? NSNumber
684
+ case("debugSaveImages"): self.debugSaveImages = v as? NSNumber
685
+ case("debugSaveLogs"): self.debugSaveLogs = v as? NSNumber
686
+ case("returnUncroppedImage"): self.returnUncroppedImage = v as? NSNumber
687
+ case("debugSaveCroppedImages"): self.debugSaveCroppedImages = v as? NSNumber
688
+ case("disableFocusingCheck"): self.disableFocusingCheck = v as? NSNumber
689
+ case("debugSaveRFIDSession"): self.debugSaveRFIDSession = v as? NSNumber
690
+ case("doublePageSpread"): self.doublePageSpread = v as? NSNumber
691
+ case("manualCrop"): self.manualCrop = v as? NSNumber
692
+ case("integralImage"): self.integralImage = v as? NSNumber
693
+ case("returnCroppedBarcode"): self.returnCroppedBarcode = v as? NSNumber
694
+ case("checkRequiredTextFields"): self.checkRequiredTextFields = v as? NSNumber
695
+ case("depersonalizeLog"): self.depersonalizeLog = v as? NSNumber
696
+ case("generateDoublePageSpreadImage"): self.generateDoublePageSpreadImage = v as? NSNumber
697
+ case("alreadyCropped"): self.alreadyCropped = v as? NSNumber
698
+ case("matchTextFieldMask"): self.matchTextFieldMask = v as? NSNumber
699
+ case("updateOCRValidityByGlare"): self.updateOCRValidityByGlare = v as? NSNumber
700
+ case("noGraphics"): self.noGraphics = v as? NSNumber
701
+ case("multiDocOnImage"): self.multiDocOnImage = v as? NSNumber
702
+ case("parseBarcodes"): self.parseBarcodes = v as? NSNumber
703
+ case("shouldReturnPackageForReprocess"): self.shouldReturnPackageForReprocess = v as? NSNumber
704
+ case("disablePerforationOCR"): self.disablePerforationOCR = v as? NSNumber
705
+ case("respectImageQuality"): self.respectImageQuality = v as? NSNumber
706
+ case("strictImageQuality"): self.strictImageQuality = v as? NSNumber
707
+ case("splitNames"): self.splitNames = v as? NSNumber
708
+ case("doDetectCan"): self.doDetectCan = v as? NSNumber
709
+ case("useFaceApi"): self.useFaceApi = v as? NSNumber
710
+ case("useAuthenticityCheck"): self.useAuthenticityCheck = v as? NSNumber
711
+ case("checkHologram"): self.checkHologram = v as? NSNumber
712
+ case("generateNumericCodes"): self.generateNumericCodes = v as? NSNumber
713
+ case("strictBarcodeDigitalSignatureCheck"): self.strictBarcodeDigitalSignatureCheck = v as? NSNumber
714
+ case("selectLongestNames"): self.selectLongestNames = v as? NSNumber
715
+ case("generateDTCVC"): self.generateDTCVC = v as? NSNumber
716
+ case("strictDLCategoryExpiry"): self.strictDLCategoryExpiry = v as? NSNumber
717
+ case("generateAlpha2Codes"): self.generateAlpha2Codes = v as? NSNumber
718
+ case("disableAuthResolutionFilter"): self.disableAuthResolutionFilter = v as? NSNumber
719
+ case("strictSecurityChecks"): self.strictSecurityChecks = v as? NSNumber
720
+ case("returnTransliteratedFields"): self.returnTransliteratedFields = v as? NSNumber
721
+ case("checkCaptureProcessIntegrity"): self.checkCaptureProcessIntegrity = v as? NSNumber
722
+ case("strictExpiryDate"): self.strictExpiryDate = v as? NSNumber
723
+ case("debugSaveBinarySession"): self.debugSaveBinarySession = v as? NSNumber
724
+ case("checkVDS"): self.checkVDS = v as? NSNumber
725
+ case("strictAgeCheck"): self.strictAgeCheck = v as? NSNumber
726
+ case("measureSystem"): self.measureSystem = MeasureSystem(rawValue: v as! Int)!
727
+ case("barcodeParserType"): self.barcodeParserType = v as? NSNumber
728
+ case("perspectiveAngle"): self.perspectiveAngle = v as? NSNumber
729
+ case("minDPI"): self.minDPI = v as? NSNumber
730
+ case("imageDpiOutMax"): self.imageDpiOutMax = v as? NSNumber
731
+ case("forceDocID"): self.forceDocID = v as? NSNumber
732
+ case("forceDocFormat"): self.forceDocFormat = v as? NSNumber
733
+ case("shiftExpiryDate"): self.shiftExpiryDate = v as? NSNumber
734
+ case("minimalHolderAge"): self.minimalHolderAge = v as? NSNumber
735
+ case("imageOutputMaxHeight"): self.imageOutputMaxHeight = v as? NSNumber
736
+ case("imageOutputMaxWidth"): self.imageOutputMaxWidth = v as? NSNumber
737
+ case("processAuth"): self.processAuth = v as? NSNumber
738
+ case("convertCase"): self.convertCase = TextProcessing.decode(v)
739
+ case("logLevel"): self.logLevel = (v as? String).map { RGLLogLevel(rawValue: $0) }
740
+ case("mrzDetectMode"): self.mrzDetectMode = v as? NSNumber
741
+ case("pdfPagesLimit"): self.pdfPagesLimit = v as? NSNumber
742
+ case("dateFormat"): self.dateFormat = v as! String
743
+ case("scenario"): self.scenario = v as? String
744
+ case("captureButtonScenario"): self.captureButtonScenario = v as? String
745
+ case("timeout"): self.timeout = v as? NSNumber
746
+ case("timeoutFromFirstDetect"): self.timeoutFromFirstDetect = v as? NSNumber
747
+ case("timeoutFromFirstDocType"): self.timeoutFromFirstDocType = v as? NSNumber
748
+ case("documentAreaMin"): self.documentAreaMin = v as? NSNumber
749
+ case("timeoutLiveness"): self.timeoutLiveness = v as? NSNumber
750
+ case("documentIDList"): self.documentIDList = v as? [NSNumber]
751
+ case("barcodeTypes"): self.barcodeTypes = v as? [NSNumber]
752
+ case("fieldTypesFilter"): self.fieldTypesFilter = v as? [NSNumber]
753
+ case("documentGroupFilter"): self.documentGroupFilter = v as? [NSNumber]
754
+ case("lcidIgnoreFilter"): self.lcidIgnoreFilter = v as? [NSNumber]
755
+ case("lcidFilter"): self.lcidFilter = v as? [NSNumber]
756
+ case("fieldTypesIgnoreFilter"): self.fieldTypesIgnoreFilter = v as? [NSNumber]
757
+ case("mrzFormatsFilter"): self.setValue(v, forKey: "mrzFormatsFilter")
758
+ case("resultTypeOutput"): self.resultTypeOutput = v as? [NSNumber]
759
+ case("imageQA"): self.imageQA.update(v as! [String: Any])
760
+ case("authenticityParams"): self.authenticityParams = (self.authenticityParams ?? AuthenticityParams.default()).update(v as! [String: Any])
761
+ case("rfidParams"): self.rfidParams = RFIDParams.decode(v)
762
+ case("faceApiParams"): self.faceApiParams = FaceAPIParams.decode(v)
763
+ case("backendProcessingConfig"): self.backendProcessingConfig = RGLBackendProcessingConfig.decode(v)
764
+ case("bsiTr03135"): self.bsiTr03135 = DocReader.Bsi.decode(v)
765
+ case("customParams"): self.customParams = v as? [AnyHashable: Any]
766
+ default: break
767
+ }
768
+ }
769
+ return self
770
+ }
771
+ func encode() -> [String: Any?] {
772
+ return [
773
+ "multipageProcessing": self.multipageProcessing,
774
+ "logs": self.logs,
775
+ "debugSaveImages": self.debugSaveImages,
776
+ "debugSaveLogs": self.debugSaveLogs,
777
+ "returnUncroppedImage": self.returnUncroppedImage,
778
+ "debugSaveCroppedImages": self.debugSaveCroppedImages,
779
+ "disableFocusingCheck": self.disableFocusingCheck,
780
+ "debugSaveRFIDSession": self.debugSaveRFIDSession,
781
+ "doublePageSpread": self.doublePageSpread,
782
+ "manualCrop": self.manualCrop,
783
+ "integralImage": self.integralImage,
784
+ "returnCroppedBarcode": self.returnCroppedBarcode,
785
+ "checkRequiredTextFields": self.checkRequiredTextFields,
786
+ "depersonalizeLog": self.depersonalizeLog,
787
+ "generateDoublePageSpreadImage": self.generateDoublePageSpreadImage,
788
+ "alreadyCropped": self.alreadyCropped,
789
+ "matchTextFieldMask": self.matchTextFieldMask,
790
+ "updateOCRValidityByGlare": self.updateOCRValidityByGlare,
791
+ "noGraphics": self.noGraphics,
792
+ "multiDocOnImage": self.multiDocOnImage,
793
+ "parseBarcodes": self.parseBarcodes,
794
+ "shouldReturnPackageForReprocess": self.shouldReturnPackageForReprocess,
795
+ "disablePerforationOCR": self.disablePerforationOCR,
796
+ "respectImageQuality": self.respectImageQuality,
797
+ "strictImageQuality": self.strictImageQuality,
798
+ "splitNames": self.splitNames,
799
+ "doDetectCan": self.doDetectCan,
800
+ "useFaceApi": self.useFaceApi,
801
+ "useAuthenticityCheck": self.useAuthenticityCheck,
802
+ "checkHologram": self.checkHologram,
803
+ "generateNumericCodes": self.generateNumericCodes,
804
+ "strictBarcodeDigitalSignatureCheck": self.strictBarcodeDigitalSignatureCheck,
805
+ "selectLongestNames": self.selectLongestNames,
806
+ "generateDTCVC": self.generateDTCVC,
807
+ "strictDLCategoryExpiry": self.strictDLCategoryExpiry,
808
+ "generateAlpha2Codes": self.generateAlpha2Codes,
809
+ "disableAuthResolutionFilter": self.disableAuthResolutionFilter,
810
+ "strictSecurityChecks": self.strictSecurityChecks,
811
+ "returnTransliteratedFields": self.returnTransliteratedFields,
812
+ "checkCaptureProcessIntegrity": self.checkCaptureProcessIntegrity,
813
+ "strictExpiryDate": self.strictExpiryDate,
814
+ "debugSaveBinarySession": self.debugSaveBinarySession,
815
+ "checkVDS": self.checkVDS,
816
+ "strictAgeCheck": self.strictAgeCheck,
817
+ "measureSystem": self.measureSystem.rawValue,
818
+ "barcodeParserType": self.barcodeParserType,
819
+ "perspectiveAngle": self.perspectiveAngle,
820
+ "minDPI": self.minDPI,
821
+ "imageDpiOutMax": self.imageDpiOutMax,
822
+ "forceDocID": self.forceDocID,
823
+ "forceDocFormat": self.forceDocFormat,
824
+ "shiftExpiryDate": self.shiftExpiryDate,
825
+ "minimalHolderAge": self.minimalHolderAge,
826
+ "imageOutputMaxHeight": self.imageOutputMaxHeight,
827
+ "imageOutputMaxWidth": self.imageOutputMaxWidth,
828
+ "processAuth": self.processAuth,
829
+ "convertCase": self.convertCase?.encode(),
830
+ "logLevel": self.logLevel?.rawValue,
831
+ "mrzDetectMode": self.mrzDetectMode,
832
+ "pdfPagesLimit": self.pdfPagesLimit,
833
+ "dateFormat": self.dateFormat,
834
+ "scenario": self.scenario,
835
+ "captureButtonScenario": self.captureButtonScenario,
836
+ "timeout": self.timeout,
837
+ "timeoutFromFirstDetect": self.timeoutFromFirstDetect,
838
+ "timeoutFromFirstDocType": self.timeoutFromFirstDocType,
839
+ "documentAreaMin": self.documentAreaMin,
840
+ "timeoutLiveness": self.timeoutLiveness,
841
+ "documentIDList": self.documentIDList,
842
+ "barcodeTypes": self.barcodeTypes,
843
+ "fieldTypesFilter": self.fieldTypesFilter,
844
+ "documentGroupFilter": self.documentGroupFilter,
845
+ "lcidIgnoreFilter": self.lcidIgnoreFilter,
846
+ "lcidFilter": self.lcidFilter,
847
+ "fieldTypesIgnoreFilter": self.fieldTypesIgnoreFilter,
848
+ "mrzFormatsFilter": self.value(forKey: "mrzFormatsFilter"),
849
+ "resultTypeOutput": self.resultTypeOutput,
850
+ "imageQA": self.imageQA.encode(),
851
+ "authenticityParams": self.authenticityParams?.encode(),
852
+ "rfidParams": self.rfidParams?.encode(),
853
+ "faceApiParams": self.faceApiParams?.encode(),
854
+ "backendProcessingConfig": self.backendProcessingConfig?.encode(),
855
+ "bsiTr03135": self.bsiTr03135?.encode(),
856
+ "customParams": self.customParams,
857
+ ]
858
+ }
859
+ }
860
+
861
+ // MARK: - DataGroups
862
+
863
+ public extension DataGroup {
864
+ static func decode(_ it: Any?) -> Self? {
865
+ guard let it = it as? [String: Any] else { return nil }
866
+ return Self().update(it)
867
+ }
868
+ @discardableResult
869
+ func update(_ it: [String: Any]) -> Self {
870
+ let count = self is eIDDataGroup ? 21 : self is ePassportDataGroup ? 16 : 14
871
+ for index in 1...count {
872
+ if let prop = it["DG\(index)"] as? Bool { self.setValue(prop, forKey: "dG\(index)") }
873
+ }
874
+ return self
875
+ }
876
+ func encode() -> [String: Any?] {
877
+ var result: [String: Any?] = [:]
878
+ let count = self is eIDDataGroup ? 21 : self is ePassportDataGroup ? 16 : 14
879
+ for index in 1...count { result["DG\(index)"] = self.value(forKey: "dG\(index)") }
880
+ return result
881
+ }
882
+ }
883
+
884
+ // MARK: - Converting
885
+
886
+ extension UIColor {
887
+ // Create from a hex integer; supports #RGB, #ARGB, #RRGGBB, #AARRGGBB semantics
888
+ static func decode(_ it: Any?) -> Self? {
889
+ guard let it = it as? Int else { return nil }
890
+ var hex = String(UInt32(truncatingIfNeeded: it), radix: 16, uppercase: true)
891
+ // If length is 5 or 7, pad a leading 0 to restore a lost leading nibble
892
+ if hex.count == 5 || hex.count == 7 { hex = "0" + hex }
893
+
894
+ let a, r, g, b: CGFloat
895
+ switch hex.count {
896
+ case 3: // RGB
897
+ a = 1.0
898
+ r = Self.component(from: hex, start: 0, length: 1)
899
+ g = Self.component(from: hex, start: 1, length: 1)
900
+ b = Self.component(from: hex, start: 2, length: 1)
901
+ case 4: // ARGB
902
+ a = Self.component(from: hex, start: 0, length: 1)
903
+ r = Self.component(from: hex, start: 1, length: 1)
904
+ g = Self.component(from: hex, start: 2, length: 1)
905
+ b = Self.component(from: hex, start: 3, length: 1)
906
+ case 6: // RRGGBB
907
+ a = 1.0
908
+ r = Self.component(from: hex, start: 0, length: 2)
909
+ g = Self.component(from: hex, start: 2, length: 2)
910
+ b = Self.component(from: hex, start: 4, length: 2)
911
+ case 8: // AARRGGBB
912
+ a = Self.component(from: hex, start: 0, length: 2)
913
+ r = Self.component(from: hex, start: 2, length: 2)
914
+ g = Self.component(from: hex, start: 4, length: 2)
915
+ b = Self.component(from: hex, start: 6, length: 2)
916
+ default:
917
+ assertionFailure("Invalid color value: #\(hex). Expected #RGB, #ARGB, #RRGGBB, or #AARRGGBB")
918
+ return nil
919
+ }
920
+ return Self(red: r, green: g, blue: b, alpha: a)
921
+ }
922
+
923
+ // AARRGGBB integer representation as Int
924
+ func encode() -> Int {
925
+ var r: CGFloat = 0, g: CGFloat = 0, b: CGFloat = 0, a: CGFloat = 0
926
+ if !getRed(&r, green: &g, blue: &b, alpha: &a) {
927
+ if let comps = cgColor.components {
928
+ if comps.count == 2 { r = comps[0]; g = comps[0]; b = comps[0]; a = comps[1] }
929
+ else if comps.count >= 4 { r = comps[0]; g = comps[1]; b = comps[2]; a = comps[3] }
930
+ }
931
+ }
932
+ let aa = UInt32(lroundf(Float(a * 255)))
933
+ let rr = UInt32(lroundf(Float(r * 255)))
934
+ let gg = UInt32(lroundf(Float(g * 255)))
935
+ let bb = UInt32(lroundf(Float(b * 255)))
936
+ let composed: UInt32 = (aa << 24) | (rr << 16) | (gg << 8) | bb
937
+ return Int(truncatingIfNeeded: composed)
938
+ }
939
+
940
+ private static func component(from hex: String, start: Int, length: Int) -> CGFloat {
941
+ let startIdx = hex.index(hex.startIndex, offsetBy: start)
942
+ let endIdx = hex.index(startIdx, offsetBy: length)
943
+ let substr = String(hex[startIdx..<endIdx])
944
+ let full = (length == 2) ? substr : substr + substr
945
+ let value = UInt32(full, radix: 16) ?? 0
946
+ return CGFloat(value) / 255.0
947
+ }
948
+ }
949
+
950
+ extension UIFont {
951
+ static func decode(_ it: Any?) -> Self? {
952
+ guard let it = it as? [String: Any] else { return nil }
953
+ return Self(name: it["name"] as! String,
954
+ size: it["size"] as! CGFloat)
955
+ }
956
+ func encode() -> [String: Any?] {
957
+ return ["name": self.fontName, "size": self.pointSize]
958
+ }
959
+ }
960
+
961
+ extension DocReaderFrame {
962
+ static func decode(_ it: Any?) -> Self {
963
+ switch it as? String {
964
+ case "id1": return .scenarioDefault
965
+ case "max": return .max
966
+ case "document": return .document
967
+ default: return .none
968
+ }
969
+ }
970
+ func encode() -> String {
971
+ switch self {
972
+ case .scenarioDefault: return "id1"
973
+ case .max: return "max"
974
+ case .document: return "document"
975
+ default: return "none"
976
+ }
977
+ }
978
+ }
979
+
980
+ extension UIInterfaceOrientationMask {
981
+ static func decode(_ it: Any?) -> Self {
982
+ switch it as? Int {
983
+ case 0: return .all
984
+ case 2: return .landscape
985
+ case 3: return .landscapeLeft
986
+ case 4: return .landscapeRight
987
+ default: return .portrait
988
+ }
989
+ }
990
+ func encode() -> Int {
991
+ switch self {
992
+ case .portrait: return 1
993
+ case .landscape: return 2
994
+ case .landscapeLeft: return 3
995
+ case .landscapeRight: return 4
996
+ default: return 0
997
+ }
998
+ }
999
+ }
1000
+
1001
+ extension AVCaptureSession.Preset {
1002
+ static func decode(_ it: Any?) -> Self {
1003
+ switch it as? Int {
1004
+ case 0: return .low
1005
+ case 1: return .medium
1006
+ case 2: return .high
1007
+ case 3: return .photo
1008
+ case 4: return .inputPriority
1009
+ case 6: return .hd1280x720
1010
+ case 8: return .hd4K3840x2160
1011
+ case 9: return .iFrame960x540
1012
+ case 10: return .iFrame1280x720
1013
+ case 12: return .vga640x480
1014
+ case 13: return .cif352x288
1015
+ default: return .hd1920x1080
1016
+ }
1017
+ }
1018
+ func encode() -> Int {
1019
+ switch self {
1020
+ case .medium: return 1
1021
+ case .high: return 2
1022
+ case .photo: return 3
1023
+ case .inputPriority: return 4
1024
+ case .hd1280x720: return 6
1025
+ case .hd1920x1080: return 7
1026
+ case .hd4K3840x2160: return 8
1027
+ case .iFrame960x540: return 9
1028
+ case .iFrame1280x720: return 10
1029
+ case .vga640x480: return 12
1030
+ case .cif352x288: return 13
1031
+ default: return 0
1032
+ }
1033
+ }
1034
+ }
1035
+
1036
+ extension TextProcessing {
1037
+ static func decode(_ it: Any?) -> TextProcessing {
1038
+ switch it as? Int {
1039
+ case 1: return .uppercase()
1040
+ case 2: return .lowercase()
1041
+ case 3: return .capital()
1042
+ default: return .noChange()
1043
+ }
1044
+ }
1045
+ func encode() -> Any? {
1046
+ return self.value(forKey: "rawValue")
1047
+ }
1048
+ }
1049
+
1050
+ extension ImageQualityCheckType {
1051
+ static func decode(_ it: Any?) -> Self {
1052
+ switch it as? Int {
1053
+ case 1: return .imageFocus
1054
+ case 2: return .imageResolution
1055
+ case 3: return .imageColorness
1056
+ case 4: return .imagePerspective
1057
+ case 5: return .imageBounds
1058
+ case 6: return .screenCapture
1059
+ case 7: return .portrait
1060
+ case 8: return .handwritten
1061
+ case 9: return .brightness
1062
+ case 10: return .occlusion
1063
+ default: return .imageGlares
1064
+ }
1065
+ }
1066
+ func encode() -> Int {
1067
+ switch self {
1068
+ case .imageFocus: return 1
1069
+ case .imageResolution: return 2
1070
+ case .imageColorness: return 3
1071
+ case .imagePerspective: return 4
1072
+ case .imageBounds: return 5
1073
+ case .screenCapture: return 6
1074
+ case .portrait: return 7
1075
+ case .handwritten: return 8
1076
+ case .brightness: return 9
1077
+ case .occlusion: return 10
1078
+ default: return 0
1079
+ }
1080
+ }
1081
+ }
1082
+
1083
+ extension DocReader.CustomizationColor {
1084
+ static func fromDartKey(_ key: String) -> Self? {
1085
+ switch key {
1086
+ case "rfidProcessingScreenBackground": return .rfidProcessingScreenBackground
1087
+ case "rfidProcessingScreenHintLabelText": return .rfidProcessingScreenHintLabelText
1088
+ case "rfidProcessingScreenHintLabelBackground": return .rfidProcessingScreenHintLabelBackground
1089
+ case "rfidProcessingScreenProgressLabelText": return .rfidProcessingScreenProgressLabelText
1090
+ case "rfidProcessingScreenProgressBar": return .rfidProcessingScreenProgressBar
1091
+ case "rfidProcessingScreenProgressBarBackground": return .rfidProcessingScreenProgressBarBackground
1092
+ case "rfidProcessingScreenResultLabelText": return .rfidProcessingScreenResultLabelText
1093
+ case "rfidProcessingScreenLoadingBar": return .rfidProcessingScreenLoadingBar
1094
+ case "mdlProcessingScreenBackground": return .mdlProcessingScreenBackground
1095
+ case "mdlProcessingScreenHintLabelText": return .mdlProcessingScreenHintLabelText
1096
+ case "mdlProcessingScreenHintLabelBackground": return .mdlProcessingScreenHintLabelBackground
1097
+ case "mdlProcessingScreenProgressLabelText": return .mdlProcessingScreenProgressLabelText
1098
+ case "mdlProcessingScreenResultLabelText": return .mdlProcessingScreenResultLabelText
1099
+ case "mdlProcessingScreenLoadingBar": return .mdlProcessingScreenLoadingBar
1100
+ case "nextPageIdCardFront": return .nextPageIdCardFront
1101
+ case "nextPageIdCardBack": return .nextPageIdCardBack
1102
+ case "nextPagePassportShift": return .nextPagePassportShift
1103
+ case "nextPagePassportFlip": return .nextPagePassportFlip
1104
+ default: return nil
1105
+ }
1106
+ }
1107
+ }
1108
+
1109
+ extension DocReader.CustomizationFont {
1110
+ static func fromDartKey(_ key: String) -> Self? {
1111
+ switch key {
1112
+ case "rfidProcessingScreenHintLabel": return .rfidProcessingScreenHintLabel
1113
+ case "rfidProcessingScreenProgressLabel": return .rfidProcessingScreenProgressLabel
1114
+ case "rfidProcessingScreenResultLabel": return .rfidProcessingScreenResultLabel
1115
+ case "mdlProcessingScreenHintLabel": return .mdlProcessingScreenHintLabel
1116
+ case "mdlProcessingScreenProgressLabel": return .mdlProcessingScreenProgressLabel
1117
+ case "mdlProcessingScreenResultLabel": return .mdlProcessingScreenResultLabel
1118
+ default: return nil
1119
+ }
1120
+ }
1121
+ }
1122
+
1123
+ extension DocReader.CustomizationImage {
1124
+ static func fromDartKey(_ key: String) -> Self? {
1125
+ switch key {
1126
+ case "helpAnimation": return .helpAnimation
1127
+ case "livenessAnimation": return .livenessAnimation
1128
+ case "borderBackground": return .borderBackground
1129
+ case "torchButtonOn": return .torchButtonOn
1130
+ case "torchButtonOff": return .torchButtonOff
1131
+ case "captureButton": return .captureButton
1132
+ case "switchButton": return .switchButton
1133
+ case "closeButton": return .closeButton
1134
+ case "multipageButton": return .multipageButton
1135
+ case "rfidProcessingScreenFailureImage": return .rfidProcessingScreenFailure
1136
+ case "mdlProcessingScreenFailureImage": return .mdlProcessingScreenFailure
1137
+ case "nextPageIdCardFront": return .nextPageIdCardFront
1138
+ case "nextPageIdCardBack": return .nextPageIdCardBack
1139
+ case "nextPagePassportShift": return .nextPagePassportShift
1140
+ case "nextPagePassportFlipStart": return .nextPagePassportFlipStart
1141
+ case "nextPagePassportFlipClean": return .nextPagePassportFlipClean
1142
+ case "nextPagePassportFlipTop": return .nextPagePassportFlipTop
1143
+ case "nextPagePassportFlipBottom": return .nextPagePassportFlipBottom
1144
+ default: return nil
1145
+ }
1146
+ }
1147
+ }
1148
+
1149
+ extension DocReader.CustomizationTiming {
1150
+ static func fromDartKey(_ key: String) -> Self? {
1151
+ switch key {
1152
+ case "nextPageIdCardStartDelay": return .nextPageIdCardStartDelay
1153
+ case "nextPageIdCardEndDelay": return .nextPageIdCardEndDelay
1154
+ case "nextPagePassportShiftStartDelay": return .nextPagePassportShiftStartDelay
1155
+ case "nextPagePassportShiftEndDelay": return .nextPagePassportShiftEndDelay
1156
+ case "nextPagePassportFlipStartDelay": return .nextPagePassportFlipStartDelay
1157
+ case "nextPagePassportFlipEndDelay": return .nextPagePassportFlipEndDelay
1158
+ default: return nil
1159
+ }
1160
+ }
1161
+ }
1162
+
1163
+ extension DocReader.CustomizationContentMode {
1164
+ static func fromDartKey(_ key: String) -> Self? {
1165
+ switch key {
1166
+ case "nextPageIdCardFront": return .nextPageIdCardFront
1167
+ case "nextPageIdCardBack": return .nextPageIdCardBack
1168
+ default: return nil
1169
+ }
1170
+ }
1171
+ }