@idnow/react-idcheckio 7.2.0 → 8.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/.editorconfig +15 -0
- package/.gitattributes +2 -0
- package/README.md +236 -193
- package/android/build.gradle +95 -37
- package/android/gradle.properties +5 -0
- package/android/src/main/AndroidManifest.xml +5 -4
- package/android/src/main/AndroidManifestNew.xml +9 -0
- package/android/src/main/java/com/idnowreactidcheckio/IdnowReactIdcheckioActivity.kt +67 -0
- package/android/src/main/java/com/idnowreactidcheckio/IdnowReactIdcheckioModule.kt +115 -0
- package/android/src/main/java/com/idnowreactidcheckio/IdnowReactIdcheckioPackage.kt +17 -0
- package/android/src/main/java/com/idnowreactidcheckio/bean/ExtractionEnum.kt +6 -0
- package/android/src/main/java/com/idnowreactidcheckio/bean/ExtractionReact.kt +20 -0
- package/android/src/main/java/com/idnowreactidcheckio/bean/IntegrityCheckEnum.kt +6 -0
- package/android/src/main/java/com/idnowreactidcheckio/bean/IntegrityCheckReact.kt +18 -0
- package/android/src/main/java/com/idnowreactidcheckio/bean/OnlineConfigEnum.kt +9 -0
- package/android/src/main/java/com/idnowreactidcheckio/bean/ParamsEnum.kt +19 -0
- package/android/src/main/java/com/idnowreactidcheckio/bean/Theme.kt +29 -0
- package/android/src/main/java/com/idnowreactidcheckio/bean/ThemeEnum.kt +13 -0
- package/android/src/main/java/com/idnowreactidcheckio/utils/Extension.kt +20 -0
- package/android/src/main/java/com/idnowreactidcheckio/utils/Mapper.kt +178 -0
- package/android/src/main/res/layout/activity_idnow_react_idcheckio.xml +9 -0
- package/idnow-react-idcheckio.podspec +43 -0
- package/ios/IdnowReactIdcheckio-Bridging-Header.h +2 -0
- package/ios/IdnowReactIdcheckio.mm +29 -0
- package/ios/IdnowReactIdcheckio.swift +131 -0
- package/ios/Models/ExtractionEnum.swift +13 -0
- package/ios/Models/ExtractionReact.swift +23 -0
- package/ios/Models/IntegrityCheckEnum.swift +13 -0
- package/ios/Models/IntegrityCheckReact.swift +24 -0
- package/ios/Models/OnlineConfigEnum.swift +16 -0
- package/ios/Models/ParamsEnum.swift +26 -0
- package/ios/Models/ThemeEnum.swift +20 -0
- package/ios/Models/ThemeReact.swift +32 -0
- package/ios/Utils/Mapper.swift +139 -0
- package/package.json +14 -11
- package/release-public.sh +4 -4
- package/src/index.d.ts +259 -0
- package/src/index.js +270 -0
- package/tsconfig.json +12 -0
- package/ReactIdcheckio.podspec +0 -15
- package/android/.project +0 -17
- package/android/.settings/org.eclipse.buildship.core.prefs +0 -13
- package/android/src/main/java/com/ariadnext/idcheckio/IdcheckioActivity.java +0 -133
- package/android/src/main/java/com/ariadnext/idcheckio/IdcheckioConst.java +0 -39
- package/android/src/main/java/com/ariadnext/idcheckio/IdcheckioModule.java +0 -189
- package/android/src/main/java/com/ariadnext/idcheckio/IdcheckioPackage.java +0 -22
- package/android/src/main/java/com/ariadnext/idcheckio/ParameterUtils.java +0 -251
- package/idcheckio_params.js +0 -343
- package/index.js +0 -6
- package/ios/Idcheckio.h +0 -11
- package/ios/Idcheckio.m +0 -301
- package/ios/Idcheckio.xcodeproj/project.pbxproj +0 -340
- package/ios/Idcheckio.xcworkspace/contents.xcworkspacedata +0 -10
- package/ios/Idcheckio.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
- package/ios/IdcheckioKeys.h +0 -49
- package/ios/IdcheckioSdk+Utils.swift +0 -35
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import IDCheckIOSDK
|
|
2
|
+
|
|
3
|
+
@objc(IdnowReactIdcheckio)
|
|
4
|
+
class IdnowReactIdcheckio: NSObject {
|
|
5
|
+
let tag = "IdnowReactIdcheckio"
|
|
6
|
+
|
|
7
|
+
@objc(preload:)
|
|
8
|
+
func preload(extractData: Bool) -> Void {
|
|
9
|
+
DispatchQueue.main.async {
|
|
10
|
+
Idcheckio.shared.preload(extractData: extractData)
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
@objc(activate:extractData:resolver:rejecter:)
|
|
15
|
+
func activate(token: String, extractData: Bool, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) -> Void {
|
|
16
|
+
DispatchQueue.main.async {
|
|
17
|
+
Idcheckio.shared.activate(withToken: token, extractData: extractData) { [weak self] error in
|
|
18
|
+
DispatchQueue.main.async {
|
|
19
|
+
guard let weakSelf = self else {
|
|
20
|
+
IdnowReactIdcheckio.rejectWithContextLost(reject)
|
|
21
|
+
return
|
|
22
|
+
}
|
|
23
|
+
if let error = error {
|
|
24
|
+
let jsonError = weakSelf.getErrorJson(error)
|
|
25
|
+
reject(weakSelf.tag, jsonError, error)
|
|
26
|
+
} else {
|
|
27
|
+
resolve("DONE")
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
@objc(start:onlineContext:theme:resolver:rejecter:)
|
|
35
|
+
func start(params: Dictionary<String, Any>, onlineContext: Dictionary<String, Any>?, theme: Dictionary<String, Any>?, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) -> Void {
|
|
36
|
+
DispatchQueue.main.async {
|
|
37
|
+
let (sdkParams, sdkExtraParams) = Mapper.getIdcheckioParams(map: params)
|
|
38
|
+
let onlineContextJson = Mapper.dictionaryToJSONString(onlineContext ?? [:]) ?? ""
|
|
39
|
+
let onlineContextValue = OnlineContext.from(json: onlineContextJson)
|
|
40
|
+
let cleanTheme = theme?.filter { $0.value as? String != nil } as? [String: String]
|
|
41
|
+
let idcheckTheme = Mapper.getThemeFromReadableMap(map: cleanTheme)
|
|
42
|
+
// Configure SDK
|
|
43
|
+
do {
|
|
44
|
+
// Set session parameters...
|
|
45
|
+
Idcheckio.shared.theme = idcheckTheme
|
|
46
|
+
try Idcheckio.shared.setParams(sdkParams)
|
|
47
|
+
try Idcheckio.shared.setExtraParams(sdkExtraParams)
|
|
48
|
+
} catch {
|
|
49
|
+
// setParams(_) and setExtraParams(_) could throw an error if you're trying to apply new parameters while a session is already running
|
|
50
|
+
print(error)
|
|
51
|
+
}
|
|
52
|
+
let idcheckioViewController = IdcheckioViewController()
|
|
53
|
+
idcheckioViewController.onlineContext = onlineContextValue
|
|
54
|
+
idcheckioViewController.resultCompletion = { [weak self] result in
|
|
55
|
+
DispatchQueue.main.async {
|
|
56
|
+
idcheckioViewController.dismiss(animated: true) {
|
|
57
|
+
guard let weakSelf = self else {
|
|
58
|
+
IdnowReactIdcheckio.rejectWithContextLost(reject)
|
|
59
|
+
return
|
|
60
|
+
}
|
|
61
|
+
switch result {
|
|
62
|
+
case .success(let idcheckioResult):
|
|
63
|
+
// Manage success
|
|
64
|
+
if let resultValue = idcheckioResult {
|
|
65
|
+
resolve(weakSelf.resultToJSON(resultValue))
|
|
66
|
+
} else {
|
|
67
|
+
resolve("{}")
|
|
68
|
+
}
|
|
69
|
+
case .failure(let error):
|
|
70
|
+
// Manage failure
|
|
71
|
+
let jsonError = weakSelf.getErrorJson(error)
|
|
72
|
+
reject(weakSelf.tag, jsonError, error)
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
UIApplication.shared.keyWindow?.rootViewController?.present(idcheckioViewController, animated: true)
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
@objc(startOnboarding:theme:resolver:rejecter:)
|
|
82
|
+
func startOnboarding(folderUid: String, theme: Dictionary<String, Any>?, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) -> Void {
|
|
83
|
+
DispatchQueue.main.async {
|
|
84
|
+
let viewController = UIApplication.shared.keyWindow?.rootViewController ?? UIViewController()
|
|
85
|
+
let cleanTheme = theme?.filter { $0.value as? String != nil } as? [String: String]
|
|
86
|
+
let idcheckTheme = Mapper.getThemeFromReadableMap(map: cleanTheme)
|
|
87
|
+
let onboardingCustomization = OnboardingCustomization(theme: idcheckTheme)
|
|
88
|
+
Idcheckio.startOnboarding(with: folderUid, from: viewController, onboardingCustomization: onboardingCustomization) { [weak self] resultOnboarding in
|
|
89
|
+
DispatchQueue.main.async {
|
|
90
|
+
guard let weakSelf = self else {
|
|
91
|
+
IdnowReactIdcheckio.rejectWithContextLost(reject)
|
|
92
|
+
return
|
|
93
|
+
}
|
|
94
|
+
switch resultOnboarding {
|
|
95
|
+
case .success:
|
|
96
|
+
// No data
|
|
97
|
+
resolve("SUCCESS")
|
|
98
|
+
case .failure(let error):
|
|
99
|
+
// Display error information
|
|
100
|
+
let jsonError = weakSelf.getErrorJson(error)
|
|
101
|
+
reject(weakSelf.tag, jsonError, error)
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// MARK: - Privates functions
|
|
109
|
+
private func resultToJSON(_ result: IdcheckioResult) -> String {
|
|
110
|
+
if let jsonData = try? JSONEncoder().encode(result) {
|
|
111
|
+
return String(data: jsonData, encoding: .utf8) ?? ""
|
|
112
|
+
} else {
|
|
113
|
+
return "{}"
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
private func getErrorJson(_ error: Error) -> String {
|
|
118
|
+
if let jsonData = try? JSONEncoder().encode(error as! IdcheckioError) {
|
|
119
|
+
return String(data: jsonData, encoding: .utf8) ?? ""
|
|
120
|
+
} else {
|
|
121
|
+
return "{\"message\":\"Internal error.\",\"details\":\"INTERNAL_ERROR\",\"cause\":\"INTERNAL_ERROR\"}"
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// MARK: - Statics functions
|
|
126
|
+
private static func rejectWithContextLost(_ reject: RCTPromiseRejectBlock) {
|
|
127
|
+
let currentError = "{\"message\":\"Failed to retrieve Self.\",\"details\":\"CONTEXT_LOST\",\"cause\":\"CONTEXT_LOST\"}"
|
|
128
|
+
let objectError = IdcheckioError.deviceError(details: "CONTEXT_LOST", message: "Failed to retrieve Self", subcause: nil)
|
|
129
|
+
reject("ERROR", currentError, objectError)
|
|
130
|
+
}
|
|
131
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
//
|
|
2
|
+
// ExtractionReact.swift
|
|
3
|
+
// idnow-react-idcheckio
|
|
4
|
+
//
|
|
5
|
+
// Created by Léa Lefeuvre on 11/07/2024.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
import Foundation
|
|
9
|
+
import IDCheckIOSDK
|
|
10
|
+
|
|
11
|
+
struct ExtractionReact {
|
|
12
|
+
var codeline: Extraction.DataRequirement? = nil
|
|
13
|
+
var face: Extraction.FaceDetection? = nil
|
|
14
|
+
/**
|
|
15
|
+
* Map to an [Extraction] used by the sdk.
|
|
16
|
+
*/
|
|
17
|
+
func toExtraction() -> Extraction {
|
|
18
|
+
let extraction = Extraction()
|
|
19
|
+
extraction.codeline = codeline ?? .disabled
|
|
20
|
+
extraction.face = face ?? .disabled
|
|
21
|
+
return extraction
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
//
|
|
2
|
+
// IntegrityCheckReact.swift
|
|
3
|
+
// idnow-react-idcheckio
|
|
4
|
+
//
|
|
5
|
+
// Created by Léa Lefeuvre on 11/07/2024.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
import Foundation
|
|
9
|
+
import IDCheckIOSDK
|
|
10
|
+
|
|
11
|
+
struct IntegrityCheckReact {
|
|
12
|
+
var readEmrtd: Bool? = nil
|
|
13
|
+
var docLiveness: Bool? = nil
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Map to an [IntegrityCheck] used by the sdk.
|
|
17
|
+
*/
|
|
18
|
+
func toIntegrityCheck() -> IntegrityCheck {
|
|
19
|
+
let integrityCheck = IntegrityCheck()
|
|
20
|
+
integrityCheck.readEmrtd = readEmrtd ?? false
|
|
21
|
+
integrityCheck.docLiveness = docLiveness ?? false
|
|
22
|
+
return integrityCheck
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
//
|
|
2
|
+
// OnlineConfigEnum.swift
|
|
3
|
+
// idnow-react-idcheckio
|
|
4
|
+
//
|
|
5
|
+
// Created by Léa Lefeuvre on 11/07/2024.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
import Foundation
|
|
9
|
+
|
|
10
|
+
enum OnlineConfigEnum: String {
|
|
11
|
+
case isReferenceDocument
|
|
12
|
+
case cisType
|
|
13
|
+
case folderUid
|
|
14
|
+
case biometricConsent
|
|
15
|
+
case enableManualAnalysis
|
|
16
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
//
|
|
2
|
+
// ParamsEnum.swift
|
|
3
|
+
// idnow-react-idcheckio
|
|
4
|
+
//
|
|
5
|
+
// Created by Léa Lefeuvre on 11/07/2024.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
import Foundation
|
|
9
|
+
|
|
10
|
+
enum ParamsEnum: String {
|
|
11
|
+
case docType
|
|
12
|
+
case confirmationType
|
|
13
|
+
case sideOneExtraction
|
|
14
|
+
case sideTwoExtraction
|
|
15
|
+
case useHd
|
|
16
|
+
case integrityCheck
|
|
17
|
+
case orientation
|
|
18
|
+
case onlineConfig
|
|
19
|
+
case language
|
|
20
|
+
case manualButtonTimer
|
|
21
|
+
case maxPictureFilesize
|
|
22
|
+
case adjustCrop
|
|
23
|
+
case confirmAbort
|
|
24
|
+
case captureMode
|
|
25
|
+
case overrideWordings
|
|
26
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
//
|
|
2
|
+
// ThemeEnum.swift
|
|
3
|
+
// idnow-react-idcheckio
|
|
4
|
+
//
|
|
5
|
+
// Created by Léa Lefeuvre on 11/07/2024.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
import Foundation
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Theme enum to simplify the mapping of a Theme Readable Map.
|
|
12
|
+
*/
|
|
13
|
+
enum ThemeEnum: String {
|
|
14
|
+
case PRIMARY_COLOR = "primaryColor"
|
|
15
|
+
case BACKGROUND_COLOR = "backgroundColor"
|
|
16
|
+
case FOREGROUND_COLOR = "foregroundColor"
|
|
17
|
+
case BORDER_COLOR = "borderColor"
|
|
18
|
+
case TEXT_COLOR = "textColor"
|
|
19
|
+
case TITLE_COLOR = "titleColor"
|
|
20
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
//
|
|
2
|
+
// ThemeReact.swift
|
|
3
|
+
// idnow-react-idcheckio
|
|
4
|
+
//
|
|
5
|
+
// Created by Léa Lefeuvre on 11/07/2024.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
import Foundation
|
|
9
|
+
import IDCheckIOSDK
|
|
10
|
+
|
|
11
|
+
struct ThemeReact {
|
|
12
|
+
|
|
13
|
+
var foregroundColor: String? = nil
|
|
14
|
+
var borderColor: String? = nil
|
|
15
|
+
var backgroundColor: String? = nil
|
|
16
|
+
var primaryColor: String? = nil
|
|
17
|
+
var titleColor: String? = nil
|
|
18
|
+
var textColor: String? = nil
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Map a theme to a toIDCheckioTheme
|
|
22
|
+
*/
|
|
23
|
+
func toIDCheckioTheme() -> Theme {
|
|
24
|
+
let theme = Theme(foregroundColor: UIColor(named: foregroundColor ?? "") ?? ColorAsset.foreground.color,
|
|
25
|
+
backgroundColor: UIColor(named: backgroundColor ?? "") ?? ColorAsset.background.color,
|
|
26
|
+
borderColor: UIColor(named: borderColor ?? "") ?? ColorAsset.border.color,
|
|
27
|
+
primaryColor: UIColor(named: primaryColor ?? "") ?? ColorAsset.primary.color,
|
|
28
|
+
titleColor: UIColor(named: titleColor ?? ""),
|
|
29
|
+
textColor: UIColor(named: textColor ?? ""))
|
|
30
|
+
return theme
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Mapper.swift
|
|
3
|
+
// idnow-react-idcheckio
|
|
4
|
+
//
|
|
5
|
+
// Created by Léa Lefeuvre on 11/07/2024.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
import Foundation
|
|
9
|
+
import IDCheckIOSDK
|
|
10
|
+
|
|
11
|
+
class Mapper {
|
|
12
|
+
/**
|
|
13
|
+
* Retrieve an [OnboardingCustomization] from a Map.
|
|
14
|
+
* @param map the map containing all the colors.
|
|
15
|
+
* @return the onboardingCustomization to apply.
|
|
16
|
+
*/
|
|
17
|
+
static func getOnboardingCustomizationFromReadableMap(map: Dictionary<String, String>) -> OnboardingCustomization {
|
|
18
|
+
return OnboardingCustomization(theme: getThemeFromReadableMap(map: map))
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Retrieve a [Theme] from a Map.
|
|
23
|
+
* @param map the map containing all the colors.
|
|
24
|
+
* @return the theme to apply.
|
|
25
|
+
*/
|
|
26
|
+
static func getThemeFromReadableMap(map: Dictionary<String, String?>?) -> Theme {
|
|
27
|
+
let reactTheme = ThemeReact(foregroundColor: map?[ThemeEnum.FOREGROUND_COLOR.rawValue] ?? "",
|
|
28
|
+
borderColor: map?[ThemeEnum.BORDER_COLOR.rawValue] ?? "",
|
|
29
|
+
backgroundColor: map?[ThemeEnum.BACKGROUND_COLOR.rawValue] ?? "",
|
|
30
|
+
primaryColor: map?[ThemeEnum.PRIMARY_COLOR.rawValue] ?? "",
|
|
31
|
+
titleColor: map?[ThemeEnum.TITLE_COLOR.rawValue] ?? "",
|
|
32
|
+
textColor: map?[ThemeEnum.TEXT_COLOR.rawValue] ?? "")
|
|
33
|
+
return reactTheme.toIDCheckioTheme()
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Retrieve a SDKParams and a SDKExtraParams from a Map.
|
|
39
|
+
* @param map the map containing all the parameters.
|
|
40
|
+
* @return the params completed.
|
|
41
|
+
*/
|
|
42
|
+
static func getIdcheckioParams(map: Dictionary<String, Any?>?) -> (SDKParams, SDKExtraParams) {
|
|
43
|
+
// SDK Params
|
|
44
|
+
let sdkParams = SDKParams()
|
|
45
|
+
let confirmTypeValue = map?[ParamsEnum.confirmationType.rawValue] as? String
|
|
46
|
+
sdkParams.confirmType = ConfirmationType(rawValue: confirmTypeValue ?? "") ?? .none
|
|
47
|
+
sdkParams.useHD = map?[ParamsEnum.useHd.rawValue] as? Bool ?? false
|
|
48
|
+
sdkParams.overrideWordings = map?[ParamsEnum.overrideWordings.rawValue] as? [String: String]? ?? nil
|
|
49
|
+
let documentType = map?[ParamsEnum.docType.rawValue] as? String
|
|
50
|
+
sdkParams.documentType = DocumentType(rawValue: documentType ?? "") ?? .disabled
|
|
51
|
+
let mapExtraction1 = map?[ParamsEnum.sideOneExtraction.rawValue] as? [String: Any?]
|
|
52
|
+
sdkParams.side1Extraction = Self.getExtraction(map: mapExtraction1)
|
|
53
|
+
let mapExtraction2 = map?[ParamsEnum.sideTwoExtraction.rawValue] as? [String: Any?]
|
|
54
|
+
sdkParams.side2Extraction = Self.getExtraction(map: mapExtraction2)
|
|
55
|
+
let mapOnlineConfig = map?[ParamsEnum.onlineConfig.rawValue] as? [String: Any?]
|
|
56
|
+
sdkParams.onlineConfig = Self.getOnlineConfig(map: mapOnlineConfig)
|
|
57
|
+
let mapIntegrityCheck = map?[ParamsEnum.integrityCheck.rawValue] as? [String: Any?]
|
|
58
|
+
sdkParams.integrityCheck = Self.getIntegrityCheck(map: mapIntegrityCheck)
|
|
59
|
+
let orientationValue = map?[ParamsEnum.orientation.rawValue] as? String
|
|
60
|
+
sdkParams.orientation = Orientation(rawValue: orientationValue ?? "") ?? .automatic
|
|
61
|
+
|
|
62
|
+
// SDK Extra Params
|
|
63
|
+
let sdkExtraParams = SDKExtraParams()
|
|
64
|
+
let languageValue = map?[ParamsEnum.language.rawValue] as? String
|
|
65
|
+
sdkExtraParams.setLanguage(languageValue ?? "")
|
|
66
|
+
let manualButtonValue = map?[ParamsEnum.manualButtonTimer.rawValue] as? Double
|
|
67
|
+
sdkExtraParams.manualButtonTimer = manualButtonValue ?? 10
|
|
68
|
+
let sizeValue = map?[ParamsEnum.maxPictureFilesize.rawValue] as? String
|
|
69
|
+
sdkExtraParams.setMaxPictureFilesize(sizeValue ?? "\(FileSize.fourMegaBytes.rawValue)")
|
|
70
|
+
let confirmAbortValue = map?[ParamsEnum.confirmAbort.rawValue] as? Bool
|
|
71
|
+
sdkExtraParams.confirmAbort = confirmAbortValue ?? false
|
|
72
|
+
let adjustCropValue = map?[ParamsEnum.adjustCrop.rawValue] as? Bool
|
|
73
|
+
sdkExtraParams.adjustCrop = adjustCropValue ?? false
|
|
74
|
+
let captureMode = map?[ParamsEnum.captureMode.rawValue] as? String
|
|
75
|
+
sdkExtraParams.setCaptureMode(captureMode ?? "camera")
|
|
76
|
+
|
|
77
|
+
return (sdkParams, sdkExtraParams)
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
static func dictionaryToJSONString(_ dictionary: [String: Any?]) -> String? {
|
|
81
|
+
// Convert the dictionary to a JSON-compatible dictionary
|
|
82
|
+
let jsonCompatibleDict = dictionary.mapValues { $0 ?? NSNull() }
|
|
83
|
+
|
|
84
|
+
// Check if the dictionary can be serialized to JSON data
|
|
85
|
+
guard JSONSerialization.isValidJSONObject(jsonCompatibleDict) else {
|
|
86
|
+
print("Invalid JSON object")
|
|
87
|
+
return nil
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// Attempt to serialize the dictionary to JSON data
|
|
91
|
+
do {
|
|
92
|
+
let jsonData = try JSONSerialization.data(withJSONObject: jsonCompatibleDict, options: [])
|
|
93
|
+
// Convert JSON data to a string
|
|
94
|
+
return String(data: jsonData, encoding: .utf8)
|
|
95
|
+
} catch {
|
|
96
|
+
print("Error serializing JSON: \(error.localizedDescription)")
|
|
97
|
+
return nil
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Retrieve an [Extraction] from a Map.
|
|
103
|
+
* @param map the map containing all the extraction values.
|
|
104
|
+
* @return the extraction completed.
|
|
105
|
+
*/
|
|
106
|
+
private static func getExtraction(map: Dictionary<String, Any?>?) -> Extraction {
|
|
107
|
+
let dataRequirementValue = map?[ExtractionEnum.codeline.rawValue] as? String ?? ""
|
|
108
|
+
let faceDetectionValue = map?[ExtractionEnum.faceDetection.rawValue] as? String ?? ""
|
|
109
|
+
let extractionReact = ExtractionReact(codeline: Extraction.DataRequirement(rawValue: dataRequirementValue),
|
|
110
|
+
face: Extraction.FaceDetection(rawValue: faceDetectionValue))
|
|
111
|
+
return extractionReact.toExtraction()
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Retrieve an [IntegrityCheck] from a Map.
|
|
116
|
+
* @param map the map containing all the integrity check values.
|
|
117
|
+
* @return the integrityCheck completed.
|
|
118
|
+
*/
|
|
119
|
+
private static func getIntegrityCheck(map: Dictionary<String, Any?>?) -> IntegrityCheck {
|
|
120
|
+
let readEmrtdValue = map?[IntegrityCheckEnum.readEmrtd.rawValue] as? Bool
|
|
121
|
+
let docLivenessValue = map?[IntegrityCheckEnum.docLiveness.rawValue] as? Bool
|
|
122
|
+
let integrityCheckReact = IntegrityCheckReact(readEmrtd: readEmrtdValue,
|
|
123
|
+
docLiveness: docLivenessValue)
|
|
124
|
+
return integrityCheckReact.toIntegrityCheck()
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Retrieve an [OnlineConfig] from a Map.
|
|
129
|
+
* @param map the map containing all the online config values.
|
|
130
|
+
* @return the onlineConfig completed.
|
|
131
|
+
*/
|
|
132
|
+
private static func getOnlineConfig(map: Dictionary<String, Any?>?) -> OnlineConfig {
|
|
133
|
+
let jsonData = (dictionaryToJSONString(map ?? [:]) ?? "").data(using: .utf8)!
|
|
134
|
+
guard let onlineConfig = try? JSONDecoder().decode(OnlineConfig.self, from: jsonData) else {
|
|
135
|
+
fatalError("Cannot convert to onlineConfig")
|
|
136
|
+
}
|
|
137
|
+
return onlineConfig
|
|
138
|
+
}
|
|
139
|
+
}
|
package/package.json
CHANGED
|
@@ -1,22 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@idnow/react-idcheckio",
|
|
3
3
|
"title": "IDCheckIO SDK ReactNative",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "8.0.0",
|
|
5
5
|
"description": "React Native plugin for IDCheck.io Mobile SDK",
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
"homepage": "https://www.idnow.io/",
|
|
7
|
+
"react-native": "src/index",
|
|
8
|
+
"source": "src/index",
|
|
9
|
+
"typings": "src/index",
|
|
10
10
|
"keywords": [
|
|
11
|
-
"react-native"
|
|
11
|
+
"react-native",
|
|
12
|
+
"ios",
|
|
13
|
+
"android"
|
|
12
14
|
],
|
|
13
|
-
"author": "IDnow",
|
|
15
|
+
"author": "IDnow <team-mobile@idnow.io> (https://www.idnow.io/)",
|
|
14
16
|
"license": "ISC",
|
|
15
|
-
"
|
|
16
|
-
|
|
17
|
+
"resolutions": {
|
|
18
|
+
"@types/react": "^18.2.44"
|
|
19
|
+
},
|
|
17
20
|
"peerDependencies": {
|
|
18
|
-
"react": "17.0.1",
|
|
21
|
+
"react": ">=17.0.1",
|
|
19
22
|
"react-native": ">=0.64.0"
|
|
20
23
|
},
|
|
21
|
-
"
|
|
24
|
+
"packageManager": "yarn@3.6.1"
|
|
22
25
|
}
|
package/release-public.sh
CHANGED
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
PACKAGE_VERSION=$(node -p -e "require('./package.json').version")
|
|
15
15
|
|
|
16
16
|
# Don't modify theses two variables!
|
|
17
|
-
current_android_version="
|
|
18
|
-
current_ios_version="
|
|
17
|
+
current_android_version="8.0.0"
|
|
18
|
+
current_ios_version="8.0.0"
|
|
19
19
|
|
|
20
20
|
# Read version wanted from input
|
|
21
21
|
android_value=""
|
|
@@ -72,8 +72,8 @@ fi
|
|
|
72
72
|
|
|
73
73
|
# Update versions for IDC
|
|
74
74
|
sed -i '' "s/sdk:$current_android_version/sdk:$android_value/g" android/build.gradle
|
|
75
|
-
sed -i '' "s/~> $current_ios_version/~> $ios_value/g"
|
|
76
|
-
sed -i '' "s/= \"$PACKAGE_VERSION/= \"$common_version/g"
|
|
75
|
+
sed -i '' "s/~> $current_ios_version/~> $ios_value/g" idnow-react-idcheckio.podspec
|
|
76
|
+
sed -i '' "s/= \"$PACKAGE_VERSION/= \"$common_version/g" idnow-react-idcheckio.podspec
|
|
77
77
|
sed -i '' "s/current_android_version=\"$current_android_version/current_android_version=\"$android_value/g" release-public.sh
|
|
78
78
|
sed -i '' "s/current_ios_version=\"$current_ios_version/current_ios_version=\"$ios_value/g" release-public.sh
|
|
79
79
|
|