@getyoti/yoti-doc-scan-react-native 6.0.0-alpha.1 → 6.0.0-alpha.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.
@@ -12,8 +12,8 @@ android {
12
12
  defaultConfig {
13
13
  minSdkVersion safeExtGet('minSdkVersion', 21)
14
14
  targetSdkVersion safeExtGet('targetSdkVersion', 34)
15
- versionCode 600
16
- versionName "6.0.0-alpha.1"
15
+ versionCode 601
16
+ versionName "6.0.0-alpha.2"
17
17
  ndk {
18
18
  abiFilters "armeabi-v7a", "x86"
19
19
  }
@@ -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": "6.0.0-alpha.1",
8
+ "version": "6.0.0-alpha.2",
9
9
  "peerDependencies": {
10
10
  "react": ">=18.0.0",
11
11
  "react-native": ">=0.70.0"