@getyoti/yoti-doc-scan-react-native 6.0.0-alpha.1 → 6.0.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/README.md
CHANGED
|
@@ -11,13 +11,13 @@ To integrate with Yoti IDV, a working infrastructure is needed (see [developers.
|
|
|
11
11
|
|
|
12
12
|
## Requirements
|
|
13
13
|
- [Android SDK 4+](https://github.com/getyoti/yoti-doc-scan-android/releases)
|
|
14
|
-
- [iOS SDK
|
|
14
|
+
- [iOS SDK 8+](https://github.com/getyoti/yoti-doc-scan-ios/releases)
|
|
15
15
|
|
|
16
16
|
## Integration
|
|
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.
|
|
20
|
+
"@getyoti/yoti-doc-scan-react-native": "^5.0.2"
|
|
21
21
|
}
|
|
22
22
|
```
|
|
23
23
|
|
package/android/build.gradle
CHANGED
|
@@ -12,8 +12,8 @@ android {
|
|
|
12
12
|
defaultConfig {
|
|
13
13
|
minSdkVersion safeExtGet('minSdkVersion', 21)
|
|
14
14
|
targetSdkVersion safeExtGet('targetSdkVersion', 34)
|
|
15
|
-
versionCode
|
|
16
|
-
versionName "6.0.0
|
|
15
|
+
versionCode 604
|
|
16
|
+
versionName "6.0.0"
|
|
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
|
-
|
|
34
|
+
invokeCompletion(code, description);
|
|
31
35
|
return;
|
|
32
36
|
}
|
|
33
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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/ios/Configuration.swift
CHANGED
|
@@ -9,6 +9,7 @@ struct Configuration: Decodable {
|
|
|
9
9
|
let includeFaceTecModuleType: Bool?
|
|
10
10
|
let includeFaceCaptureModuleType: Bool?
|
|
11
11
|
let disableIdentityDocumentCaptureEdgeDetection: Bool?
|
|
12
|
+
let enableRelaxedFaceCaptureLightingRequirement: Bool?
|
|
12
13
|
let theme: Theme?
|
|
13
14
|
|
|
14
15
|
init(from decoder: Decoder) throws {
|
|
@@ -19,6 +20,7 @@ struct Configuration: Decodable {
|
|
|
19
20
|
includeFaceTecModuleType = try container.decodeIfPresent(Bool.self, forKey: .includeFaceTecModuleType)
|
|
20
21
|
includeFaceCaptureModuleType = try container.decodeIfPresent(Bool.self, forKey: .includeFaceCaptureModuleType)
|
|
21
22
|
disableIdentityDocumentCaptureEdgeDetection = try container.decodeIfPresent(Bool.self, forKey: .disableIdentityDocumentCaptureEdgeDetection)
|
|
23
|
+
enableRelaxedFaceCaptureLightingRequirement = try container.decodeIfPresent(Bool.self, forKey: .enableRelaxedFaceCaptureLightingRequirement)
|
|
22
24
|
theme = try container.decodeIfPresent(Theme.self, forKey: .theme)
|
|
23
25
|
}
|
|
24
26
|
|
|
@@ -29,6 +31,7 @@ struct Configuration: Decodable {
|
|
|
29
31
|
case includeFaceTecModuleType = "include_facetec_module_type"
|
|
30
32
|
case includeFaceCaptureModuleType = "include_face_capture_module_type"
|
|
31
33
|
case disableIdentityDocumentCaptureEdgeDetection = "disable_identity_document_capture_edge_detection"
|
|
34
|
+
case enableRelaxedFaceCaptureLightingRequirement = "enable_relaxed_face_capture_lighting_requirement"
|
|
32
35
|
case theme
|
|
33
36
|
}
|
|
34
37
|
}
|
package/ios/RNYotiDocScan.swift
CHANGED
|
@@ -119,11 +119,14 @@ fileprivate extension RNYotiDocScan {
|
|
|
119
119
|
}
|
|
120
120
|
|
|
121
121
|
func options() -> [YotiSDKOption]? {
|
|
122
|
+
var options = [YotiSDKOption]()
|
|
122
123
|
if _configuration?.disableIdentityDocumentCaptureEdgeDetection == true {
|
|
123
|
-
|
|
124
|
-
}
|
|
125
|
-
|
|
124
|
+
options.insert(.disableIdentityDocumentCaptureEdgeDetection, at: options.count)
|
|
125
|
+
}
|
|
126
|
+
if _configuration?.enableRelaxedFaceCaptureLightingRequirement == true {
|
|
127
|
+
options.insert(.enableRelaxedFaceCaptureLightingRequirement, at: options.count)
|
|
126
128
|
}
|
|
129
|
+
return options.isEmpty ? nil : options
|
|
127
130
|
}
|
|
128
131
|
|
|
129
132
|
func theme() -> YotiSDKTheme? {
|
package/package.json
CHANGED