@veriff/react-native-sdk 2.8.0 → 2.11.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/.prettierrc.js +0 -1
- package/android/build.gradle +22 -132
- package/android/src/main/java/com/veriff/sdk/reactnative/ImageLoader.java +21 -2
- package/android/src/main/java/com/veriff/sdk/reactnative/ReactNativeImageProvider.java +3 -3
- package/android/src/main/java/com/veriff/sdk/reactnative/VeriffSdkModule.java +3 -0
- package/ios/Podfile +8 -31
- package/package.json +5 -5
package/.prettierrc.js
CHANGED
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
|
}
|
|
@@ -25,6 +25,17 @@ public class ImageLoader {
|
|
|
25
25
|
private final Handler main = new Handler(Looper.getMainLooper());
|
|
26
26
|
|
|
27
27
|
public Drawable load(Context context, String url) throws IOException {
|
|
28
|
+
if (isAsyncLogoUrl(url)) {
|
|
29
|
+
Log.d(TAG, "Async image" + url);
|
|
30
|
+
return loadAsyncImage(context, url);
|
|
31
|
+
} else {
|
|
32
|
+
Log.d(TAG, "Image from resource" + url);
|
|
33
|
+
int drawableId = getDrawableId(context, url);
|
|
34
|
+
return context.getDrawable(drawableId);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
private Drawable loadAsyncImage(Context context, String url) throws IOException {
|
|
28
39
|
ImageRequest request = ImageRequestBuilder.fromRequest(ImageRequest.fromUri(url)).build();
|
|
29
40
|
|
|
30
41
|
if (!Fresco.hasBeenInitialized()) {
|
|
@@ -69,10 +80,10 @@ public class ImageLoader {
|
|
|
69
80
|
Result result = atomicResult.get();
|
|
70
81
|
|
|
71
82
|
if (result.error != null) {
|
|
72
|
-
Log.w(TAG, "Loading image from " + url + " failed", result.error);
|
|
83
|
+
Log.w(TAG, "[ImageLoader] Loading image from [" + url + "] failed", result.error);
|
|
73
84
|
throw result.error;
|
|
74
85
|
} else {
|
|
75
|
-
Log.w(TAG, "Loading image got a bitmap with size w=" + result.bitmap.getWidth() + " h=" + result.bitmap.getHeight());
|
|
86
|
+
Log.w(TAG, "[ImageLoader] Loading image [" + url + "] got a bitmap with size w=" + result.bitmap.getWidth() + " h=" + result.bitmap.getHeight());
|
|
76
87
|
return new BitmapDrawable(context.getResources(), result.bitmap);
|
|
77
88
|
}
|
|
78
89
|
} catch (InterruptedException e) {
|
|
@@ -81,6 +92,14 @@ public class ImageLoader {
|
|
|
81
92
|
}
|
|
82
93
|
}
|
|
83
94
|
|
|
95
|
+
private static int getDrawableId(Context context, String name) {
|
|
96
|
+
return context.getResources().getIdentifier(name, "drawable", context.getPackageName());
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
private boolean isAsyncLogoUrl(String url) {
|
|
100
|
+
return url.startsWith("https://") || url.startsWith("http://") || url.startsWith("file://");
|
|
101
|
+
}
|
|
102
|
+
|
|
84
103
|
private static class Result {
|
|
85
104
|
private final IOException error;
|
|
86
105
|
|
|
@@ -24,7 +24,7 @@ import java.util.concurrent.CountDownLatch;
|
|
|
24
24
|
import java.util.concurrent.atomic.AtomicReference;
|
|
25
25
|
|
|
26
26
|
public class ReactNativeImageProvider implements Branding.DrawableProvider, Parcelable {
|
|
27
|
-
private static final String TAG = "
|
|
27
|
+
private static final String TAG = "ReactNativeImageProvider";
|
|
28
28
|
|
|
29
29
|
private final String url;
|
|
30
30
|
|
|
@@ -78,10 +78,10 @@ public class ReactNativeImageProvider implements Branding.DrawableProvider, Parc
|
|
|
78
78
|
Result result = atomicResult.get();
|
|
79
79
|
|
|
80
80
|
if (result.error != null) {
|
|
81
|
-
Log.w(TAG, "Loading image from " + this.url + " failed", result.error);
|
|
81
|
+
Log.w(TAG, "[ReactNativeImageProvider] Loading image from [" + this.url + "] failed", result.error);
|
|
82
82
|
throw result.error;
|
|
83
83
|
} else {
|
|
84
|
-
Log.w(TAG, "Loading image got a bitmap with size w=" + result.bitmap.getWidth() + " h=" + result.bitmap.getHeight());
|
|
84
|
+
Log.w(TAG, "[ReactNativeImageProvider] Loading image [" + this.url + "] got a bitmap with size w=" + result.bitmap.getWidth() + " h=" + result.bitmap.getHeight());
|
|
85
85
|
return new BitmapDrawable(context.getResources(), result.bitmap);
|
|
86
86
|
}
|
|
87
87
|
} catch (InterruptedException e) {
|
|
@@ -323,6 +323,7 @@ public class VeriffSdkModule extends ReactContextBaseJavaModule {
|
|
|
323
323
|
|
|
324
324
|
private void handleLogo(Context context, String key, Branding.Builder branding, ReadableMap brandConfig) {
|
|
325
325
|
ReadableType type = brandConfig.getType(key);
|
|
326
|
+
Log.d(TAG, "Logo type" + type);
|
|
326
327
|
if (ReadableType.String.equals(type)) {
|
|
327
328
|
branding.toolbarIcon(getDrawableId(context, brandConfig.getString(key)));
|
|
328
329
|
} else if (ReadableType.Map.equals(type)) {
|
|
@@ -334,8 +335,10 @@ public class VeriffSdkModule extends ReactContextBaseJavaModule {
|
|
|
334
335
|
if (!TextUtils.isEmpty(url)) {
|
|
335
336
|
// check if url has an async scheme
|
|
336
337
|
if (isAsyncLogoUrl(url)) {
|
|
338
|
+
Log.d(TAG, "Async logo" + url);
|
|
337
339
|
branding.toolbarIconProvider(new ReactNativeImageProvider(url));
|
|
338
340
|
} else {
|
|
341
|
+
Log.d(TAG, "Logo from resource" + url);
|
|
339
342
|
branding.toolbarIcon(getDrawableId(context, url));
|
|
340
343
|
}
|
|
341
344
|
} else {
|
package/ios/Podfile
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
platform :ios, '11.0'
|
|
2
|
+
install! 'cocoapods', :deterministic_uuids => false
|
|
3
|
+
require_relative '../node_modules/react-native/scripts/react_native_pods'
|
|
2
4
|
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
|
|
3
5
|
|
|
4
6
|
target 'VeriffSdk' do
|
|
@@ -6,36 +8,11 @@ target 'VeriffSdk' do
|
|
|
6
8
|
pod 'VeriffSDK'
|
|
7
9
|
pod 'lottie-ios'
|
|
8
10
|
|
|
9
|
-
|
|
10
|
-
pod 'FBReactNativeSpec', :path => "../node_modules/react-native/Libraries/FBReactNativeSpec"
|
|
11
|
-
pod 'RCTRequired', :path => "../node_modules/react-native/Libraries/RCTRequired"
|
|
12
|
-
pod 'RCTTypeSafety', :path => "../node_modules/react-native/Libraries/TypeSafety"
|
|
13
|
-
pod 'React', :path => '../node_modules/react-native/'
|
|
14
|
-
pod 'React-Core', :path => '../node_modules/react-native/'
|
|
15
|
-
pod 'React-CoreModules', :path => '../node_modules/react-native/React/CoreModules'
|
|
16
|
-
pod 'React-Core/DevSupport', :path => '../node_modules/react-native/'
|
|
17
|
-
pod 'React-RCTActionSheet', :path => '../node_modules/react-native/Libraries/ActionSheetIOS'
|
|
18
|
-
pod 'React-RCTAnimation', :path => '../node_modules/react-native/Libraries/NativeAnimation'
|
|
19
|
-
pod 'React-RCTBlob', :path => '../node_modules/react-native/Libraries/Blob'
|
|
20
|
-
pod 'React-RCTImage', :path => '../node_modules/react-native/Libraries/Image'
|
|
21
|
-
pod 'React-RCTLinking', :path => '../node_modules/react-native/Libraries/LinkingIOS'
|
|
22
|
-
pod 'React-RCTNetwork', :path => '../node_modules/react-native/Libraries/Network'
|
|
23
|
-
pod 'React-RCTSettings', :path => '../node_modules/react-native/Libraries/Settings'
|
|
24
|
-
pod 'React-RCTText', :path => '../node_modules/react-native/Libraries/Text'
|
|
25
|
-
pod 'React-RCTVibration', :path => '../node_modules/react-native/Libraries/Vibration'
|
|
26
|
-
pod 'React-Core/RCTWebSocket', :path => '../node_modules/react-native/'
|
|
11
|
+
config = use_native_modules!
|
|
27
12
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
pod 'ReactCommon/turbomodule/core', :path => "../node_modules/react-native/ReactCommon"
|
|
34
|
-
pod 'Yoga', :path => '../node_modules/react-native/ReactCommon/yoga'
|
|
35
|
-
|
|
36
|
-
pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
|
|
37
|
-
pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec'
|
|
38
|
-
pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'
|
|
39
|
-
|
|
40
|
-
use_native_modules!
|
|
13
|
+
# Flags change depending on the env values.
|
|
14
|
+
flags = get_default_flags()
|
|
15
|
+
use_react_native!(
|
|
16
|
+
:path => config[:reactNativePath]
|
|
17
|
+
)
|
|
41
18
|
end
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@veriff/react-native-sdk",
|
|
3
3
|
"title": "React Native Veriff SDK",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.11.0",
|
|
5
5
|
"description": "React Native SDK for Veriff identity verification",
|
|
6
6
|
"main": "index.js",
|
|
7
7
|
"scripts": {
|
|
@@ -29,10 +29,10 @@
|
|
|
29
29
|
"react-native": "*"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"react": "
|
|
33
|
-
"react-native": "0.
|
|
34
|
-
"@react-native-community/eslint-config": "^
|
|
35
|
-
"eslint": "^7.
|
|
32
|
+
"react": "18.1.0",
|
|
33
|
+
"react-native": "0.68.1",
|
|
34
|
+
"@react-native-community/eslint-config": "^3.0.1",
|
|
35
|
+
"eslint": "^7.0.0"
|
|
36
36
|
},
|
|
37
37
|
"resolutions": {
|
|
38
38
|
"ansi-regex": "^5.0.1",
|