@regulaforensics/face-sdk 8.2.911-nightly → 8.2.913-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.
Files changed (46) hide show
  1. package/RNFaceSDK.podspec +4 -4
  2. package/android/{CDVFaceSDK.kt → CVDFaceSDK.kt} +1 -1
  3. package/android/build.gradle +2 -2
  4. package/android/cordova.gradle +2 -2
  5. package/android/src/main/java/com/regula/plugin/facesdk/JSONConstructor.kt +7 -12
  6. package/examples/capacitor/android/app/build.gradle +2 -2
  7. package/examples/capacitor/android/app/capacitor.build.gradle +3 -2
  8. package/examples/capacitor/android/app/src/main/AndroidManifest.xml +1 -1
  9. package/examples/capacitor/android/build.gradle +3 -3
  10. package/examples/capacitor/android/capacitor.settings.gradle +5 -2
  11. package/examples/capacitor/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  12. package/examples/capacitor/android/gradle/wrapper/gradle-wrapper.properties +1 -1
  13. package/examples/capacitor/android/gradlew +5 -4
  14. package/examples/capacitor/android/gradlew.bat +2 -2
  15. package/examples/capacitor/android/variables.gradle +10 -10
  16. package/examples/capacitor/ios/App/App.xcodeproj/project.pbxproj +4 -20
  17. package/examples/capacitor/ios/App/Podfile +1 -5
  18. package/examples/capacitor/ios/App/Podfile.lock +14 -14
  19. package/examples/capacitor/package-lock.json +847 -811
  20. package/examples/capacitor/package.json +17 -17
  21. package/examples/ionic/images/icon.png +0 -0
  22. package/examples/ionic/package-lock.json +2419 -2633
  23. package/examples/ionic/package.json +14 -16
  24. package/examples/ionic/scripts/ios.sh +1 -1
  25. package/examples/react_native/package-lock.json +1443 -1161
  26. package/examples/react_native/package.json +2 -2
  27. package/ios/CVDFaceSDK.h +7 -0
  28. package/ios/CVDFaceSDK.m +43 -0
  29. package/ios/RFSWConfig.h +27 -0
  30. package/ios/RFSWConfig.m +199 -0
  31. package/ios/RFSWJSONConstructor.h +135 -0
  32. package/ios/RFSWJSONConstructor.m +985 -0
  33. package/ios/RFSWMain.h +24 -0
  34. package/ios/RFSWMain.m +381 -0
  35. package/ios/RNFaceSDK.h +8 -0
  36. package/ios/RNFaceSDK.m +39 -7
  37. package/package.json +1 -1
  38. package/plugin.xml +13 -11
  39. package/test/package-lock.json +1 -1
  40. package/examples/ionic/patches/cordova-plugin-ionic-webview+5.0.1.patch +0 -23
  41. package/ios/CDVFaceSDK.swift +0 -42
  42. package/ios/Config.swift +0 -242
  43. package/ios/Decoder.swift +0 -934
  44. package/ios/Main.swift +0 -191
  45. package/ios/RNFaceSDK.swift +0 -42
  46. package/ios/Utils.swift +0 -82
