@veriff/react-native-sdk 2.4.0 → 2.6.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 +3 -3
- package/android/src/main/java/com/veriff/sdk/reactnative/ReactNativeImageProvider.java +2 -2
- package/android/src/main/java/com/veriff/sdk/reactnative/VeriffSdkModule.java +19 -15
- package/ios/VeriffSdk.swift +2 -0
- package/package.json +3 -7
- package/react-native-sdk.podspec +1 -1
package/android/build.gradle
CHANGED
|
@@ -78,7 +78,7 @@ repositories {
|
|
|
78
78
|
dependencies {
|
|
79
79
|
//noinspection GradleDynamicVersion
|
|
80
80
|
implementation 'com.facebook.react:react-native:+' // From node_modules
|
|
81
|
-
implementation 'com.veriff:veriff-library:
|
|
81
|
+
implementation 'com.veriff:veriff-library:4.+'
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
def configureReactNativePom(def pom) {
|
|
@@ -90,12 +90,12 @@ def configureReactNativePom(def pom) {
|
|
|
90
90
|
version = packageJson.version
|
|
91
91
|
group = "com.reactlibrary"
|
|
92
92
|
description packageJson.description
|
|
93
|
-
url
|
|
93
|
+
url = "https://github.com/veriff/react-native-sdk"
|
|
94
94
|
|
|
95
95
|
licenses {
|
|
96
96
|
license {
|
|
97
97
|
name packageJson.license
|
|
98
|
-
url
|
|
98
|
+
url "https://github.com/veriff/react-native-sdk" + '/blob/master/' + packageJson.licenseFilename
|
|
99
99
|
distribution 'repo'
|
|
100
100
|
}
|
|
101
101
|
}
|
|
@@ -20,7 +20,7 @@ import com.facebook.imagepipeline.datasource.BaseBitmapDataSubscriber;
|
|
|
20
20
|
import com.facebook.imagepipeline.image.CloseableImage;
|
|
21
21
|
import com.facebook.imagepipeline.request.ImageRequest;
|
|
22
22
|
import com.facebook.imagepipeline.request.ImageRequestBuilder;
|
|
23
|
-
import com.veriff.
|
|
23
|
+
import com.veriff.Branding;
|
|
24
24
|
|
|
25
25
|
import org.jetbrains.annotations.NotNull;
|
|
26
26
|
import org.jetbrains.annotations.Nullable;
|
|
@@ -29,7 +29,7 @@ import java.io.IOException;
|
|
|
29
29
|
import java.util.concurrent.CountDownLatch;
|
|
30
30
|
import java.util.concurrent.atomic.AtomicReference;
|
|
31
31
|
|
|
32
|
-
public class ReactNativeImageProvider implements
|
|
32
|
+
public class ReactNativeImageProvider implements Branding.DrawableProvider, Parcelable {
|
|
33
33
|
private static final String TAG = "ReactNativeImage";
|
|
34
34
|
|
|
35
35
|
private final String url;
|
|
@@ -17,22 +17,22 @@ import com.facebook.react.bridge.ReactMethod;
|
|
|
17
17
|
import com.facebook.react.bridge.ReadableMap;
|
|
18
18
|
import com.facebook.react.bridge.ReadableType;
|
|
19
19
|
import com.facebook.react.bridge.WritableMap;
|
|
20
|
-
import com.veriff.
|
|
21
|
-
import com.veriff.
|
|
22
|
-
import com.veriff.
|
|
23
|
-
import com.veriff.
|
|
24
|
-
import com.veriff.
|
|
20
|
+
import com.veriff.Branding;
|
|
21
|
+
import com.veriff.Configuration;
|
|
22
|
+
import com.veriff.Result;
|
|
23
|
+
import com.veriff.Result.Status;
|
|
24
|
+
import com.veriff.Sdk;
|
|
25
25
|
|
|
26
26
|
import java.util.HashMap;
|
|
27
27
|
import java.util.Locale;
|
|
28
28
|
import java.util.Map;
|
|
29
29
|
|
|
30
|
-
import
|
|
30
|
+
import com.veriff.GeneralConfig;
|
|
31
31
|
import okhttp3.HttpUrl;
|
|
32
32
|
|
|
33
33
|
import static android.app.Activity.RESULT_CANCELED;
|
|
34
|
-
import static com.veriff.
|
|
35
|
-
import static com.veriff.
|
|
34
|
+
import static com.veriff.Result.Status.CANCELED;
|
|
35
|
+
import static com.veriff.Result.Status.ERROR;
|
|
36
36
|
|
|
37
37
|
public class VeriffSdkModule extends ReactContextBaseJavaModule {
|
|
38
38
|
/**
|
|
@@ -83,6 +83,7 @@ public class VeriffSdkModule extends ReactContextBaseJavaModule {
|
|
|
83
83
|
public static final String KEY_STATUS_BAR_COLOR = "statusBarColor";
|
|
84
84
|
public static final String KEY_PRIMARY_TEXT_COLOR = "primaryTextColor";
|
|
85
85
|
public static final String KEY_SECONDARY_TEXT_COLOR = "secondaryTextColor";
|
|
86
|
+
public static final String KEY_PRIMARY_BUTTON_BACKGROUND_COLOR = "primaryButtonBackgroundColor";
|
|
86
87
|
public static final String KEY_BUTTON_CORNER_RADIUS = "buttonCornerRadius";
|
|
87
88
|
private static final String KEY_CUSTOM_INTRO_SCREEN = "customIntroScreen";
|
|
88
89
|
private static final String KEY_RN_IMAGE_URI = "uri";
|
|
@@ -189,14 +190,14 @@ public class VeriffSdkModule extends ReactContextBaseJavaModule {
|
|
|
189
190
|
if (data == null) {
|
|
190
191
|
return;
|
|
191
192
|
}
|
|
192
|
-
String token = data.getStringExtra(
|
|
193
|
+
String token = data.getStringExtra(GeneralConfig.INSTANCE.getINTENT_EXTRA_SESSION_URL());
|
|
193
194
|
if (!sessionToken.equals(token) && !startUrl.equals(token)) {
|
|
194
195
|
return;
|
|
195
196
|
}
|
|
196
197
|
|
|
197
198
|
reactContext.removeActivityEventListener(this);
|
|
198
199
|
|
|
199
|
-
|
|
200
|
+
Result veriffResult = Result.fromResultIntent(data);
|
|
200
201
|
WritableMap result = Arguments.createMap();
|
|
201
202
|
result.putString(KEY_TOKEN, sessionToken);
|
|
202
203
|
|
|
@@ -216,7 +217,7 @@ public class VeriffSdkModule extends ReactContextBaseJavaModule {
|
|
|
216
217
|
|
|
217
218
|
reactContext.addActivityEventListener(listener);
|
|
218
219
|
|
|
219
|
-
|
|
220
|
+
Configuration.Builder configBuilder = new Configuration.Builder();
|
|
220
221
|
|
|
221
222
|
if (configuration.hasKey(KEY_CUSTOM_INTRO_SCREEN)) {
|
|
222
223
|
configBuilder.customIntroScreen(configuration.getBoolean(KEY_CUSTOM_INTRO_SCREEN));
|
|
@@ -225,7 +226,7 @@ public class VeriffSdkModule extends ReactContextBaseJavaModule {
|
|
|
225
226
|
if (configuration.hasKey(KEY_BRANDING)) {
|
|
226
227
|
ReadableMap brandConfig = configuration.getMap(KEY_BRANDING);
|
|
227
228
|
if (brandConfig != null) {
|
|
228
|
-
|
|
229
|
+
Branding.Builder branding = new Branding.Builder();
|
|
229
230
|
if (brandConfig.hasKey(KEY_THEME_COLOR)) {
|
|
230
231
|
branding.themeColor(parseColor(brandConfig.getString(KEY_THEME_COLOR)));
|
|
231
232
|
}
|
|
@@ -250,6 +251,9 @@ public class VeriffSdkModule extends ReactContextBaseJavaModule {
|
|
|
250
251
|
if (brandConfig.hasKey(KEY_SECONDARY_TEXT_COLOR)) {
|
|
251
252
|
branding.secondaryTextColor(parseColor(brandConfig.getString(KEY_SECONDARY_TEXT_COLOR)));
|
|
252
253
|
}
|
|
254
|
+
if (brandConfig.hasKey(KEY_PRIMARY_BUTTON_BACKGROUND_COLOR)) {
|
|
255
|
+
branding.primaryButtonBackgroundColor(parseColor(brandConfig.getString(KEY_PRIMARY_BUTTON_BACKGROUND_COLOR)));
|
|
256
|
+
}
|
|
253
257
|
if (brandConfig.hasKey(KEY_BUTTON_CORNER_RADIUS)) {
|
|
254
258
|
branding.buttonCornerRadius((float)brandConfig.getDouble(KEY_BUTTON_CORNER_RADIUS));
|
|
255
259
|
}
|
|
@@ -261,7 +265,7 @@ public class VeriffSdkModule extends ReactContextBaseJavaModule {
|
|
|
261
265
|
configBuilder.locale(Locale.forLanguageTag(configuration.getString(KEY_LOCALE)));
|
|
262
266
|
}
|
|
263
267
|
|
|
264
|
-
Intent intent =
|
|
268
|
+
Intent intent = Sdk.createLaunchIntent(activity, startUrl, configBuilder.build());
|
|
265
269
|
activity.startActivityForResult(intent, VERIFF_REQUEST_CODE);
|
|
266
270
|
|
|
267
271
|
} catch (Throwable t) {
|
|
@@ -270,7 +274,7 @@ public class VeriffSdkModule extends ReactContextBaseJavaModule {
|
|
|
270
274
|
}
|
|
271
275
|
}
|
|
272
276
|
|
|
273
|
-
private void handleLogo(Context context, String key,
|
|
277
|
+
private void handleLogo(Context context, String key, Branding.Builder branding, ReadableMap brandConfig) {
|
|
274
278
|
ReadableType type = brandConfig.getType(key);
|
|
275
279
|
if (ReadableType.String.equals(type)) {
|
|
276
280
|
branding.toolbarIcon(getDrawableId(context, brandConfig.getString(key)));
|
|
@@ -331,7 +335,7 @@ public class VeriffSdkModule extends ReactContextBaseJavaModule {
|
|
|
331
335
|
return context.getResources().getIdentifier(name, "drawable", context.getPackageName());
|
|
332
336
|
}
|
|
333
337
|
|
|
334
|
-
private static String codeToError(
|
|
338
|
+
private static String codeToError(Result.Error error) {
|
|
335
339
|
switch (error) {
|
|
336
340
|
case UNABLE_TO_ACCESS_CAMERA:
|
|
337
341
|
return ERROR_UNABLE_TO_ACCESS_CAMERA;
|
package/ios/VeriffSdk.swift
CHANGED
|
@@ -34,6 +34,7 @@ class VeriffSdk: NSObject {
|
|
|
34
34
|
private static let STATUS_BAR_COLOR = "statusBarColor"
|
|
35
35
|
private static let PRIMARY_TEXT_COLOR = "primaryTextColor"
|
|
36
36
|
private static let SECONDARY_TEXT_COLOR = "secondaryTextColor"
|
|
37
|
+
private static let PRIMARY_BUTTON_BACKGROUND_COLOR = "primaryButtonBackgroundColor"
|
|
37
38
|
private static let BUTTON_CORNER_RADIUS = "buttonCornerRadius"
|
|
38
39
|
private static let USE_CUSTOM_INTRO_SCREEN = "customIntroScreen"
|
|
39
40
|
|
|
@@ -94,6 +95,7 @@ class VeriffSdk: NSObject {
|
|
|
94
95
|
branding?.statusBarColor = (brandingConfig[VeriffSdk.STATUS_BAR_COLOR] as? String).map { VeriffSdk.parseColor(hexcolor: $0) }
|
|
95
96
|
branding?.primaryTextColor = (brandingConfig[VeriffSdk.PRIMARY_TEXT_COLOR] as? String).map { VeriffSdk.parseColor(hexcolor: $0) }
|
|
96
97
|
branding?.secondaryTextColor = (brandingConfig[VeriffSdk.SECONDARY_TEXT_COLOR] as? String).map { VeriffSdk.parseColor(hexcolor: $0) }
|
|
98
|
+
branding?.primaryButtonBackgroundColor = (brandingConfig[VeriffSdk.PRIMARY_BUTTON_BACKGROUND_COLOR] as? String).map { VeriffSdk.parseColor(hexcolor: $0) }
|
|
97
99
|
branding?.buttonCornerRadius = (brandingConfig[VeriffSdk.BUTTON_CORNER_RADIUS] as? Double).map { CGFloat($0) }
|
|
98
100
|
}
|
|
99
101
|
|
package/package.json
CHANGED
|
@@ -1,17 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@veriff/react-native-sdk",
|
|
3
|
-
"title": "React Native Veriff
|
|
4
|
-
"version": "2.
|
|
3
|
+
"title": "React Native Veriff SDK",
|
|
4
|
+
"version": "2.6.0",
|
|
5
5
|
"description": "React Native SDK for Veriff identity verification",
|
|
6
6
|
"main": "index.js",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"lint": "eslint ."
|
|
9
9
|
},
|
|
10
|
-
"
|
|
11
|
-
"type": "git",
|
|
12
|
-
"url": "git+https://github.com/veriff/react-native-sdk.git",
|
|
13
|
-
"baseUrl": "https://github.com/veriff/react-native-sdk"
|
|
14
|
-
},
|
|
10
|
+
"homepage": "https://developers.veriff.com/#react-native-sdk-integration",
|
|
15
11
|
"keywords": [
|
|
16
12
|
"react-native",
|
|
17
13
|
"veriff",
|
package/react-native-sdk.podspec
CHANGED