@veriff/react-native-sdk 2.9.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/android/build.gradle +22 -132
- package/ios/VeriffSdk.swift +15 -10
- package/package.json +1 -1
package/android/build.gradle
CHANGED
|
@@ -1,156 +1,46 @@
|
|
|
1
|
-
|
|
1
|
+
buildscript {
|
|
2
|
+
ext.safeExtGet = { prop, fallback ->
|
|
3
|
+
return rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
|
|
4
|
+
}
|
|
2
5
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
// - https://github.com/facebook/react-native/blob/0.58-stable/local-cli/templates/HelloWorld/android/build.gradle
|
|
8
|
-
//
|
|
9
|
-
// * https://github.com/facebook/react-native/blob/0.60-stable/template/android/app/build.gradle
|
|
10
|
-
// original location:
|
|
11
|
-
// - https://github.com/facebook/react-native/blob/0.58-stable/local-cli/templates/HelloWorld/android/app/build.gradle
|
|
6
|
+
repositories {
|
|
7
|
+
google()
|
|
8
|
+
mavenCentral()
|
|
9
|
+
}
|
|
12
10
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
11
|
+
dependencies {
|
|
12
|
+
classpath 'com.android.tools.build:gradle:7.0.4'
|
|
13
|
+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${safeExtGet('kotlinVersion', '1.6.10')}"
|
|
14
|
+
}
|
|
15
|
+
}
|
|
17
16
|
|
|
18
17
|
def safeExtGet(prop, fallback) {
|
|
19
18
|
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
|
|
20
19
|
}
|
|
21
20
|
|
|
22
21
|
apply plugin: 'com.android.library'
|
|
23
|
-
apply plugin: '
|
|
24
|
-
|
|
25
|
-
buildscript {
|
|
26
|
-
// The Android Gradle plugin is only required when opening the android folder stand-alone.
|
|
27
|
-
// This avoids unnecessary downloads and potential conflicts when the library is included as a
|
|
28
|
-
// module dependency in an application project.
|
|
29
|
-
// ref: https://docs.gradle.org/current/userguide/tutorial_using_tasks.html#sec:build_script_external_dependencies
|
|
30
|
-
if (project == rootProject) {
|
|
31
|
-
repositories {
|
|
32
|
-
google()
|
|
33
|
-
jcenter()
|
|
34
|
-
}
|
|
35
|
-
dependencies {
|
|
36
|
-
classpath 'com.android.tools.build:gradle:3.4.3'
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
apply plugin: 'com.android.library'
|
|
42
|
-
apply plugin: 'maven'
|
|
22
|
+
apply plugin: 'kotlin-android'
|
|
23
|
+
apply plugin: 'maven-publish'
|
|
43
24
|
|
|
44
25
|
android {
|
|
45
|
-
compileSdkVersion safeExtGet('compileSdkVersion',
|
|
46
|
-
buildToolsVersion safeExtGet('buildToolsVersion',
|
|
26
|
+
compileSdkVersion safeExtGet('compileSdkVersion', 31)
|
|
27
|
+
buildToolsVersion safeExtGet('buildToolsVersion', '31.0.0')
|
|
28
|
+
|
|
47
29
|
defaultConfig {
|
|
48
|
-
minSdkVersion safeExtGet('minSdkVersion',
|
|
49
|
-
targetSdkVersion safeExtGet('targetSdkVersion',
|
|
50
|
-
versionCode 1
|
|
51
|
-
versionName "1.0"
|
|
52
|
-
}
|
|
53
|
-
compileOptions {
|
|
54
|
-
sourceCompatibility JavaVersion.VERSION_1_8
|
|
55
|
-
targetCompatibility JavaVersion.VERSION_1_8
|
|
56
|
-
}
|
|
57
|
-
lintOptions {
|
|
58
|
-
abortOnError false
|
|
30
|
+
minSdkVersion safeExtGet('minSdkVersion', 21)
|
|
31
|
+
targetSdkVersion safeExtGet('targetSdkVersion', 31)
|
|
59
32
|
}
|
|
60
33
|
}
|
|
61
34
|
|
|
62
35
|
repositories {
|
|
63
|
-
// ref: https://www.baeldung.com/maven-local-repository
|
|
64
36
|
mavenLocal()
|
|
65
|
-
maven {
|
|
66
|
-
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
|
|
67
|
-
url "$rootDir/../node_modules/react-native/android"
|
|
68
|
-
}
|
|
69
|
-
maven {
|
|
70
|
-
// Android JSC is installed from npm
|
|
71
|
-
url "$rootDir/../node_modules/jsc-android/dist"
|
|
72
|
-
}
|
|
73
|
-
maven { url "https://cdn.veriff.me/android/" } //veriff public repo
|
|
74
37
|
google()
|
|
75
|
-
jcenter()
|
|
76
38
|
mavenCentral()
|
|
39
|
+
maven { url "https://cdn.veriff.me/android/" } //veriff public repo
|
|
77
40
|
}
|
|
78
41
|
|
|
79
42
|
dependencies {
|
|
80
43
|
//noinspection GradleDynamicVersion
|
|
81
44
|
implementation 'com.facebook.react:react-native:+'
|
|
82
|
-
implementation 'com.veriff:veriff-library:4.
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
def configureReactNativePom(def pom) {
|
|
86
|
-
def packageJson = new groovy.json.JsonSlurper().parseText(file('../package.json').text)
|
|
87
|
-
|
|
88
|
-
pom.project {
|
|
89
|
-
name packageJson.title
|
|
90
|
-
artifactId packageJson.name
|
|
91
|
-
version = packageJson.version
|
|
92
|
-
group = "com.reactlibrary"
|
|
93
|
-
description packageJson.description
|
|
94
|
-
url = "https://github.com/veriff/react-native-sdk"
|
|
95
|
-
|
|
96
|
-
licenses {
|
|
97
|
-
license {
|
|
98
|
-
name packageJson.license
|
|
99
|
-
url "https://github.com/veriff/react-native-sdk" + '/blob/master/' + packageJson.licenseFilename
|
|
100
|
-
distribution 'repo'
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
developers {
|
|
105
|
-
developer {
|
|
106
|
-
id packageJson.author.username
|
|
107
|
-
name packageJson.author.name
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
afterEvaluate { project ->
|
|
114
|
-
// some Gradle build hooks ref:
|
|
115
|
-
// https://www.oreilly.com/library/view/gradle-beyond-the/9781449373801/ch03.html
|
|
116
|
-
task androidJavadoc(type: Javadoc) {
|
|
117
|
-
source = android.sourceSets.main.java.srcDirs
|
|
118
|
-
classpath += files(android.bootClasspath)
|
|
119
|
-
classpath += files(project.getConfigurations().getByName('compile').asList())
|
|
120
|
-
include '**/*.java'
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
task androidJavadocJar(type: Jar, dependsOn: androidJavadoc) {
|
|
124
|
-
classifier = 'javadoc'
|
|
125
|
-
from androidJavadoc.destinationDir
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
task androidSourcesJar(type: Jar) {
|
|
129
|
-
classifier = 'sources'
|
|
130
|
-
from android.sourceSets.main.java.srcDirs
|
|
131
|
-
include '**/*.java'
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
android.libraryVariants.all { variant ->
|
|
135
|
-
def name = variant.name.capitalize()
|
|
136
|
-
def javaCompileTask = variant.javaCompileProvider.get()
|
|
137
|
-
|
|
138
|
-
task "jar${name}"(type: Jar, dependsOn: javaCompileTask) {
|
|
139
|
-
from javaCompileTask.destinationDir
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
artifacts {
|
|
144
|
-
archives androidSourcesJar
|
|
145
|
-
archives androidJavadocJar
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
task installArchives(type: Upload) {
|
|
149
|
-
configuration = configurations.archives
|
|
150
|
-
repositories.mavenDeployer {
|
|
151
|
-
// Deploy to react-native-event-bridge/maven, ready to publish to npm
|
|
152
|
-
repository url: "file://${projectDir}/../android/maven"
|
|
153
|
-
configureReactNativePom pom
|
|
154
|
-
}
|
|
155
|
-
}
|
|
45
|
+
implementation 'com.veriff:veriff-library:4.7.0'
|
|
156
46
|
}
|
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
|
|