@veriff/react-native-sdk 2.11.0 → 2.12.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/ios/VeriffSdk.swift +15 -10
- package/package.json +1 -1
package/ios/VeriffSdk.swift
CHANGED
|
@@ -64,7 +64,6 @@ class VeriffSdk: NSObject {
|
|
|
64
64
|
@objc(launchVeriff:resolver:rejecter:)
|
|
65
65
|
func launchVeriff(_ configuration: [String: AnyObject], resolver resolve: @escaping RCTPromiseResolveBlock, rejecter reject: @escaping RCTPromiseRejectBlock) {
|
|
66
66
|
|
|
67
|
-
var sessionUrl: String?
|
|
68
67
|
var veriffConfiguration: Veriff.VeriffSdk.Configuration?
|
|
69
68
|
var branding: Veriff.VeriffSdk.Branding?
|
|
70
69
|
|
|
@@ -145,9 +144,13 @@ class VeriffSdk: NSObject {
|
|
|
145
144
|
}
|
|
146
145
|
}
|
|
147
146
|
|
|
148
|
-
|
|
147
|
+
let sessionURL: URL
|
|
148
|
+
if let sessionURLString = configuration[VeriffSdk.SESSION_URL] as? String {
|
|
149
149
|
// Using new API
|
|
150
|
-
|
|
150
|
+
guard let url = URL(string: sessionURLString) else {
|
|
151
|
+
return reject(VeriffSdk.ERROR_INVALID_ARGS, "Invalid sessionUrl: \(sessionURLString)", nil)
|
|
152
|
+
}
|
|
153
|
+
sessionURL = url
|
|
151
154
|
var locale: Locale?
|
|
152
155
|
if let languageLocale = (configuration[VeriffSdk.LOCALE] as? String) {
|
|
153
156
|
locale = Locale(identifier: languageLocale)
|
|
@@ -157,8 +160,11 @@ class VeriffSdk: NSObject {
|
|
|
157
160
|
veriffConfiguration?.customIntroScreen = VeriffSdk.checkCustomIntro(configuration: configuration)
|
|
158
161
|
} else if let sessionToken = configuration[VeriffSdk.SESSION_TOKEN] as? String {
|
|
159
162
|
// Using deprecated API
|
|
160
|
-
let
|
|
161
|
-
|
|
163
|
+
let baseURLString = configuration[VeriffSdk.BASE_URL] as? String ?? VeriffSdk.DEFAULT_BASE_URL
|
|
164
|
+
guard let baseURL = URL(string: baseURLString) else {
|
|
165
|
+
return reject(VeriffSdk.ERROR_INVALID_ARGS, "Invalid baseUrl: \(baseURLString)", nil)
|
|
166
|
+
}
|
|
167
|
+
sessionURL = baseURL.appendingPathComponent(sessionToken)
|
|
162
168
|
|
|
163
169
|
veriffConfiguration = Veriff.VeriffSdk.Configuration(branding: branding)
|
|
164
170
|
veriffConfiguration?.customIntroScreen = VeriffSdk.checkCustomIntro(configuration: configuration)
|
|
@@ -175,8 +181,8 @@ class VeriffSdk: NSObject {
|
|
|
175
181
|
let veriff = Veriff.VeriffSdk.shared
|
|
176
182
|
veriff.delegate = self
|
|
177
183
|
veriff.implementationType = .reactNative
|
|
178
|
-
veriffConfiguration?.queryItems = VeriffSdk.updateConfigWithQueryItems(
|
|
179
|
-
veriff.startAuthentication(sessionUrl:
|
|
184
|
+
veriffConfiguration?.queryItems = VeriffSdk.updateConfigWithQueryItems(url: sessionURL)
|
|
185
|
+
veriff.startAuthentication(sessionUrl: sessionURL.absoluteString, configuration: veriffConfiguration)
|
|
180
186
|
}
|
|
181
187
|
}
|
|
182
188
|
|
|
@@ -188,9 +194,8 @@ class VeriffSdk: NSObject {
|
|
|
188
194
|
}
|
|
189
195
|
}
|
|
190
196
|
|
|
191
|
-
private static func updateConfigWithQueryItems(
|
|
192
|
-
let
|
|
193
|
-
let components = URLComponents(url: url!, resolvingAgainstBaseURL: false)
|
|
197
|
+
private static func updateConfigWithQueryItems(url: URL) -> [URLQueryItem]? {
|
|
198
|
+
let components = URLComponents(url: url, resolvingAgainstBaseURL: false)
|
|
194
199
|
return components?.queryItems
|
|
195
200
|
}
|
|
196
201
|
|