@veriff/react-native-sdk 12.0.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,13 +152,49 @@ 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)
|
|
148
161
|
}
|
|
149
162
|
}
|
|
150
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)
|
|
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
|
|
196
|
+
}
|
|
197
|
+
|
|
151
198
|
private static func checkCustomIntro(configuration:[String: Any]) -> Bool {
|
|
152
199
|
if let useCustomIntro = configuration[VeriffSdk.USE_CUSTOM_INTRO_SCREEN] as? Bool {
|
|
153
200
|
return useCustomIntro
|
|
@@ -194,6 +241,9 @@ extension VeriffSdk: VeriffSdkDelegate {
|
|
|
194
241
|
resultDict[VeriffSdk.ERROR] = VeriffSdk.ERROR_UNKNOWN
|
|
195
242
|
}
|
|
196
243
|
self.resolve?(resultDict)
|
|
244
|
+
DispatchQueue.main.async {
|
|
245
|
+
self.tearDownPresentationWindow()
|
|
246
|
+
}
|
|
197
247
|
}
|
|
198
248
|
|
|
199
249
|
func nfcDataExtracted(_ data: Veriff.VeriffSdk.NFCData) {
|
|
@@ -205,6 +255,22 @@ extension VeriffSdk: VeriffSdkDelegate {
|
|
|
205
255
|
}
|
|
206
256
|
}
|
|
207
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
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
|
|
208
274
|
private extension Dictionary where Key == String, Value == AnyObject {
|
|
209
275
|
func image(for key: String) -> UIImage? {
|
|
210
276
|
if
|
package/package.json
CHANGED
package/react-native-sdk.podspec
CHANGED