@soyio/soyio-rn-sdk-native-disclosure 6.1.3 → 6.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ios/AddonVersion.swift +5 -0
- package/ios/IOSFacetecSdk.swift +42 -17
- package/package.json +2 -1
package/ios/IOSFacetecSdk.swift
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import UIKit
|
|
2
2
|
import Foundation
|
|
3
|
+
import CoreNFC
|
|
3
4
|
import FaceTecSDK
|
|
4
5
|
import React
|
|
5
6
|
|
|
@@ -87,13 +88,11 @@ class IOSFacetecSdk: RCTEventEmitter {
|
|
|
87
88
|
}
|
|
88
89
|
|
|
89
90
|
DispatchQueue.main.async {
|
|
90
|
-
let
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
return
|
|
91
|
+
if let jsVersion = config["sdkVersion"] as? String, jsVersion != AddonVersion.value {
|
|
92
|
+
NSLog("[Soyio] version mismatch: @soyio/soyio-rn-sdk is %@ but the compiled native addon is %@. Update @soyio/soyio-rn-sdk-native-disclosure to the same version, then run \"cd ios && pod install\"",
|
|
93
|
+
jsVersion, AddonVersion.value)
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
-
// Apply customization before initializing (matching Android pattern)
|
|
97
96
|
var themeColors: [String: String]? = nil
|
|
98
97
|
if let theme = config["theme"] as? [String: Any] {
|
|
99
98
|
themeColors = [
|
|
@@ -102,8 +101,18 @@ class IOSFacetecSdk: RCTEventEmitter {
|
|
|
102
101
|
"disabledColor": theme["disabledColor"] as? String ?? ""
|
|
103
102
|
]
|
|
104
103
|
}
|
|
104
|
+
|
|
105
105
|
FacetecConfig.apply(theme: themeColors)
|
|
106
106
|
|
|
107
|
+
let status = FaceTec.sdk.getStatus()
|
|
108
|
+
if status == .initialized {
|
|
109
|
+
NSLog("[Soyio] FaceTec %@ already initialized; customization reapplied", FaceTec.sdk.version)
|
|
110
|
+
resolver(["success": true])
|
|
111
|
+
return
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
NSLog("[Soyio] initializing FaceTec %@", FaceTec.sdk.version)
|
|
115
|
+
|
|
107
116
|
// Initialize SDK directly (matching Android pattern)
|
|
108
117
|
FaceTec.sdk.initializeInProductionMode(
|
|
109
118
|
productionKeyText: productionKey,
|
|
@@ -123,6 +132,30 @@ class IOSFacetecSdk: RCTEventEmitter {
|
|
|
123
132
|
}
|
|
124
133
|
}
|
|
125
134
|
|
|
135
|
+
private func resolveTopViewController() -> UIViewController? {
|
|
136
|
+
let windowScenes = UIApplication.shared.connectedScenes.compactMap { $0 as? UIWindowScene }
|
|
137
|
+
let activeScene = windowScenes.first { $0.activationState == .foregroundActive } ?? windowScenes.first
|
|
138
|
+
let keyWindow = activeScene?.windows.first { $0.isKeyWindow } ?? activeScene?.windows.first
|
|
139
|
+
|
|
140
|
+
guard var topViewController = keyWindow?.rootViewController else {
|
|
141
|
+
NSLog("[Soyio] no window found: %d scenes, %d windows",
|
|
142
|
+
windowScenes.count, activeScene?.windows.count ?? 0)
|
|
143
|
+
return nil
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
while let presented = topViewController.presentedViewController {
|
|
147
|
+
topViewController = presented
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
NSLog("[Soyio] presenting over %@ (scenes: %d, windows: %d, nfcReadingAvailable: %@)",
|
|
151
|
+
String(describing: type(of: topViewController)),
|
|
152
|
+
windowScenes.count,
|
|
153
|
+
activeScene?.windows.count ?? 0,
|
|
154
|
+
NFCTagReaderSession.readingAvailable ? "true" : "false")
|
|
155
|
+
|
|
156
|
+
return topViewController
|
|
157
|
+
}
|
|
158
|
+
|
|
126
159
|
private func startLivenessAndIDVerificationFlow(facetecSessionToken: String,
|
|
127
160
|
soyioSessionToken: String,
|
|
128
161
|
disclosureRequestToken: String,
|
|
@@ -130,16 +163,11 @@ class IOSFacetecSdk: RCTEventEmitter {
|
|
|
130
163
|
resolver: @escaping RCTPromiseResolveBlock,
|
|
131
164
|
rejecter: @escaping RCTPromiseRejectBlock) {
|
|
132
165
|
|
|
133
|
-
guard let
|
|
166
|
+
guard let topViewController = self.resolveTopViewController() else {
|
|
134
167
|
rejecter("NO_VIEW_CONTROLLER", "Could not find root view controller", nil)
|
|
135
168
|
return
|
|
136
169
|
}
|
|
137
170
|
|
|
138
|
-
var topViewController = viewController
|
|
139
|
-
while let presented = topViewController.presentedViewController {
|
|
140
|
-
topViewController = presented
|
|
141
|
-
}
|
|
142
|
-
|
|
143
171
|
self.currentPhotoIDProcessor = SoyioPhotoIDMatchProcessor(
|
|
144
172
|
facetecSessionToken: facetecSessionToken,
|
|
145
173
|
soyioAuthToken: soyioSessionToken,
|
|
@@ -158,6 +186,7 @@ class IOSFacetecSdk: RCTEventEmitter {
|
|
|
158
186
|
self.currentPhotoIDProcessor = nil
|
|
159
187
|
}
|
|
160
188
|
)
|
|
189
|
+
NSLog("[Soyio] FaceTec session created (liveness-and-id)")
|
|
161
190
|
}
|
|
162
191
|
|
|
163
192
|
@objc
|
|
@@ -192,16 +221,11 @@ class IOSFacetecSdk: RCTEventEmitter {
|
|
|
192
221
|
resolver: @escaping RCTPromiseResolveBlock,
|
|
193
222
|
rejecter: @escaping RCTPromiseRejectBlock) {
|
|
194
223
|
|
|
195
|
-
guard let
|
|
224
|
+
guard let topViewController = self.resolveTopViewController() else {
|
|
196
225
|
rejecter("NO_VIEW_CONTROLLER", "Could not find root view controller", nil)
|
|
197
226
|
return
|
|
198
227
|
}
|
|
199
228
|
|
|
200
|
-
var topViewController = viewController
|
|
201
|
-
while let presented = topViewController.presentedViewController {
|
|
202
|
-
topViewController = presented
|
|
203
|
-
}
|
|
204
|
-
|
|
205
229
|
self.currentIDOnlyProcessor = SoyioIDOnlyProcessor(
|
|
206
230
|
facetecSessionToken: facetecSessionToken,
|
|
207
231
|
soyioAuthToken: soyioSessionToken,
|
|
@@ -217,5 +241,6 @@ class IOSFacetecSdk: RCTEventEmitter {
|
|
|
217
241
|
self.currentIDOnlyProcessor = nil
|
|
218
242
|
}
|
|
219
243
|
)
|
|
244
|
+
NSLog("[Soyio] FaceTec session created (id-only)")
|
|
220
245
|
}
|
|
221
246
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@soyio/soyio-rn-sdk-native-disclosure",
|
|
3
|
-
"version": "6.1.
|
|
3
|
+
"version": "6.1.4",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Ignacio Méndez",
|
|
6
6
|
"main": "./index.js",
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
"android/src/main/res/values/strings.xml",
|
|
22
22
|
"assets/fonts/RobotoFlex.ttf",
|
|
23
23
|
"assets/images/SoyioRnSdk.xcassets",
|
|
24
|
+
"ios/AddonVersion.swift",
|
|
24
25
|
"ios/ApiDate.swift",
|
|
25
26
|
"ios/FacetecConfig.swift",
|
|
26
27
|
"ios/FacetecStrings.swift",
|