package/ios/Config.swift DELETED
@@ -1,242 +0,0 @@
1
- import UIKit
2
- import FaceSDK
3
-
4
- func setCustomization(_ it: [String: [String: Any]]) {
5
- for (key, value) in it {
6
- if key == "uiCustomizationLayer" {
7
- face.customization.customUILayerJSON = value as [AnyHashable : Any]
8
- continue
9
- }
10
- let dict = (face.customization.configuration!.value(forKey: key) as! NSMutableDictionary)
11
- for (k, v) in value {
12
- let k = Int(k)!
13
- switch key {
14
- case("colors"): dict[k] = UIColor.decode(v)
15
- case("fonts"): dict[k] = UIFont.decode(v)
16
- case("images"): dict[k] = UIImage.decode(v)
17
- default: break
18
- }
19
- }
20
- }
21
- }
22
-
23
- public extension FaceCaptureConfiguration {
24
- static func decode(_ it: Any?) -> Self? {
25
- guard let it = it as? [String: Any] else { return nil }
26
- return Self(builder: { builder in
27
- for (k, v) in it {
28
- switch k {
29
- case("copyright"): builder.isCopyright = v as! Bool
30
- case("cameraSwitchEnabled"): builder.isCameraSwitchButtonEnabled = v as! Bool
31
- case("closeButtonEnabled"): builder.isCloseButtonEnabled = v as! Bool
32
- case("torchButtonEnabled"): builder.isTorchButtonEnabled = v as! Bool
33
- case("vibrateOnSteps"): builder.vibrateOnSteps = v as! Bool
34
- case("detectOcclusion"): builder.detectOcclusion = v as! Bool
35
- case("showFaceAnimation"): builder.showFaceAnimation = v as! Bool
36
- case("cameraPositionIOS"): builder.cameraPosition = CameraPosition(rawValue: v as! Int)!
37
- case("screenOrientation"): builder.screenOrientation = RFSScreenOrientation.decode(v)
38
- case("timeout"): builder.timeoutInterval = v as? NSNumber
39
- case("holdStillDuration"): builder.holdStillDuration = v as? NSNumber
40
- default: break
41
- }
42
- }
43
- })
44
- }
45
- func encode() -> [String: Any?] {
46
- return [
47
- "copyright": self.isCopyright,
48
- "cameraSwitchEnabled": self.isCameraSwitchButtonEnabled,
49
- "closeButtonEnabled": self.isCloseButtonEnabled,
50
- "torchButtonEnabled": self.isTorchButtonEnabled,
51
- "vibrateOnSteps": self.vibrateOnSteps,
52
- "detectOcclusion": self.detectOcclusion,
53
- "showFaceAnimation": self.showFaceAnimation,
54
- "cameraPositionIOS": self.cameraPosition.rawValue,
55
- "screenOrientation": self.screenOrientation.encode(),
56
- "timeout": self.timeoutInterval,
57
- "holdStillDuration": self.holdStillDuration,
58
- ]
59
- }
60
- }
61
-
62
- public extension LivenessConfiguration {
63
- static func decode(_ it: Any?) -> Self? {
64
- guard let it = it as? [String: Any] else { return nil }
65
- return Self(builder: { builder in
66
- for (k, v) in it {
67
- switch k {
68
- case("copyright"): builder.isCopyright = v as! Bool
69
- case("cameraSwitchEnabled"): builder.isCameraSwitchButtonEnabled = v as! Bool
70
- case("closeButtonEnabled"): builder.isCloseButtonEnabled = v as! Bool
71
- case("torchButtonEnabled"): builder.isTorchButtonEnabled = v as! Bool
72
- case("vibrateOnSteps"): builder.vibrateOnSteps = v as! Bool
73
- case("cameraPositionIOS"): builder.cameraPosition = CameraPosition(rawValue: v as! Int)!
74
- case("attemptsCount"): builder.attemptsCount = v as! Int
75
- case("locationTrackingEnabled"): builder.isLocationTrackingEnabled = v as! Bool
76
- case("recordingProcess"): builder.recordingProcess = RecordingProcess(rawValue: v as! Int)!
77
- case("livenessType"): builder.livenessType = LivenessType(rawValue: v as! Int)!
78
- case("screenOrientation"): builder.screenOrientation = RFSScreenOrientation.decode(v)
79
- case("tag"): builder.tag = v as? String
80
- case("skipStep"): builder.stepSkippingMask = RFSLivenessStepSkip.decode(v)
81
- case("metadata"): builder.metadata = v as! [String: Any]
82
- default: break
83
- }
84
- }
85
- })
86
- }
87
- func encode() -> [String: Any?] {
88
- return [
89
- "copyright": self.isCopyright,
90
- "cameraSwitchEnabled": self.isCameraSwitchButtonEnabled,
91
- "closeButtonEnabled": self.isCloseButtonEnabled,
92
- "torchButtonEnabled": self.isTorchButtonEnabled,
93
- "vibrateOnSteps": self.vibrateOnSteps,
94
- "cameraPositionIOS": self.cameraPosition.rawValue,
95
- "attemptsCount": self.attemptsCount,
96
- "locationTrackingEnabled": self.isLocationTrackingEnabled,
97
- "recordingProcess": self.recordingProcess.rawValue,
98
- "livenessType": self.livenessType.rawValue,
99
- "screenOrientation": self.screenOrientation.encode(),
100
- "tag": self.tag,
101
- "skipStep": self.stepSkippingMask.encode(),
102
- "metadata": self.metadata,
103
- ]
104
- }
105
- }
106
-
107
- public extension MatchFacesConfiguration {
108
- static func decode(_ it: Any?) -> Self? {
109
- guard let it = it as? [String: Any] else { return nil }
110
- return Self(builder: { builder in
111
- for (k, v) in it {
112
- switch k {
113
- case("processingMode"): builder.processingMode = FaceSDK.ProcessingMode(rawValue: v as! Int)!
114
- case("locationTrackingEnabled"): builder.isLocationTrackingEnabled = v as! Bool
115
- default: break
116
- }
117
- }
118
- })
119
- }
120
- func encode() -> [String: Any?] {
121
- return [
122
- "processingMode": self.processingMode.rawValue,
123
- "locationTrackingEnabled": self.isLocationTrackingEnabled,
124
- ]
125
- }
126
- }
127
-
128
- // MARK: - Convetring
129
-
130
- extension UIColor {
131
- // Create from a hex integer; supports #RGB, #ARGB, #RRGGBB, #AARRGGBB semantics
132
- static func decode(_ it: Any?) -> Self? {
133
- guard let it = it as? Int else { return nil }
134
- // Build hex string manually to preserve leading zeros when derived from integers
135
- var value = UInt32(truncatingIfNeeded: it)
136
- let digits = Array("0123456789ABCDEF")
137
- var hex = ""
138
- while value > 0 {
139
- let d = Int(value % 16)
140
- hex.insert(digits[d], at: hex.startIndex)
141
- value /= 16
142
- }
143
- if hex.isEmpty { hex = "0" }
144
- // If length is 5 or 7, pad a leading 0 to restore a lost leading nibble
145
- if hex.count == 5 || hex.count == 7 { hex = "0" + hex }
146
- let s = hex.uppercased()
147
-
148
- let a, r, g, b: CGFloat
149
- switch s.count {
150
- case 3: // RGB
151
- a = 1.0
152
- r = Self.component(from: s, start: 0, length: 1)
153
- g = Self.component(from: s, start: 1, length: 1)
154
- b = Self.component(from: s, start: 2, length: 1)
155
- case 4: // ARGB
156
- a = Self.component(from: s, start: 0, length: 1)
157
- r = Self.component(from: s, start: 1, length: 1)
158
- g = Self.component(from: s, start: 2, length: 1)
159
- b = Self.component(from: s, start: 3, length: 1)
160
- case 6: // RRGGBB
161
- a = 1.0
162
- r = Self.component(from: s, start: 0, length: 2)
163
- g = Self.component(from: s, start: 2, length: 2)
164
- b = Self.component(from: s, start: 4, length: 2)
165
- case 8: // AARRGGBB
166
- a = Self.component(from: s, start: 0, length: 2)
167
- r = Self.component(from: s, start: 2, length: 2)
168
- g = Self.component(from: s, start: 4, length: 2)
169
- b = Self.component(from: s, start: 6, length: 2)
170
- default:
171
- assertionFailure("Invalid color value: #\(s). Expected #RGB, #ARGB, #RRGGBB, or #AARRGGBB")
172
- return nil
173
- }
174
- return Self(red: r, green: g, blue: b, alpha: a)
175
- }
176
-
177
- // AARRGGBB integer representation as Int
178
- func encode() -> Int {
179
- var r: CGFloat = 0, g: CGFloat = 0, b: CGFloat = 0, a: CGFloat = 0
180
- if !getRed(&r, green: &g, blue: &b, alpha: &a) {
181
- if let comps = cgColor.components {
182
- if comps.count == 2 { r = comps[0]; g = comps[0]; b = comps[0]; a = comps[1] }
183
- else if comps.count >= 4 { r = comps[0]; g = comps[1]; b = comps[2]; a = comps[3] }
184
- }
185
- }
186
- let aa = UInt32(lroundf(Float(a * 255)))
187
- let rr = UInt32(lroundf(Float(r * 255)))
188
- let gg = UInt32(lroundf(Float(g * 255)))
189
- let bb = UInt32(lroundf(Float(b * 255)))
190
- let composed: UInt32 = (aa << 24) | (rr << 16) | (gg << 8) | bb
191
- return Int(truncatingIfNeeded: composed)
192
- }
193
-
194
- private static func component(from hex: String, start: Int, length: Int) -> CGFloat {
195
- let startIdx = hex.index(hex.startIndex, offsetBy: start)
196
- let endIdx = hex.index(startIdx, offsetBy: length)
197
- let substr = String(hex[startIdx..<endIdx])
198
- let full = (length == 2) ? substr : substr + substr
199
- let value = UInt32(full, radix: 16) ?? 0
200
- return CGFloat(value) / 255.0
201
- }
202
- }
203
-
204
- extension UIFont {
205
- static func decode(_ it: Any?) -> Self? {
206
- guard let it = it as? [String: Any] else { return nil }
207
- return Self(name: it["name"] as! String,
208
- size: it["size"] as! CGFloat)
209
- }
210
- }
211
-
212
- extension RFSScreenOrientation {
213
- static func decode(_ it: Any?) -> Self {
214
- let it = it as! [Int]
215
- if it.contains(0) && it.contains(1) { return Self(arrayLiteral: .portrait, .landscape) }
216
- if it.contains(0) { return Self(arrayLiteral: .portrait) }
217
- if it.contains(1) { return Self(arrayLiteral: .landscape) }
218
- return Self(arrayLiteral: [])
219
- }
220
- func encode() -> [Int] {
221
- if self == .portrait { return [0] }
222
- if self == .landscape { return [1] }
223
- if self == [.portrait, .landscape] { return [0, 1] }
224
- return []
225
- }
226
- }
227
-
228
- extension RFSLivenessStepSkip {
229
- static func decode(_ it: Any?) -> Self {
230
- let it = it as! [Int]
231
- if it.contains(0) && it.contains(1) { return Self(arrayLiteral: .onboarding, .success) }
232
- if it.contains(0) { return Self(arrayLiteral: .onboarding) }
233
- if it.contains(1) { return Self(arrayLiteral: .success) }
234
- return Self(arrayLiteral: [])
235
- }
236
- func encode() -> [Int] {
237
- if self == .onboarding { return [0] }
238
- if self == .success { return [1] }
239
- if self == [.onboarding, .success] { return [0, 1] }
240
- return []
241
- }
242
- }