@getyoti/yoti-doc-scan-react-native 5.0.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.
- package/README.md +1 -1
- package/android/build.gradle +2 -2
- package/android/src/main/java/com/yoti/reactnative/docscan/RNYotiDocScanModule.java +15 -4
- package/ios/Configuration.swift +3 -0
- package/ios/RNYotiDocScan.swift +9 -0
- package/ios/Theme/ColorTheme.swift +4 -0
- package/ios/Theme/IconTheme.swift +5 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -98,7 +98,7 @@ For customization on Android, you can refer to the documentation outlined [here]
|
|
|
98
98
|
RNYotiDocScan.setRequestCode(0); // default: 9001
|
|
99
99
|
```
|
|
100
100
|
|
|
101
|
-
On iOS, the SDK expects launched
|
|
101
|
+
On iOS, the SDK expects a launched session to contain multiple flows by default. To enable a single-flow session, 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:
|
|
102
102
|
```javascript
|
|
103
103
|
RNYotiDocScan.setConfiguration({
|
|
104
104
|
bundle_identifier: "", // Optional: defaults to the main bundle identifier if not specified.
|
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 "
|
|
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
|
-
|
|
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
|
@@ -8,6 +8,7 @@ struct Configuration: Decodable {
|
|
|
8
8
|
let includeSupplementaryDocumentModuleType: Bool?
|
|
9
9
|
let includeFaceTecModuleType: Bool?
|
|
10
10
|
let includeFaceCaptureModuleType: Bool?
|
|
11
|
+
let disableIdentityDocumentCaptureEdgeDetection: Bool?
|
|
11
12
|
let theme: Theme?
|
|
12
13
|
|
|
13
14
|
init(from decoder: Decoder) throws {
|
|
@@ -17,6 +18,7 @@ struct Configuration: Decodable {
|
|
|
17
18
|
includeSupplementaryDocumentModuleType = try container.decodeIfPresent(Bool.self, forKey: .includeSupplementaryDocumentModuleType)
|
|
18
19
|
includeFaceTecModuleType = try container.decodeIfPresent(Bool.self, forKey: .includeFaceTecModuleType)
|
|
19
20
|
includeFaceCaptureModuleType = try container.decodeIfPresent(Bool.self, forKey: .includeFaceCaptureModuleType)
|
|
21
|
+
disableIdentityDocumentCaptureEdgeDetection = try container.decodeIfPresent(Bool.self, forKey: .disableIdentityDocumentCaptureEdgeDetection)
|
|
20
22
|
theme = try container.decodeIfPresent(Theme.self, forKey: .theme)
|
|
21
23
|
}
|
|
22
24
|
|
|
@@ -26,6 +28,7 @@ struct Configuration: Decodable {
|
|
|
26
28
|
case includeSupplementaryDocumentModuleType = "include_supplementary_document_module_type"
|
|
27
29
|
case includeFaceTecModuleType = "include_facetec_module_type"
|
|
28
30
|
case includeFaceCaptureModuleType = "include_face_capture_module_type"
|
|
31
|
+
case disableIdentityDocumentCaptureEdgeDetection = "disable_identity_document_capture_edge_detection"
|
|
29
32
|
case theme
|
|
30
33
|
}
|
|
31
34
|
}
|
package/ios/RNYotiDocScan.swift
CHANGED
|
@@ -71,6 +71,7 @@ extension RNYotiDocScan: YotiSDKDataSource, YotiSDKDelegate {
|
|
|
71
71
|
sessionToken: sessionToken,
|
|
72
72
|
singleFlow: _configuration?.singleFlow ?? false,
|
|
73
73
|
moduleTypes: moduleTypes(),
|
|
74
|
+
options: options(),
|
|
74
75
|
theme: theme()
|
|
75
76
|
)
|
|
76
77
|
}
|
|
@@ -117,6 +118,14 @@ fileprivate extension RNYotiDocScan {
|
|
|
117
118
|
return moduleTypes
|
|
118
119
|
}
|
|
119
120
|
|
|
121
|
+
func options() -> [YotiSDKOption]? {
|
|
122
|
+
if _configuration?.disableIdentityDocumentCaptureEdgeDetection == true {
|
|
123
|
+
return [.disableIdentityDocumentCaptureEdgeDetection]
|
|
124
|
+
} else {
|
|
125
|
+
return nil
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
120
129
|
func theme() -> YotiSDKTheme? {
|
|
121
130
|
guard let theme = _configuration?.theme else {
|
|
122
131
|
return nil
|
|
@@ -22,6 +22,7 @@ struct ColorTheme: YotiSDKColorTheme, Decodable {
|
|
|
22
22
|
let borderCritical: UIColor
|
|
23
23
|
let borderEmphasis2: UIColor
|
|
24
24
|
let icon: UIColor
|
|
25
|
+
let icon2: UIColor
|
|
25
26
|
let icon3: UIColor
|
|
26
27
|
let iconEmphasis: UIColor
|
|
27
28
|
let iconWarning: UIColor
|
|
@@ -53,6 +54,7 @@ struct ColorTheme: YotiSDKColorTheme, Decodable {
|
|
|
53
54
|
let borderCritical = try container.decode(String.self, forKey: .borderCritical)
|
|
54
55
|
let borderEmphasis2 = try container.decode(String.self, forKey: .borderEmphasis2)
|
|
55
56
|
let icon = try container.decode(String.self, forKey: .icon)
|
|
57
|
+
let icon2 = try container.decode(String.self, forKey: .icon2)
|
|
56
58
|
let icon3 = try container.decode(String.self, forKey: .icon3)
|
|
57
59
|
let iconEmphasis = try container.decode(String.self, forKey: .iconEmphasis)
|
|
58
60
|
let iconWarning = try container.decode(String.self, forKey: .iconWarning)
|
|
@@ -81,6 +83,7 @@ struct ColorTheme: YotiSDKColorTheme, Decodable {
|
|
|
81
83
|
self.borderCritical = UIColor(hexString: borderCritical)
|
|
82
84
|
self.borderEmphasis2 = UIColor(hexString: borderEmphasis2)
|
|
83
85
|
self.icon = UIColor(hexString: icon)
|
|
86
|
+
self.icon2 = UIColor(hexString: icon2)
|
|
84
87
|
self.icon3 = UIColor(hexString: icon3)
|
|
85
88
|
self.iconEmphasis = UIColor(hexString: iconEmphasis)
|
|
86
89
|
self.iconWarning = UIColor(hexString: iconWarning)
|
|
@@ -112,6 +115,7 @@ struct ColorTheme: YotiSDKColorTheme, Decodable {
|
|
|
112
115
|
case borderCritical = "border_critical"
|
|
113
116
|
case borderEmphasis2 = "border_emphasis2"
|
|
114
117
|
case icon
|
|
118
|
+
case icon2
|
|
115
119
|
case icon3
|
|
116
120
|
case iconEmphasis = "icon_emphasis"
|
|
117
121
|
case iconWarning = "icon_warning"
|
|
@@ -16,6 +16,7 @@ struct IconTheme: YotiSDKIconTheme, Decodable {
|
|
|
16
16
|
var eye: YotiSDKIcon?
|
|
17
17
|
var exclamationmark: YotiSDKIcon?
|
|
18
18
|
var face: YotiSDKIcon?
|
|
19
|
+
var help: YotiSDKIcon?
|
|
19
20
|
var identityDocumentCapture: YotiSDKIcon?
|
|
20
21
|
var info: YotiSDKIcon?
|
|
21
22
|
var largeLeftChevron: YotiSDKIcon?
|
|
@@ -60,6 +61,9 @@ struct IconTheme: YotiSDKIconTheme, Decodable {
|
|
|
60
61
|
if let icon = try container.decodeIfPresent(Icon.self, forKey: .face) {
|
|
61
62
|
face = YotiSDKIcon(icon)
|
|
62
63
|
}
|
|
64
|
+
if let icon = try container.decodeIfPresent(Icon.self, forKey: .help) {
|
|
65
|
+
help = YotiSDKIcon(icon)
|
|
66
|
+
}
|
|
63
67
|
if let icon = try container.decodeIfPresent(Icon.self, forKey: .identityDocumentCapture) {
|
|
64
68
|
identityDocumentCapture = YotiSDKIcon(icon)
|
|
65
69
|
}
|
|
@@ -106,6 +110,7 @@ struct IconTheme: YotiSDKIconTheme, Decodable {
|
|
|
106
110
|
case eye
|
|
107
111
|
case exclamationmark
|
|
108
112
|
case face
|
|
113
|
+
case help
|
|
109
114
|
case identityDocumentCapture = "identity_document_capture"
|
|
110
115
|
case info
|
|
111
116
|
case largeLeftChevron = "large_left_chevron"
|
package/package.json
CHANGED