Skip to content

Commit c0e5154

Browse files
authored
Merge pull request #45 from getyoti/release/DEP-589-5.0.0
[Task] DEP-589: RN 5.0.0
2 parents 5e44b0e + 1c590b5 commit c0e5154

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+1823
-338
lines changed

README.md

Lines changed: 43 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ A react native wrapper of Yoti IDV for [Android](https://github.com/getyoti/yoti
1010
To integrate with Yoti IDV, a working infrastructure is needed (see [developers.yoti.com](https://developers.yoti.com/identity-verification/overview) for more details or get in touch with us [here](https://developers.yoti.com/support)).
1111

1212
## Requirements
13-
- [Android SDK 3+](https://github.com/getyoti/yoti-doc-scan-android/releases)
14-
- [iOS SDK 6+](https://github.com/getyoti/yoti-doc-scan-ios/releases)
13+
- [Android SDK 4+](https://github.com/getyoti/yoti-doc-scan-android/releases)
14+
- [iOS SDK 7+](https://github.com/getyoti/yoti-doc-scan-ios/releases)
1515

1616
## Integration
1717
Start your integration by adding the following dependency to your `package.json` file:
1818
```json
1919
"dependencies": {
20-
"@getyoti/yoti-doc-scan-react-native": "^4.0.0"
20+
"@getyoti/yoti-doc-scan-react-native": "^5.0.0"
2121
}
2222
```
2323

@@ -26,13 +26,13 @@ Continuing with your integration for Android, add the following property and rep
2626
```groovy
2727
buildscript {
2828
ext {
29-
yotiSdkVersion = "3.5.0"
29+
yotiSdkVersion = "4.0.0"
3030
}
3131
}
3232
allprojects {
3333
repositories {
3434
maven {
35-
url 'https://maven.microblink.com'
35+
url 'https://maven.regulaforensics.com/RegulaDocumentReader'
3636
}
3737
}
3838
}
@@ -54,12 +54,14 @@ dependencies {
5454
```
5555
If you're using Proguard or another obfuscation tool, you should also add the following configuration rules to your `proguard-rules.pro` file:
5656
```groovy
57+
-keepclassmembers class kotlinx.** {
58+
volatile <fields>;
59+
}
5760
-keep class com.yoti.** { *; }
58-
-keep class com.microblink.** { *; }
59-
-keep class com.microblink.**$* { *; }
60-
-dontwarn com.microblink.**
61-
-keep class com.facetec.zoom.** { *; }
61+
-dontwarn com.facetec.sdk.**
62+
-keep class com.facetec.sdk.** { *; }
6263
-dontwarn javax.annotation.Nullable
64+
-keepclassmembers class io.ktor.** { volatile <fields>; }
6365
```
6466

6567
### iOS
@@ -68,7 +70,7 @@ To continue your integration with iOS, you should add the following to your [`Po
6870
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
6971
require_relative '../node_modules/react-native/scripts/react_native_pods'
7072

71-
platform :ios, '11.0'
73+
platform :ios, '13.0'
7274

7375
target 'TargetName' do
7476
config = use_native_modules!
@@ -83,45 +85,50 @@ target 'TargetName' do
8385
pod 'YotiSDKFaceCapture' // Optional
8486
end
8587
```
86-
In addition, you should add [`NSCameraUsageDescription`](https://developer.apple.com/documentation/bundleresources/information_property_list/nscamerausagedescription) to your `Info.plist`.
87-
88-
And if you have included `YotiNFC` in your target, make sure to also:
89-
- Add [`NFCReaderUsageDescription`](https://developer.apple.com/documentation/bundleresources/information_property_list/nfcreaderusagedescription) to your `Info.plist`
90-
- Add [`com.apple.developer.nfc.readersession.iso7816.select-identifiers`](https://developer.apple.com/documentation/bundleresources/information_property_list/select-identifiers) to your `Info.plist` and include [`A0000002471001`](https://www.icao.int/publications/Documents/9303_p10_cons_en.pdf) as an application identifier for your app to support
91-
- Turn on [`Near Field Communication Tag Reading`](https://developer.apple.com/documentation/corenfc/building_an_nfc_tag-reader_app) under the Signing & Capabilities tab for your project’s target
88+
In addition, you should [modify the properties and capabilities of your project's target](https://github.com/getyoti/yoti-doc-scan-ios?tab=readme-ov-file#5-modify-the-properties-and-capabilities-of-your-projects-target).
9289
9390
## Usage
9491
### 1. Import module
9592
```javascript
9693
import RNYotiDocScan from '@getyoti/yoti-doc-scan-react-native';
9794
```
98-
### 2. Launch a session
99-
Launch a session with its required parameters using the `startSession` function.
95+
### 2. Optional configuration and customization
96+
For customization on Android, you can refer to the documentation outlined [here](https://github.com/getyoti/yoti-doc-scan-android?tab=readme-ov-file#customisation). In addition, you can choose to also set a request code:
10097
```javascript
101-
const successCallback = (code, description) => {
102-
...
103-
}
104-
const errorCallback = (code, description) => {
105-
...
106-
}
107-
RNYotiDocScan.startSession(id, token, successCallback, errorCallback);
98+
RNYotiDocScan.setRequestCode(0); // default: 9001
10899
```
109100
110-
### 3. Customizations
111-
On iOS, you can set the primary colors using the following API:
101+
On iOS, the SDK expects launched sessions to contain multiple flows by default. To enable single-flow sessions, configure and include [yoti-doc-scan-react-native-configuration-ios.json](templates/yoti-doc-scan-react-native-configuration-ios.json) in your project’s target and then set the configuration as follows:
112102
```javascript
113-
RNYotiDocScan.setLightPrimaryColorRGB(0, 0, 0); // default: (40, 117, 188)
114-
RNYotiDocScan.setDarkPrimaryColorRGB(0, 0, 0); // default: (145, 190, 255)
103+
RNYotiDocScan.setConfiguration({
104+
bundle_identifier: "", // Optional: defaults to the main bundle identifier if not specified.
105+
filename: "yoti-doc-scan-react-native-configuration-ios.json"
106+
});
115107
```
116-
To customize the colors on Android, please refer to its separate [documentation](https://github.com/getyoti/yoti-doc-scan-android#colours).
108+
Ensure that only one module type property is set to `true` when `single_flow` is enabled.
117109
118-
In addition, you can choose to also specify a request code on Android:
110+
To customize the appearance on iOS, you can configure the SDK using [yoti-doc-scan-react-native-configuration-with-theme-ios.json](templates/yoti-doc-scan-react-native-configuration-with-theme-ios.json) instead, which supports the following options for theming:
111+
112+
- Light and dark mode color themes. We also support specifying only a primary color for each mode
113+
- Typography theme (system and custom fonts, font weight, size, line height multiple and kern)
114+
- Spacing mode (compact, regular and relaxed)
115+
- Shape theme (corner radius and border width)
116+
- Icon theme (custom vectors, system and custom SF Symbols, incl. localized ones)
117+
- Illustration theme (custom vectors)
118+
119+
All customisation types are optional, and can be set independently from each other.
120+
121+
### 3. Launch a session
122+
Launch a session with its required parameters using the `start` function.
119123
```javascript
120-
RNYotiDocScan.setRequestCode(0); // default: 9001
124+
const completion = (code, description) => {
125+
...
126+
}
127+
RNYotiDocScan.start(sessionID, sessionToken, completion);
121128
```
122129
123130
## Supported languages
124-
Yoti IDV supports the 9 languages listed in the table below, but their use is driven by the localization configuration of your target. If your target only supports a subset of our SDK's supported languages, our SDK will fall back to English on the ones your target doesn't support.
131+
Our SDK supports the 9 languages listed in the table below, but their use is driven by the localization configuration of your target. If your target only supports a subset of our SDK's supported languages, our SDK will fall back to English on the ones your target doesn't support.
125132
126133
Language | Code
127134
:-- | :--
@@ -135,10 +142,11 @@ Russian | ru
135142
Spanish | es
136143
Turkish | tr
137144
138-
## Error codes
145+
## Status codes
139146
Code | Description
140147
:-- | :--
141-
1000 | No error occurred. The user cancelled the session
148+
0 | The user completed the session
149+
1000 | The user cancelled the session
142150
2000 | Unauthorised request (wrong or expired session token)
143151
2001 | Session not found
144152
2002 | Session expired

RNYotiDocScan.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
import { NativeModules } from 'react-native'
1+
import {NativeModules} from 'react-native'
22

33
export default NativeModules.RNYotiDocScan;

android/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ android {
1010
defaultConfig {
1111
minSdkVersion safeExtGet('minSdkVersion', 21)
1212
targetSdkVersion safeExtGet('targetSdkVersion', 33)
13-
versionCode 400
14-
versionName "4.0.0"
13+
versionCode 500
14+
versionName "5.0.0"
1515
ndk {
1616
abiFilters "armeabi-v7a", "x86"
1717
}

android/src/main/java/com/yoti/reactnative/docscan/RNYotiDocScanModule.java

Lines changed: 10 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@
77
import com.facebook.react.bridge.Callback;
88
import com.facebook.react.bridge.ReactApplicationContext;
99
import com.facebook.react.bridge.ReactContextBaseJavaModule;
10+
import com.facebook.react.bridge.ReadableMap;
1011
import com.facebook.react.bridge.ReactMethod;
1112
import com.yoti.mobile.android.yotisdkcore.YotiSdk;
1213
import static com.yoti.mobile.android.yotisdkcore.YotiSdkKt.YOTI_SDK_REQUEST_CODE;
1314

1415
public class RNYotiDocScanModule extends ReactContextBaseJavaModule {
1516
private final static int SESSION_SUCCESS_CODE = 0;
1617
private YotiSdk mYotiSdk;
17-
private Callback mErrorCallback;
18-
private Callback mSuccessCallback;
18+
private Callback mCompletion;
1919
private int mRequestCode = YOTI_SDK_REQUEST_CODE;
2020

2121
private final ActivityEventListener mActivityEventListener = new BaseActivityEventListener() {
@@ -27,10 +27,10 @@ public void onActivityResult(Activity activity, int requestCode, int resultCode,
2727
int code = mYotiSdk.getSessionStatusCode();
2828
String description = mYotiSdk.getSessionStatusDescription();
2929
if (resultCode == Activity.RESULT_OK && code == SESSION_SUCCESS_CODE) {
30-
mSuccessCallback.invoke(code, description);
30+
mCompletion.invoke(code, description);
3131
return;
3232
}
33-
mErrorCallback.invoke(code, description);
33+
mCompletion.invoke(code, description);
3434
}
3535
};
3636

@@ -46,17 +46,7 @@ public String getName() {
4646
}
4747

4848
@ReactMethod
49-
public void useCanadaService() {
50-
mYotiSdk.useCanadaService();
51-
}
52-
53-
@ReactMethod
54-
public void setLightPrimaryColorRGB(double red, double green, double blue) {
55-
// Required to maintain cross-platform API compatibility.
56-
}
57-
58-
@ReactMethod
59-
public void setDarkPrimaryColorRGB(double red, double green, double blue) {
49+
public void setConfiguration(ReadableMap configuration) {
6050
// Required to maintain cross-platform API compatibility.
6151
}
6252

@@ -66,19 +56,18 @@ public void setRequestCode(int requestCode) {
6656
}
6757

6858
@ReactMethod
69-
public void startSession(String sessionId, String clientSessionToken, Callback successCallback, Callback errorCallback) {
70-
mErrorCallback = errorCallback;
71-
mSuccessCallback = successCallback;
59+
public void start(String sessionID, String sessionToken, Callback completion) {
60+
mCompletion = completion;
7261
Activity currentActivity = getCurrentActivity();
7362
if (currentActivity == null) {
74-
mErrorCallback.invoke("E_ACTIVITY_DOES_NOT_EXIST");
63+
mCompletion.invoke("E_ACTIVITY_DOES_NOT_EXIST");
7564
return;
7665
}
77-
boolean success = mYotiSdk.setSessionId(sessionId).setClientSessionToken(clientSessionToken).start(currentActivity, mRequestCode);
66+
boolean success = mYotiSdk.setSessionId(sessionID).setClientSessionToken(sessionToken).start(currentActivity, mRequestCode);
7867
if (!success) {
7968
int code = mYotiSdk.getSessionStatusCode();
8069
String description = mYotiSdk.getSessionStatusDescription();
81-
mErrorCallback.invoke(code, description);
70+
mCompletion.invoke(code, description);
8271
}
8372
}
8473
}

example/android/app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ android {
7676

7777
dependencies {
7878
implementation fileTree(dir: "libs", include: ["*.jar"])
79-
implementation "com.facebook.react:react-native:0.68.5"
79+
implementation "com.facebook.react:react-native:0.70.0"
8080
implementation "com.yoti.mobile.android.sdk:yoti-sdk-doc-scan:${rootProject.ext.yotiSdkVersion}"
8181
// implementation "com.yoti.mobile.android.sdk:yoti-sdk-doc-scan-slim:${rootProject.ext.yotiSdkVersion}"
8282
//implementation "com.yoti.mobile.android.sdk:yoti-sdk-doc-scan-sup:${rootProject.ext.yotiSdkVersion}"
Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,8 @@
1-
# Add project specific ProGuard rules here.
2-
# By default, the flags in this file are appended to flags specified
3-
# in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt
4-
# You can edit the include path and order by changing the proguardFiles
5-
# directive in build.gradle.
6-
#
7-
# For more details, see
8-
# http://developer.android.com/guide/developing/tools/proguard.html
9-
10-
# Add any project specific keep options here:
1+
-keepclassmembers class kotlinx.** {
2+
volatile <fields>;
3+
}
114
-keep class com.yoti.** { *; }
12-
-keep class com.microblink.** { *; }
13-
-keep class com.microblink.**$* { *; }
14-
-dontwarn com.microblink.**
15-
-keep class com.facetec.zoom.** { *; }
16-
-dontwarn javax.annotation.Nullable
5+
-dontwarn com.facetec.sdk.**
6+
-keep class com.facetec.sdk.** { *; }
7+
-dontwarn javax.annotation.Nullable
8+
-keepclassmembers class io.ktor.** { volatile <fields>; }

example/android/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ buildscript {
33
minSdkVersion = 21
44
compileSdkVersion = 33
55
targetSdkVersion = 33
6-
yotiSdkVersion = "3.5.0"
6+
yotiSdkVersion = "4.0.0"
77
}
88
repositories {
99
google()
@@ -30,7 +30,7 @@ allprojects {
3030
}
3131
mavenCentral()
3232
maven {
33-
url 'https://maven.microblink.com'
33+
url 'https://maven.regulaforensics.com/RegulaDocumentReader'
3434
}
3535
}
3636
}

example/android/gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
# Specifies the JVM arguments used for the daemon process.
1111
# The setting is particularly useful for tweaking memory settings.
1212
# Default value: -Xmx10248m -XX:MaxPermSize=256m
13-
org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
13+
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
1414

1515
# When configured, Gradle will run in incubating parallel mode.
1616
# This option should only be used with decoupled projects. More details, visit

example/app.json

Lines changed: 0 additions & 4 deletions
This file was deleted.

example/index.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import { AppRegistry } from 'react-native';
1+
import {AppRegistry} from 'react-native';
22
import App from './src/App';
3-
import { name as appName } from './app.json';
43

5-
AppRegistry.registerComponent(appName, () => App);
4+
AppRegistry.registerComponent('example', () => App);

0 commit comments

Comments
 (0)