@veriff/react-native-sdk 11.2.0 → 13.0.0
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/android/build.gradle
CHANGED
|
@@ -174,6 +174,26 @@ class VeriffSdkModule(private val reactContext: ReactApplicationContext) :
|
|
|
174
174
|
if (brandConfig.hasKey(KEY_ERROR)) {
|
|
175
175
|
branding.error(parseColor(brandConfig.getString(KEY_ERROR)))
|
|
176
176
|
}
|
|
177
|
+
if (brandConfig.hasKey(KEY_FEEDBACK_SUCCESS)) {
|
|
178
|
+
branding.feedbackSuccess(
|
|
179
|
+
parseColor(brandConfig.getString(KEY_FEEDBACK_SUCCESS))
|
|
180
|
+
)
|
|
181
|
+
}
|
|
182
|
+
if (brandConfig.hasKey(KEY_ON_FEEDBACK_SUCCESS)) {
|
|
183
|
+
branding.onFeedbackSuccess(
|
|
184
|
+
parseColor(brandConfig.getString(KEY_ON_FEEDBACK_SUCCESS))
|
|
185
|
+
)
|
|
186
|
+
}
|
|
187
|
+
if (brandConfig.hasKey(KEY_FEEDBACK_ERROR)) {
|
|
188
|
+
branding.feedbackError(
|
|
189
|
+
parseColor(brandConfig.getString(KEY_FEEDBACK_ERROR))
|
|
190
|
+
)
|
|
191
|
+
}
|
|
192
|
+
if (brandConfig.hasKey(KEY_ON_FEEDBACK_ERROR)) {
|
|
193
|
+
branding.onFeedbackError(
|
|
194
|
+
parseColor(brandConfig.getString(KEY_ON_FEEDBACK_ERROR))
|
|
195
|
+
)
|
|
196
|
+
}
|
|
177
197
|
if (brandConfig.hasKey(KEY_BUTTON_RADIUS)) {
|
|
178
198
|
branding.buttonRadius(brandConfig.getDouble(KEY_BUTTON_RADIUS).toFloat())
|
|
179
199
|
}
|
|
@@ -375,6 +395,10 @@ class VeriffSdkModule(private val reactContext: ReactApplicationContext) :
|
|
|
375
395
|
private const val KEY_OUTLINE = "outline"
|
|
376
396
|
private const val KEY_SUCCESS = "success"
|
|
377
397
|
private const val KEY_ERROR = "error"
|
|
398
|
+
private const val KEY_FEEDBACK_SUCCESS = "feedbackSuccess"
|
|
399
|
+
private const val KEY_ON_FEEDBACK_SUCCESS = "onFeedbackSuccess"
|
|
400
|
+
private const val KEY_FEEDBACK_ERROR = "feedbackError"
|
|
401
|
+
private const val KEY_ON_FEEDBACK_ERROR = "onFeedbackError"
|
|
378
402
|
const val KEY_BUTTON_RADIUS = "buttonRadius"
|
|
379
403
|
private const val KEY_CUSTOM_INTRO_SCREEN = "customIntroScreen"
|
|
380
404
|
private const val KEY_RN_IMAGE_URI = "uri"
|
package/ios/Podfile
CHANGED
package/ios/VeriffSdk.swift
CHANGED
|
@@ -36,6 +36,13 @@ class VeriffSdk: NSObject {
|
|
|
36
36
|
private var resolve: RCTPromiseResolveBlock?
|
|
37
37
|
private var reject: RCTPromiseRejectBlock?
|
|
38
38
|
|
|
39
|
+
// Dedicated window used to present Veriff in isolation from the host app's
|
|
40
|
+
// window/view-controller hierarchy (which can be polluted by libraries like
|
|
41
|
+
// react-native-keyboard-controller, react-native-screens, etc., causing the
|
|
42
|
+
// SDK's safe-area calculations to misbehave on subsequent screens) - See EUP-6551, EUP-6171
|
|
43
|
+
private var presentationWindow: UIWindow?
|
|
44
|
+
private weak var previousKeyWindow: UIWindow?
|
|
45
|
+
|
|
39
46
|
@objc
|
|
40
47
|
func constantsToExport() -> [String: Any]! {
|
|
41
48
|
return [
|
|
@@ -93,6 +100,10 @@ class VeriffSdk: NSObject {
|
|
|
93
100
|
branding.outline = brandingConfig.color(for: "outline")
|
|
94
101
|
branding.error = brandingConfig.color(for: "error")
|
|
95
102
|
branding.success = brandingConfig.color(for: "success")
|
|
103
|
+
branding.feedbackSuccessBackground = brandingConfig.color(for: "feedbackSuccess")
|
|
104
|
+
branding.onFeedbackSuccess = brandingConfig.color(for: "onFeedbackSuccess")
|
|
105
|
+
branding.feedbackErrorBackground = brandingConfig.color(for: "feedbackError")
|
|
106
|
+
branding.onFeedbackError = brandingConfig.color(for: "onFeedbackError")
|
|
96
107
|
branding.buttonRadius = (brandingConfig["buttonRadius"] as? Double).map { CGFloat($0) }
|
|
97
108
|
if
|
|
98
109
|
let font = brandingConfig["iOSFont"] as? [String: Any],
|
|
@@ -141,11 +152,47 @@ class VeriffSdk: NSObject {
|
|
|
141
152
|
self.resolve = resolve
|
|
142
153
|
self.reject = reject
|
|
143
154
|
|
|
155
|
+
let presenter = self.makePresentationViewController()
|
|
156
|
+
|
|
144
157
|
let veriff = Veriff.VeriffSdk.shared
|
|
145
158
|
veriff.delegate = self
|
|
146
159
|
veriff.implementationType = .reactNative
|
|
147
|
-
veriff.startAuthentication(sessionUrl: sessionURL.absoluteString, configuration: veriffConfiguration)
|
|
160
|
+
veriff.startAuthentication(sessionUrl: sessionURL.absoluteString, configuration: veriffConfiguration, presentingFrom: presenter)
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
private func makePresentationViewController() -> UIViewController {
|
|
165
|
+
let scenes = UIApplication.shared.connectedScenes
|
|
166
|
+
.compactMap { $0 as? UIWindowScene }
|
|
167
|
+
let activeScene = scenes.first { $0.activationState == .foregroundActive } ?? scenes.first
|
|
168
|
+
|
|
169
|
+
let window: UIWindow = if let scene = activeScene {
|
|
170
|
+
UIWindow(windowScene: scene)
|
|
171
|
+
} else {
|
|
172
|
+
UIWindow(frame: UIScreen.main.bounds)
|
|
148
173
|
}
|
|
174
|
+
|
|
175
|
+
let rootVC = VeriffPresentationRootViewController()
|
|
176
|
+
window.rootViewController = rootVC
|
|
177
|
+
window.windowLevel = .normal + 1
|
|
178
|
+
window.backgroundColor = .clear
|
|
179
|
+
|
|
180
|
+
self.previousKeyWindow = UIApplication.shared.connectedScenes
|
|
181
|
+
.compactMap { $0 as? UIWindowScene }
|
|
182
|
+
.flatMap { $0.windows }
|
|
183
|
+
.first { $0.isKeyWindow }
|
|
184
|
+
self.presentationWindow = window
|
|
185
|
+
window.makeKeyAndVisible()
|
|
186
|
+
|
|
187
|
+
return rootVC
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
private func tearDownPresentationWindow() {
|
|
191
|
+
presentationWindow?.isHidden = true
|
|
192
|
+
presentationWindow?.rootViewController = nil
|
|
193
|
+
presentationWindow = nil
|
|
194
|
+
previousKeyWindow?.makeKey()
|
|
195
|
+
previousKeyWindow = nil
|
|
149
196
|
}
|
|
150
197
|
|
|
151
198
|
private static func checkCustomIntro(configuration:[String: Any]) -> Bool {
|
|
@@ -185,12 +232,42 @@ extension VeriffSdk: VeriffSdkDelegate {
|
|
|
185
232
|
case .deprecatedSDKVersion:
|
|
186
233
|
resultDict[VeriffSdk.ERROR] = VeriffSdk.ERROR_UNSUPPORTED_SDK_VERSION
|
|
187
234
|
@unknown default:
|
|
188
|
-
|
|
235
|
+
assertionFailure("Unknown error: \(err)")
|
|
236
|
+
resultDict[VeriffSdk.ERROR] = VeriffSdk.ERROR_UNKNOWN
|
|
189
237
|
}
|
|
190
238
|
@unknown default:
|
|
191
|
-
|
|
239
|
+
assertionFailure("Unknown status: \(result.status)")
|
|
240
|
+
resultDict[VeriffSdk.STATUS] = VeriffSdk.STATUS_ERROR
|
|
241
|
+
resultDict[VeriffSdk.ERROR] = VeriffSdk.ERROR_UNKNOWN
|
|
192
242
|
}
|
|
193
243
|
self.resolve?(resultDict)
|
|
244
|
+
DispatchQueue.main.async {
|
|
245
|
+
self.tearDownPresentationWindow()
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
func nfcDataExtracted(_ data: Veriff.VeriffSdk.NFCData) {
|
|
250
|
+
// NFC data extraction callback - not exposed to React Native
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
func nfcDataExtractionFailed() {
|
|
254
|
+
// NFC data extraction failure callback - not exposed to React Native
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
// Root view controller for the dedicated presentation window. Acts as a
|
|
259
|
+
// transparent envelope: defers orientation to the host's Info.plist (via the
|
|
260
|
+
// system's intersection of the default supportedInterfaceOrientations with
|
|
261
|
+
// UISupportedInterfaceOrientations) and delegates status-bar appearance to
|
|
262
|
+
// the Veriff SDK screens that get presented on top.
|
|
263
|
+
private class VeriffPresentationRootViewController: UIViewController {
|
|
264
|
+
override var childForStatusBarStyle: UIViewController? { presentedViewController }
|
|
265
|
+
override var childForStatusBarHidden: UIViewController? { presentedViewController }
|
|
266
|
+
|
|
267
|
+
override func loadView() {
|
|
268
|
+
let view = UIView()
|
|
269
|
+
view.backgroundColor = .clear
|
|
270
|
+
self.view = view
|
|
194
271
|
}
|
|
195
272
|
}
|
|
196
273
|
|
package/package.json
CHANGED
package/react-native-sdk.podspec
CHANGED