@veriff/react-native-sdk 2.8.0 → 2.9.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/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
|
@@ -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.9.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",
|