@soyio/soyio-rn-sdk 4.1.1 → 4.1.3
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/IOSFacetecSdk.swift +35 -31
- package/package.json +1 -1
package/ios/IOSFacetecSdk.swift
CHANGED
|
@@ -8,6 +8,7 @@ class IOSFacetecSdk: RCTEventEmitter {
|
|
|
8
8
|
|
|
9
9
|
private var currentPhotoIDProcessor: SoyioPhotoIDMatchProcessor?
|
|
10
10
|
private var currentIDOnlyProcessor: SoyioIDOnlyProcessor?
|
|
11
|
+
private var isInitializing = false
|
|
11
12
|
|
|
12
13
|
@objc
|
|
13
14
|
override static func requiresMainQueueSetup() -> Bool {
|
|
@@ -86,39 +87,42 @@ class IOSFacetecSdk: RCTEventEmitter {
|
|
|
86
87
|
return
|
|
87
88
|
}
|
|
88
89
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
90
|
+
DispatchQueue.main.async {
|
|
91
|
+
if self.isInitializing {
|
|
92
|
+
resolver(["success": false, "error": "FaceTec SDK initialization already in progress"])
|
|
93
|
+
return
|
|
94
|
+
}
|
|
94
95
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
themeColors =
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
// Initialize SDK directly (matching Android pattern)
|
|
107
|
-
FaceTec.sdk.initializeInProductionMode(
|
|
108
|
-
productionKeyText: productionKey,
|
|
109
|
-
deviceKeyIdentifier: deviceKey,
|
|
110
|
-
faceScanEncryptionKey: publicKey,
|
|
111
|
-
completion: { initializationSuccessful in
|
|
112
|
-
if initializationSuccessful {
|
|
113
|
-
resolver(["success": true])
|
|
114
|
-
} else {
|
|
115
|
-
let sdkStatus = FaceTec.sdk.getStatus()
|
|
116
|
-
print("[FaceTec] Initialization failed with status: \(sdkStatus.rawValue) (\(sdkStatus))")
|
|
117
|
-
let errorMessage = self.getStatusErrorMessage(sdkStatus)
|
|
118
|
-
resolver(["success": false, "error": errorMessage])
|
|
119
|
-
}
|
|
96
|
+
self.isInitializing = true
|
|
97
|
+
|
|
98
|
+
// Apply customization before initializing (matching Android pattern)
|
|
99
|
+
var themeColors: [String: String]? = nil
|
|
100
|
+
if let theme = config["theme"] as? [String: Any] {
|
|
101
|
+
themeColors = [
|
|
102
|
+
"mainColor": theme["mainColor"] as? String ?? "",
|
|
103
|
+
"highlightColor": theme["highlightColor"] as? String ?? "",
|
|
104
|
+
"disabledColor": theme["disabledColor"] as? String ?? ""
|
|
105
|
+
]
|
|
120
106
|
}
|
|
121
|
-
|
|
107
|
+
FacetecConfig.apply(theme: themeColors)
|
|
108
|
+
|
|
109
|
+
FaceTec.sdk.initializeInProductionMode(
|
|
110
|
+
productionKeyText: productionKey,
|
|
111
|
+
deviceKeyIdentifier: deviceKey,
|
|
112
|
+
faceScanEncryptionKey: publicKey,
|
|
113
|
+
completion: { initializationSuccessful in
|
|
114
|
+
self.isInitializing = false
|
|
115
|
+
if initializationSuccessful {
|
|
116
|
+
resolver(["success": true])
|
|
117
|
+
} else {
|
|
118
|
+
let sdkStatus = FaceTec.sdk.getStatus()
|
|
119
|
+
print("[FaceTec] Initialization failed with status: \(sdkStatus.rawValue) (\(sdkStatus))")
|
|
120
|
+
let errorMessage = self.getStatusErrorMessage(sdkStatus)
|
|
121
|
+
resolver(["success": false, "error": errorMessage])
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
)
|
|
125
|
+
}
|
|
122
126
|
}
|
|
123
127
|
|
|
124
128
|
private func startLivenessAndIDVerificationFlow(facetecSessionToken: String,
|