@regulaforensics/face-sdk 8.2.856-rc → 8.2.860-nightly

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/RNFaceSDK.podspec +4 -4
  2. package/android/{CVDFaceSDK.kt → CDVFaceSDK.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 +12 -7
  6. package/examples/capacitor/android/app/build.gradle +2 -2
  7. package/examples/capacitor/android/app/capacitor.build.gradle +2 -3
  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 +2 -5
  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 +4 -5
  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 +20 -4
  17. package/examples/capacitor/ios/App/Podfile +5 -1
  18. package/examples/capacitor/ios/App/Podfile.lock +14 -14
  19. package/examples/capacitor/package-lock.json +811 -847
  20. package/examples/capacitor/package.json +17 -17
  21. package/examples/ionic/images/icon.png +0 -0
  22. package/examples/ionic/package-lock.json +2587 -2373
  23. package/examples/ionic/package.json +16 -14
  24. package/examples/ionic/patches/cordova-plugin-ionic-webview+5.0.1.patch +23 -0
  25. package/examples/ionic/scripts/ios.sh +1 -1
  26. package/examples/react_native/package-lock.json +1168 -1450
  27. package/examples/react_native/package.json +2 -2
  28. package/ios/CDVFaceSDK.swift +42 -0
  29. package/ios/Config.swift +242 -0
  30. package/ios/Decoder.swift +934 -0
  31. package/ios/Main.swift +191 -0
  32. package/ios/RNFaceSDK.m +7 -39
  33. package/ios/RNFaceSDK.swift +42 -0
  34. package/ios/Utils.swift +82 -0
  35. package/package.json +1 -1
  36. package/plugin.xml +11 -13
  37. package/test/package-lock.json +1 -1
  38. package/ios/CVDFaceSDK.h +0 -7
  39. package/ios/CVDFaceSDK.m +0 -43
  40. package/ios/RFSWConfig.h +0 -27
  41. package/ios/RFSWConfig.m +0 -199
  42. package/ios/RFSWJSONConstructor.h +0 -135
  43. package/ios/RFSWJSONConstructor.m +0 -985
  44. package/ios/RFSWMain.h +0 -24
  45. package/ios/RFSWMain.m +0 -381
  46. package/ios/RNFaceSDK.h +0 -8
package/ios/Main.swift ADDED
@@ -0,0 +1,191 @@
1
+ import FaceSDK
2
+
3
+ let face = FaceSDK.service
4
+ let db = face.personDatabase
5
+
6
+ let cameraSwitchEvent = "cameraSwitchEvent"
7
+ let livenessNotificationEvent = "livenessNotificationEvent"
8
+ let videoEncoderCompletionEvent = "video_encoder_completion"
9
+ let onCustomButtonTappedEvent = "onCustomButtonTappedEvent"
10
+
11
+ func methodCall(_ method: String, _ callback: @escaping Callback) {
12
+ switch method {
13
+ case("getVersion"): callback(face.version?.encode())
14
+ case("getServiceUrl"): callback(face.serviceURL)
15
+ case("setServiceUrl"): face.serviceURL = argsNullable(0)
16
+ case("getTenant"): callback(face.tenant)
17
+ case("setTenant"): face.tenant = argsNullable(0)
18
+ case("getEnv"): callback(face.env)
19
+ case("setEnv"): face.env = argsNullable(0)
20
+ case("getLocale"): callback(face.languageLocaleCode)
21
+ case("setLocale"): face.languageLocaleCode = argsNullable(0)
22
+ case("setLocalizationDictionary"):
23
+ face.localizationHandler = { (argsNullable(0) as [String : String?]?)?[$0] ?? nil }
24
+ case("setRequestHeaders"):
25
+ headers = argsNullable(0)
26
+ face.requestInterceptingDelegate = headersDelegate
27
+ case("setCustomization"): setCustomization(args(0))
28
+ case("isInitialized"): callback(face.isInitialized)
29
+ case("initialize"): face.initialize(
30
+ configuration: InitializationConfiguration.decode(argsNullable(0)),
31
+ completion: { success, error in
32
+ if success {
33
+ face.customization.configuration = UIConfiguration.default()
34
+ face.videoUploadingDelegate = videoUploadingDelegate
35
+ face.faceCaptureDelegate = faceCaptureDelegate
36
+ face.livenessDelegate = livenessDelegate
37
+ face.customization.actionDelegate = actionDelegate
38
+ }
39
+ callback(generateInitCompletion(success, error))
40
+ })
41
+ case("deinitialize"): face.deinitialize()
42
+ case("startFaceCapture"): DispatchQueue.main.async {
43
+ face.presentFaceCaptureViewController(
44
+ from: rootViewController()!,
45
+ animated: true,
46
+ configuration: FaceCaptureConfiguration.decode(argsNullable(0)),
47
+ onCapture: { callback($0.encode()) },
48
+ completion: nil)
49
+ }
50
+ case("stopFaceCapture"): face.stopFaceCaptureViewController()
51
+ case("startLiveness"): DispatchQueue.main.async {
52
+ face.startLiveness(
53
+ from: rootViewController()!,
54
+ animated: true,
55
+ configuration: LivenessConfiguration.decode(argsNullable(0)),
56
+ onLiveness: { callback($0.encode()) },
57
+ completion: nil)
58
+ }
59
+ case("stopLiveness"): face.stopLivenessProcessing()
60
+ case("matchFaces"): face.matchFaces(
61
+ MatchFacesRequest.decode(args(0)),
62
+ configuration: MatchFacesConfiguration.decode(argsNullable(0)),
63
+ completion: { callback($0.encode()) })
64
+ case("splitComparedFaces"): callback(MatchFacesSimilarityThresholdSplit(
65
+ pairs: (args(0) as [[String: Any?]]).compactMap { MatchFacesComparedFacesPair.decode($0) },
66
+ bySimilarityThreshold: args(1)).encode())
67
+ case("detectFaces"): face.detectFaces(
68
+ by: DetectFacesRequest.decode(args(0)),
69
+ completion: { callback($0.encode()) })
70
+
71
+ // MARK: - PersonDatabase
72
+
73
+ case("createPerson"): db.createPerson(
74
+ name: args(0),
75
+ metadata: argsNullable(1),
76
+ groupIds: argsNullable(2),
77
+ completion: { callback($0.encode()) }
78
+ )
79
+ case("updatePerson"): let json = args(0) as [String: Any]
80
+ db.getPerson(
81
+ personId: json["id"] as! String,
82
+ completion: {
83
+ guard let person = $0.item else { callback($0.encode()); return }
84
+ db.updatePerson(person: person.update(json), completion: { callback($0.encode()) })
85
+ })
86
+ case("deletePerson"): db.deletePerson(personId: args(0), completion: { callback($0.encode()) })
87
+ case("getPerson"): db.getPerson(personId: args(0), completion: { callback($0.encode()) })
88
+ case("addPersonImage"): db.addPersonImage(
89
+ personId: args(0),
90
+ imageUpload: PersonDatabase.ImageUpload.decode(args(1))!,
91
+ completion: { callback($0.encode()) })
92
+ case("deletePersonImage"): db.deletePersonImage(
93
+ personId: args(0),
94
+ imageId: args(1),
95
+ completion: { callback($0.encode()) })
96
+ case("getPersonImage"): db.getPersonImage(
97
+ personId: args(0),
98
+ imageId: args(1),
99
+ completion: { callback(encodeDBItemResponse($0.data?.encode(), $0.error)) })
100
+ case("getPersonImages"): db.getPersonImages(personId: args(0), completion: { callback($0.encode())})
101
+ case("getPersonImagesForPage"): db.getPersonImages(
102
+ personId: args(0),
103
+ page: args(1),
104
+ size: args(2),
105
+ completion: { callback($0.encode()) })
106
+ case("createGroup"): db.createGroup(
107
+ name: args(0),
108
+ metadata: argsNullable(1) as [String: Any]?,
109
+ completion: { callback($0.encode()) })
110
+ case("updateGroup"): let json = args(0) as [String: Any]
111
+ db.getGroups(
112
+ groupId: json["id"] as! String,
113
+ completion: {
114
+ guard let group = $0.item else { callback($0.encode()); return }
115
+ db.updateGroup(group: group.update(json), completion: { callback($0.encode()) })
116
+ })
117
+ case("editPersonsInGroup"): db.editGroupPersons(
118
+ groupId: args(0),
119
+ request: PersonDatabase.EditGroupPersonsRequest.decode(args(0)),
120
+ completion: { callback($0.encode()) })
121
+ case("deleteGroup"): db.deleteGroup(groupId: args(0), completion: { callback($0.encode()) })
122
+ case("getGroup"): db.getGroups(groupId: args(0), completion: { callback($0.encode()) })
123
+ case("getGroups"): db.getGroups(completion: { callback($0.encode()) })
124
+ case("getGroupsForPage"): db.getGroups(
125
+ page: args(0),
126
+ size: args(1),
127
+ completion: { callback($0.encode()) })
128
+ case("getPersonGroups"): db.getPersonGroups(personId: args(0), completion: { callback($0.encode()) })
129
+ case("getPersonGroupsForPage"): db.getPersonGroups(
130
+ personId: args(0),
131
+ page: args(1),
132
+ size: args(2),
133
+ completion: { callback($0.encode()) })
134
+ case("getPersonsInGroup"): db.getGroupPersons(groupId: args(0), completion: { callback($0.encode()) })
135
+ case("getPersonsInGroupForPage"): db.getGroupPersons(
136
+ groupId: args(0),
137
+ page: args(1),
138
+ size: args(2),
139
+ completion: { callback($0.encode()) })
140
+ case("searchPerson"): db.searchPerson(
141
+ searchRequest: PersonDatabase.SearchPersonRequest.decode(args(0)),
142
+ completion: { callback(encodeDBItemResponse($0.results?.compactMap{ $0.encode2() }, $0.error)) })
143
+ default: break
144
+ }
145
+ }
146
+
147
+ // MARK: - Implementation
148
+
149
+ var headers: [String: String]?
150
+ let headersDelegate = IURLRequestInterceptingDelegate()
151
+ class IURLRequestInterceptingDelegate: NSObject, URLRequestInterceptingDelegate {
152
+ func interceptorPrepare(_ request: URLRequest) -> URLRequest? {
153
+ guard let headers = headers else { return request }
154
+ var req = request
155
+ for (key, value) in headers {
156
+ req.addValue(value, forHTTPHeaderField: key)
157
+ }
158
+ return req
159
+ }
160
+ }
161
+
162
+ let videoUploadingDelegate = IVideoUploadingDelegate()
163
+ class IVideoUploadingDelegate: NSObject, VideoUploadingDelegate {
164
+ func videoUploading(forTransactionId transactionId: String, didFinishedWithSuccess success: Bool) {
165
+ sendEvent(videoEncoderCompletionEvent, generateVideoEncoderCompletion(success, transactionId))
166
+ }
167
+ }
168
+
169
+ let faceCaptureDelegate = IFaceCaptureDelegate()
170
+ class IFaceCaptureDelegate: NSObject, FaceCaptureDelegate {
171
+ func cameraPositionChanged(_ cameraPosition: CameraPosition) {
172
+ sendEvent(cameraSwitchEvent, cameraPosition)
173
+ }
174
+ }
175
+
176
+ let livenessDelegate = ILivenessDelegate()
177
+ class ILivenessDelegate: NSObject, LivenessDelegate {
178
+ func processStatusChanged(_ status: LivenessProcessStatus, result: LivenessResponse?) {
179
+ sendEvent(livenessNotificationEvent, generateLivenessNotification(status, result))
180
+ }
181
+ func cameraPositionChanged(_ cameraPosition: CameraPosition) {
182
+ sendEvent(cameraSwitchEvent, cameraPosition)
183
+ }
184
+ }
185
+
186
+ let actionDelegate = ICustomizationActionDelegate()
187
+ class ICustomizationActionDelegate: NSObject, FaceSDK.CustomizationActionDelegate {
188
+ func onFaceCustomButtonTapped(withTag tag: Int) {
189
+ sendEvent(onCustomButtonTappedEvent, tag)
190
+ }
191
+ }
package/ios/RNFaceSDK.m CHANGED
@@ -1,43 +1,11 @@
1
- #import "RNFaceSDK.h"
1
+ #import <React/RCTEventEmitter.h>
2
+ #import <React/RCTBridgeModule.h>
2
3
 
3
- @implementation RNFaceSDK
4
- RCT_EXPORT_MODULE();
4
+ @interface RCT_EXTERN_MODULE(RNFaceSDK, RCTEventEmitter)
5
5
 
6
- static NSMutableArray<RCTResponseSenderBlock>* _firedCallbacks = nil;
7
- - (NSMutableArray<RCTResponseSenderBlock>*)firedCallbacks {
8
- if (_firedCallbacks == nil) _firedCallbacks = @[].mutableCopy;
9
- return _firedCallbacks;
10
- }
11
-
12
- - (NSArray<NSString*>*)supportedEvents {
13
- return @[cameraSwitchEvent,
14
- livenessNotificationEvent,
15
- videoEncoderCompletionEvent,
16
- onCustomButtonTappedEvent];
17
- }
18
-
19
- static bool hasListeners;
20
- - (void)startObserving { hasListeners = YES; }
21
- - (void)stopObserving { hasListeners = NO; }
22
-
23
- UIViewController*(^RFSWRootViewController)(void) = ^UIViewController*(){
24
- return RCTPresentedViewController();
25
- };
26
-
27
- RCT_EXPORT_METHOD(exec:(NSString*)method:(NSArray*)args:(RCTPromiseResolveBlock)resolve:(RCTPromiseRejectBlock)reject) {
28
- RFSWCallback callback = ^(id _Nullable data) {
29
- if ([self.firedCallbacks containsObject:resolve]) return;
30
- [self.firedCallbacks addObject:resolve];
31
- resolve([RFSWJSONConstructor toSendable:data]);
32
- };
33
-
34
- RFSWEventSender sendEvent = ^(NSString* event, id data) {
35
- dispatch_async(dispatch_get_main_queue(), ^{
36
- if (hasListeners) [self sendEventWithName:event body:[RFSWJSONConstructor toSendable:data]];
37
- });
38
- };
39
-
40
- [RFSWMain methodCall:method :args :callback :sendEvent];
41
- }
6
+ RCT_EXTERN_METHOD(exec: (NSString*)method
7
+ newArgs:(NSArray*)newArgs
8
+ resolve:(RCTPromiseResolveBlock)resolve
9
+ reject:(RCTPromiseRejectBlock)reject)
42
10
 
43
11
  @end
@@ -0,0 +1,42 @@
1
+ import React
2
+
3
+ @objc(RNFaceSDK)
4
+ public class RNFaceSDK: RCTEventEmitter {
5
+ override public func startObserving() { hasListeners = true }
6
+ override public func stopObserving() { hasListeners = false }
7
+ override public func supportedEvents()->[String] {
8
+ return [cameraSwitchEvent,
9
+ livenessNotificationEvent,
10
+ videoEncoderCompletionEvent,
11
+ onCustomButtonTappedEvent];
12
+ }
13
+
14
+ @objc
15
+ func exec(
16
+ _ method: String,
17
+ newArgs: [Any],
18
+ resolve: @escaping RCTPromiseResolveBlock,
19
+ reject: @escaping RCTPromiseRejectBlock
20
+ ) {
21
+ this = self
22
+ args = newArgs
23
+ methodCall(method, { data in
24
+ if firedCallbacks.contains(where: { ($0 as AnyObject) === (resolve as AnyObject) }) { return }
25
+ firedCallbacks.append(resolve)
26
+ resolve(data.toSendable())
27
+ })
28
+ }
29
+ }
30
+
31
+ private var firedCallbacks: [RCTResponseSenderBlock] = []
32
+ private var hasListeners: Bool = false
33
+ private var this: RNFaceSDK?
34
+
35
+ func sendEvent(_ event: String, _ data: Any? = nil) {
36
+ guard let plugin = this, hasListeners else { return }
37
+ DispatchQueue.main.async {
38
+ plugin.sendEvent(withName: event, body: data.toSendable())
39
+ }
40
+ }
41
+
42
+ let rootViewController: () -> UIViewController? = { return RCTPresentedViewController() }
@@ -0,0 +1,82 @@
1
+ public typealias Callback = (Any?) -> Void
2
+
3
+ var args: [Any?] = []
4
+ func args<T>(_ index: Int) -> T {
5
+ return args[index] as! T
6
+ }
7
+
8
+ func argsNullable<T>(_ index: Int) -> T? {
9
+ if args[index] is NSNull { return nil }
10
+ return args[index] as! T?
11
+ }
12
+
13
+ extension Any? {
14
+ func toSendable() -> Any {
15
+ guard let self else { return NSNull() }
16
+ if self is [String: Any?] || self is [Any?] {
17
+ let data = try! JSONSerialization.data(withJSONObject: fixNulls(self), options: .prettyPrinted)
18
+ return String(data: data, encoding: .utf8)!
19
+ }
20
+ return self
21
+ }
22
+ }
23
+
24
+ func fixNulls(_ value: Any?) -> Any {
25
+ guard let value else { return NSNull() }
26
+ switch value {
27
+ case let value as [String: Any]:
28
+ var dict = [String: Any]()
29
+ for (k, v) in value { dict[k] = fixNulls(v) }
30
+ return dict
31
+ case let value as [Any]: return value.map { fixNulls($0) }
32
+ default: return value
33
+ }
34
+ }
35
+
36
+ extension NSObject {
37
+ static func allocate() -> NSObject {
38
+ return perform(NSSelectorFromString("alloc")).takeUnretainedValue() as! NSObject
39
+ }
40
+ static func emptyInit<T>() -> T {
41
+ return allocate().perform("init".selector()).takeUnretainedValue() as! T
42
+ }
43
+ }
44
+
45
+ extension String {
46
+ func selector() -> Selector {
47
+ return NSSelectorFromString(self)
48
+ }
49
+ }
50
+
51
+ func privateInit<T, Fn>(
52
+ _ allocated: NSObject,
53
+ _ selector: Selector,
54
+ _ function: Fn.Type,
55
+ _ call: (Fn) -> Unmanaged<AnyObject>?
56
+ ) -> T {
57
+ let f = unsafeBitCast(allocated.method(for: selector), to: function)
58
+ return call(f)!.takeUnretainedValue() as! T
59
+ }
60
+
61
+ extension Data {
62
+ static func decode(_ it: Any?) -> Self? {
63
+ guard var it = it as? String else { return nil }
64
+ if it.hasPrefix("data") { it = String(it[it.index(after: it.firstIndex(of: ",")!)...]) }
65
+ return Self(base64Encoded: it)
66
+ }
67
+
68
+ func encode() -> String {
69
+ return self.base64EncodedString()
70
+ }
71
+ }
72
+
73
+ extension UIImage {
74
+ static func decode(_ it: Any?) -> Self? {
75
+ guard let it = it as? String else { return nil }
76
+ return Self(data: Data.decode(it)!)
77
+ }
78
+
79
+ func encode() -> String {
80
+ return self.pngData()!.encode()
81
+ }
82
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@regulaforensics/face-sdk",
3
- "version": "8.2.856-rc",
3
+ "version": "8.2.860-nightly",
4
4
  "description": "This is an npm module for Regula Face SDK. It allows you to easily compaire faces using your phone's camera.",
5
5
  "main": "www/react-native/index.js",
6
6
  "module": "www/capacitor/index.js",
package/plugin.xml CHANGED
@@ -1,5 +1,5 @@
1
1
  <?xml version='1.0' encoding='utf-8'?>
2
- <plugin id="@regulaforensics/face-sdk" version="8.2.856-rc" xmlns="http://apache.org/cordova/ns/plugins/1.0">
2
+ <plugin id="@regulaforensics/face-sdk" version="8.2.860-nightly" xmlns="http://apache.org/cordova/ns/plugins/1.0">
3
3
  <name>FaceSDK</name>
4
4
  <description>Cordova plugin for Regula Face SDK</description>
5
5
  <license>commercial</license>
@@ -12,24 +12,22 @@
12
12
  <platform name="ios">
13
13
  <config-file target="config.xml" parent="/widget">
14
14
  <feature name="FaceSDK">
15
- <param name="ios-package" value="CVDFaceSDK" />
15
+ <param name="ios-package" value="CDVFaceSDK" />
16
16
  </feature>
17
17
  <preference name="deployment-target" value="13.0" />
18
+ <preference name="SwiftVersion" value="5" />
18
19
  </config-file>
19
- <header-file src="ios/CVDFaceSDK.h" />
20
- <source-file src="ios/CVDFaceSDK.m" />
21
- <header-file src="ios/RFSWMain.h" />
22
- <source-file src="ios/RFSWMain.m" />
23
- <header-file src="ios/RFSWJSONConstructor.h" />
24
- <source-file src="ios/RFSWJSONConstructor.m" />
25
- <header-file src="ios/RFSWConfig.h" />
26
- <source-file src="ios/RFSWConfig.m" />
20
+ <source-file src="ios/CDVFaceSDK.swift" />
21
+ <source-file src="ios/Main.swift" />
22
+ <source-file src="ios/Decoder.swift" />
23
+ <source-file src="ios/Config.swift" />
24
+ <source-file src="ios/Utils.swift" />
27
25
  <podspec>
28
26
  <config>
29
27
  <source url="https://github.com/CocoaPods/Specs.git" />
30
28
  </config>
31
29
  <pods>
32
- <pod name="FaceSDKStage" spec="8.2.3864" />
30
+ <pod name="FaceSDKNightly" spec="8.2.3869" />
33
31
  </pods>
34
32
  </podspec>
35
33
  </platform>
@@ -37,11 +35,11 @@
37
35
  <platform name="android">
38
36
  <config-file parent="/*" target="res/xml/config.xml">
39
37
  <feature name="FaceSDK">
40
- <param name="android-package" value="com.regula.plugin.facesdk.CVDFaceSDK" />
38
+ <param name="android-package" value="com.regula.plugin.facesdk.CDVFaceSDK" />
41
39
  </feature>
42
40
  </config-file>
43
41
  <framework src="android/cordova.gradle" custom="true" type="gradleReference" />
44
- <source-file src="android/CVDFaceSDK.kt" target-dir="java/com.regula.plugin.facesdk" />
42
+ <source-file src="android/CDVFaceSDK.kt" target-dir="java/com.regula.plugin.facesdk" />
45
43
  <source-file src="android/src/main/java/com/regula/plugin/facesdk/Main.kt" target-dir="java/com.regula.plugin.facesdk" />
46
44
  <source-file src="android/src/main/java/com/regula/plugin/facesdk/JSONConstructor.kt" target-dir="java/com.regula.plugin.facesdk" />
47
45
  <source-file src="android/src/main/java/com/regula/plugin/facesdk/Config.kt" target-dir="java/com.regula.plugin.facesdk" />
@@ -13,7 +13,7 @@
13
13
  },
14
14
  "..": {
15
15
  "name": "@regulaforensics/face-sdk",
16
- "version": "8.2.856-rc",
16
+ "version": "8.2.860-nightly",
17
17
  "dev": true,
18
18
  "license": "commercial"
19
19
  },
package/ios/CVDFaceSDK.h DELETED
@@ -1,7 +0,0 @@
1
- #import <Cordova/CDVPlugin.h>
2
- #import <Foundation/Foundation.h>
3
- #import "RFSWMain.h"
4
- @import UIKit;
5
-
6
- @interface CVDFaceSDK : CDVPlugin
7
- @end
package/ios/CVDFaceSDK.m DELETED
@@ -1,43 +0,0 @@
1
- #import "CVDFaceSDK.h"
2
-
3
- @implementation CVDFaceSDK
4
-
5
- static NSMutableDictionary<NSString*, NSString*>* _eventCallbackIds = nil;
6
- - (NSMutableDictionary<NSString*, NSString*>*)eventCallbackIds {
7
- if (_eventCallbackIds == nil) _eventCallbackIds = @{}.mutableCopy;
8
- return _eventCallbackIds;
9
- }
10
-
11
- UIViewController*(^RFSWRootViewController)(void) = ^UIViewController*(){
12
- for (UIScene *scene in UIApplication.sharedApplication.connectedScenes)
13
- if ([scene isKindOfClass:[UIWindowScene class]]) {
14
- UIWindowScene *windowScene = (UIWindowScene *)scene;
15
- for (UIWindow *window in windowScene.windows)
16
- if (window.isKeyWindow)
17
- return window.rootViewController;
18
- }
19
- return nil;
20
- };
21
-
22
- - (void) exec:(CDVInvokedUrlCommand*)command {
23
- NSString* method = command.arguments[0];
24
- NSMutableArray* args = [NSMutableArray new];
25
- for (int i = 1; i < command.arguments.count; i++) [args addObject:command.arguments[i]];
26
- if ([method isEqualToString:@"setEvent"]) {
27
- self.eventCallbackIds[args[0]] = command.callbackId;
28
- return;
29
- }
30
-
31
- RFSWEventSender sendEvent = ^(NSString* callbackId, id data) {
32
- NSString* eventId = [self.eventCallbackIds objectForKey:callbackId];
33
- if(eventId) callbackId = eventId;
34
- data = [RFSWJSONConstructor toSendable:data];
35
- CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:data];
36
- [result setKeepCallbackAsBool:YES];
37
- [self.commandDelegate sendPluginResult:result callbackId:callbackId];
38
- };
39
-
40
- [RFSWMain methodCall:method :args :^(id data) { sendEvent(command.callbackId, data); } :sendEvent];
41
- }
42
-
43
- @end
package/ios/RFSWConfig.h DELETED
@@ -1,27 +0,0 @@
1
- #ifndef RFSWConfig_h
2
- #define RFSWConfig_h
3
-
4
- #import <FaceSDK/FaceSDK.h>
5
- #import "RFSWJSONConstructor.h"
6
-
7
- @interface RFSWConfig : NSObject
8
-
9
- +(RFSFaceCaptureConfiguration* _Nonnull)faceCaptureConfigFromJSON:(id _Nonnull)input;
10
- +(NSDictionary<NSString*, id>* _Nonnull)generateFaceCaptureConfig:(RFSFaceCaptureConfiguration* _Nonnull)input;
11
-
12
- +(RFSLivenessConfiguration* _Nonnull)livenessConfigFromJSON:(id _Nonnull)input;
13
- +(NSDictionary<NSString*, id>* _Nonnull)generateLivenessConfig:(RFSLivenessConfiguration* _Nonnull)input;
14
-
15
- +(RFSMatchFacesConfiguration* _Nonnull)matchFacesConfigFromJSON:(id _Nonnull)input;
16
- +(NSDictionary<NSString*, id>* _Nonnull)generateMatchFacesConfig:(RFSMatchFacesConfiguration* _Nonnull)input;
17
-
18
-
19
- +(void)setCustomization:(NSDictionary* _Nonnull)config :(RFSCustomization* _Nonnull)result;
20
-
21
- +(RFSImageQualityCharacteristic* _Nonnull)imageQualityCharacteristicWithName:(NSString* _Nonnull)name
22
- recommendedRange:(NSArray<NSNumber*>* _Nullable)recommendedRange
23
- customRange:(NSArray* _Nullable)customRange
24
- color:(UIColor* _Nullable)color;
25
-
26
- @end
27
- #endif