@getyoti/yoti-doc-scan-react-native 5.0.0 → 5.0.2

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/README.md CHANGED
@@ -17,7 +17,7 @@ To integrate with Yoti IDV, a working infrastructure is needed (see [developers.
17
17
  Start your integration by adding the following dependency to your `package.json` file:
18
18
  ```json
19
19
  "dependencies": {
20
- "@getyoti/yoti-doc-scan-react-native": "^5.0.0"
20
+ "@getyoti/yoti-doc-scan-react-native": "^5.0.2"
21
21
  }
22
22
  ```
23
23
 
@@ -26,7 +26,7 @@ Continuing with your integration for Android, add the following property and rep
26
26
  ```groovy
27
27
  buildscript {
28
28
  ext {
29
- yotiSdkVersion = "4.0.0"
29
+ yotiSdkVersion = "4.1.0"
30
30
  }
31
31
  }
32
32
  allprojects {
@@ -5,13 +5,15 @@ def safeExtGet(prop, fallback) {
5
5
  }
6
6
 
7
7
  android {
8
- compileSdk safeExtGet('compileSdkVersion', 33)
8
+ namespace "com.yoti.reactnative.docscan"
9
+
10
+ compileSdk safeExtGet('compileSdkVersion', 34)
9
11
 
10
12
  defaultConfig {
11
13
  minSdkVersion safeExtGet('minSdkVersion', 21)
12
- targetSdkVersion safeExtGet('targetSdkVersion', 33)
13
- versionCode 500
14
- versionName "5.0.0"
14
+ targetSdkVersion safeExtGet('targetSdkVersion', 34)
15
+ versionCode 602
16
+ versionName "5.0.2"
15
17
  ndk {
16
18
  abiFilters "armeabi-v7a", "x86"
17
19
  }
@@ -1 +1 @@
1
- <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.yoti.reactnative.docscan"></manifest>
1
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android" ></manifest>
@@ -10,11 +10,15 @@ import com.facebook.react.bridge.ReactContextBaseJavaModule;
10
10
  import com.facebook.react.bridge.ReadableMap;
11
11
  import com.facebook.react.bridge.ReactMethod;
12
12
  import com.yoti.mobile.android.yotisdkcore.YotiSdk;
13
+
14
+ import javax.annotation.Nullable;
15
+
13
16
  import static com.yoti.mobile.android.yotisdkcore.YotiSdkKt.YOTI_SDK_REQUEST_CODE;
14
17
 
15
18
  public class RNYotiDocScanModule extends ReactContextBaseJavaModule {
16
19
  private final static int SESSION_SUCCESS_CODE = 0;
17
20
  private YotiSdk mYotiSdk;
21
+ @Nullable
18
22
  private Callback mCompletion;
19
23
  private int mRequestCode = YOTI_SDK_REQUEST_CODE;
20
24
 
@@ -27,10 +31,10 @@ public class RNYotiDocScanModule extends ReactContextBaseJavaModule {
27
31
  int code = mYotiSdk.getSessionStatusCode();
28
32
  String description = mYotiSdk.getSessionStatusDescription();
29
33
  if (resultCode == Activity.RESULT_OK && code == SESSION_SUCCESS_CODE) {
30
- mCompletion.invoke(code, description);
34
+ invokeCompletion(code, description);
31
35
  return;
32
36
  }
33
- mCompletion.invoke(code, description);
37
+ invokeCompletion(code, description);
34
38
  }
35
39
  };
36
40
 
@@ -60,14 +64,21 @@ public class RNYotiDocScanModule extends ReactContextBaseJavaModule {
60
64
  mCompletion = completion;
61
65
  Activity currentActivity = getCurrentActivity();
62
66
  if (currentActivity == null) {
63
- mCompletion.invoke("E_ACTIVITY_DOES_NOT_EXIST");
67
+ invokeCompletion("E_ACTIVITY_DOES_NOT_EXIST");
64
68
  return;
65
69
  }
66
70
  boolean success = mYotiSdk.setSessionId(sessionID).setClientSessionToken(sessionToken).start(currentActivity, mRequestCode);
67
71
  if (!success) {
68
72
  int code = mYotiSdk.getSessionStatusCode();
69
73
  String description = mYotiSdk.getSessionStatusDescription();
70
- mCompletion.invoke(code, description);
74
+ invokeCompletion(code, description);
75
+ }
76
+ }
77
+
78
+ private void invokeCompletion(Object... args) {
79
+ if (mCompletion != null) {
80
+ mCompletion.invoke(args);
81
+ mCompletion = null;
71
82
  }
72
83
  }
73
84
  }
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "license": "https://www.yoti.com/terms/identity-verification",
6
6
  "author": "Yoti Ltd",
7
7
  "main": "RNYotiDocScan.js",
8
- "version": "5.0.0",
8
+ "version": "5.0.2",
9
9
  "peerDependencies": {
10
10
  "react": ">=18.0.0",
11
11
  "react-native": ">=0.70.0"