@idnow/react-idcheckio 8.1.9 → 9.1.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 +23 -45
- package/android/build.gradle +2 -2
- package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/android/gradle/wrapper/gradle-wrapper.properties +7 -0
- package/android/src/main/java/com/idnowreactidcheckio/{IdnowReactIdcheckioModule.kt → IDCheckIOBridgeModule.kt} +25 -27
- package/android/src/main/java/com/idnowreactidcheckio/IdnowReactIdcheckioActivity.kt +17 -15
- package/android/src/main/java/com/idnowreactidcheckio/IdnowReactIdcheckioPackage.kt +1 -1
- package/android/src/main/java/com/idnowreactidcheckio/bean/ExtractionReact.kt +4 -4
- package/android/src/main/java/com/idnowreactidcheckio/bean/IntegrityCheckReact.kt +2 -2
- package/android/src/main/java/com/idnowreactidcheckio/bean/OnlineContextEnum.kt +9 -0
- package/android/src/main/java/com/idnowreactidcheckio/bean/ParamsEnum.kt +1 -2
- package/android/src/main/java/com/idnowreactidcheckio/utils/Mapper.kt +17 -53
- package/app.plugin.js +19 -0
- package/idnow-react-idcheckio.podspec +5 -24
- package/ios/IDCheckIOBridgeModule.m +29 -0
- package/ios/IDCheckIOBridgeModule.swift +106 -0
- package/ios/Models/ParamsEnum.swift +0 -1
- package/ios/Utils/Mapper.swift +16 -38
- package/package.json +7 -3
- package/plugins/addSPMDependency.js +119 -0
- package/plugins/copyNativeFiles.js +135 -0
- package/release-public.sh +2 -2
- package/src/index.d.ts +6 -33
- package/src/index.js +36 -58
- package/android/src/main/java/com/idnowreactidcheckio/bean/Theme.kt +0 -29
- package/android/src/main/java/com/idnowreactidcheckio/bean/ThemeEnum.kt +0 -13
- package/ios/IdnowReactIdcheckio-Bridging-Header.h +0 -2
- package/ios/IdnowReactIdcheckio.mm +0 -29
- package/ios/IdnowReactIdcheckio.swift +0 -131
- package/ios/Models/ThemeEnum.swift +0 -20
- package/ios/Models/ThemeReact.swift +0 -32
package/README.md
CHANGED
|
@@ -11,6 +11,24 @@ npm install @idnow/react-idcheckio
|
|
|
11
11
|
yarn add @idnow/react-idcheckio
|
|
12
12
|
```
|
|
13
13
|
|
|
14
|
+
You need to add this into your `app.json` to link the plugin IDCheckIO.
|
|
15
|
+
|
|
16
|
+
```json
|
|
17
|
+
{
|
|
18
|
+
"expo": {
|
|
19
|
+
"plugins": [
|
|
20
|
+
[
|
|
21
|
+
"@idnow/react-idcheckio",
|
|
22
|
+
{
|
|
23
|
+
"version": "9.1.0"
|
|
24
|
+
}
|
|
25
|
+
]
|
|
26
|
+
]
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
|
|
14
32
|
## Usage
|
|
15
33
|
|
|
16
34
|
You will have access to four methods to communicate with the sdk.
|
|
@@ -38,22 +56,20 @@ You will have access to four methods to communicate with the sdk.
|
|
|
38
56
|
* Start an onboarding session with the given folder uid.
|
|
39
57
|
*
|
|
40
58
|
* @param folderUid - The folder that will be used to run the session.
|
|
41
|
-
* @param theme - A theme to customize SDK colors.
|
|
42
59
|
* @returns Void on success.
|
|
43
60
|
* @throws An error of type {@link IDCheckioError} if the session fails.
|
|
44
61
|
*/
|
|
45
|
-
export function startOnboarding(folderUid: string
|
|
62
|
+
export function startOnboarding(folderUid: string): Promise<void>;
|
|
46
63
|
|
|
47
64
|
/**
|
|
48
65
|
* Start the capture of one document with the given parameters.
|
|
49
66
|
*
|
|
50
67
|
* @param parameters - The parameters to configure the capture session.
|
|
51
68
|
* @param onlineContext - Online context. Let it null and the first capture and send the one you receive on result to chain to capture.
|
|
52
|
-
* @param theme - A theme to customize SDK colors.
|
|
53
69
|
* @returns {@link IDCheckioResult}
|
|
54
70
|
* @throws An error of type {@link IDCheckioError} if the capture fails.
|
|
55
71
|
*/
|
|
56
|
-
export function
|
|
72
|
+
export function startSession(onlineContext: IDCheckioOnlineContext | null, parameters: IDCheckioParams): Promise<IDCheckioResult>;
|
|
57
73
|
```
|
|
58
74
|
### Preload
|
|
59
75
|
The `preload` is completely optional and will preload the embedded model of the sdk, this way the `activate` will be faster afterwards.
|
|
@@ -88,15 +104,12 @@ To start it you need to call the `startOnboarding` with a CIS folderUid, if the
|
|
|
88
104
|
|
|
89
105
|
All the parameters of the onboarding are on the server you don't have to set any parameter on your side. (To check what is configurable, look at the official documentation or contact your dedicated CSM).
|
|
90
106
|
|
|
91
|
-
You can also provide an `IDCheckTheme` to customize the colors of the sdk, check the associated section for more information.
|
|
92
|
-
|
|
93
107
|
No result is expected, you will also receive an `IDCheckioError` if something happens during the session.
|
|
94
108
|
```js
|
|
95
109
|
import { startOnboarding } from '@idnow/react-idcheckio';
|
|
96
110
|
|
|
97
111
|
const startCapture = async () => {
|
|
98
|
-
|
|
99
|
-
startOnboarding(generateUUID(), theme).then(
|
|
112
|
+
startOnboarding(generateUUID()).then(
|
|
100
113
|
() => {
|
|
101
114
|
Alert.alert('Success', 'Onboarding ended successfully.');
|
|
102
115
|
},
|
|
@@ -111,7 +124,7 @@ const startCapture = async () => {
|
|
|
111
124
|
The start mode is a single capture of a document that can be configured directly in the code.
|
|
112
125
|
To perform a full onboarding, you must manage the flow of multiple documents yourself by calling `start` as many times as you have documents to capture.
|
|
113
126
|
|
|
114
|
-
To start it, you need to call the `start` with an `IDCheckioParams` object containing all the parameters you have set for this capture, an optional `IDCheckioOnlineContext
|
|
127
|
+
To start it, you need to call the `start` with an `IDCheckioParams` object containing all the parameters you have set for this capture, an optional `IDCheckioOnlineContext`.
|
|
115
128
|
|
|
116
129
|
The result is an `IDCheckioResult` that will only contain an `IDCheckioOnlineContext`. I will explain more about this `IDCheckioOnlineContext` in the dedicated section.
|
|
117
130
|
Like others calls, you will also receive an `IDCheckioError` if something happens during the session.
|
|
@@ -122,9 +135,8 @@ import { start } from '@idnow/react-idcheckio';
|
|
|
122
135
|
const [onlineContext, setOnlineContext] = useState<IDCheckioOnlineContext | null>(null);
|
|
123
136
|
|
|
124
137
|
const startCapture = async () => {
|
|
125
|
-
let theme = new IDCheckTheme({});
|
|
126
138
|
let params = new IDCheckioParamsBuilder().build();
|
|
127
|
-
|
|
139
|
+
startSession(onlineContext, params).then(
|
|
128
140
|
(result) => {
|
|
129
141
|
setOnlineContext(result.onlineContext);
|
|
130
142
|
Alert.alert('Success', 'Capture ended successfully.');
|
|
@@ -194,12 +206,6 @@ const attachment = new IDCheckioParamsBuilder()
|
|
|
194
206
|
.setUseHd(true)
|
|
195
207
|
.setAdjustCrop(true)
|
|
196
208
|
.setOnlineConfig(new OnlineConfig({ cisType: CISType.OTHER }))
|
|
197
|
-
.setOverrideWordings(new Map([
|
|
198
|
-
// Label that will update the type of document wanted in the title of the presentation page.
|
|
199
|
-
['label', 'document'],
|
|
200
|
-
// A quick description of the document you want your users to capture. Can be useful if the label is not clear by itself.
|
|
201
|
-
['description', 'Capture a document of your choice.'],
|
|
202
|
-
]))
|
|
203
209
|
.build()
|
|
204
210
|
```
|
|
205
211
|
|
|
@@ -247,31 +253,3 @@ Two possibilities here, the easier is to handle the `IDCheckioErrorCause` and sh
|
|
|
247
253
|
|
|
248
254
|
If you want to go deeper, you can also handle the `IDCheckioSubCause`, those are mainly that the user did something wrong, and we had to stop the session after X retries.
|
|
249
255
|
You can if you want handle those and show some specific messages for each or for the ones you want. (For example if the user refuses the permission, you can tell him that it is mandatory to create an account, ...)
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
### IDCheckTheme
|
|
253
|
-
When starting a single capture or an onboarding, you can provide an `IDCheckTheme` to customize the colors of the session.
|
|
254
|
-
The theme look like this :
|
|
255
|
-
```js
|
|
256
|
-
export class IDCheckTheme {
|
|
257
|
-
// Correspond to the primary color of the SDK, applied to buttons and images.
|
|
258
|
-
public primaryColor?: string | null;
|
|
259
|
-
// Correspond to the background color of all the presentation/informational views.
|
|
260
|
-
public foregroundColor?: string | null;
|
|
261
|
-
// Correspond to the color of the camera overlay.
|
|
262
|
-
public backgroundColor?: string | null;
|
|
263
|
-
// Correspond to the cropping mask border color.
|
|
264
|
-
public borderColor?: string | null;
|
|
265
|
-
// Not recommended to use it as by default the sdk will change the text color from white to black depending on the background it is on.
|
|
266
|
-
public textColor?: string | null;
|
|
267
|
-
// Not recommended to use it as by default the sdk will change the text color from white to black depending on the background it is on.
|
|
268
|
-
public titleColor?: string | null;
|
|
269
|
-
}
|
|
270
|
-
```
|
|
271
|
-
You need to provide the name of color (name of the resources for Android and name of the ColorAssets or iOS).
|
|
272
|
-
For example :
|
|
273
|
-
```js
|
|
274
|
-
new IDCheckTheme({ primaryColor: "blue", foregroundColor: "white", backgroundColor: "white", borderColor: "blue" })
|
|
275
|
-
```
|
|
276
|
-
|
|
277
|
-
|
package/android/build.gradle
CHANGED
|
@@ -8,7 +8,7 @@ buildscript {
|
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
dependencies {
|
|
11
|
-
classpath "com.android.tools.build:gradle:8.
|
|
11
|
+
classpath "com.android.tools.build:gradle:8.10.1"
|
|
12
12
|
// noinspection DifferentKotlinGradleVersion
|
|
13
13
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
|
14
14
|
}
|
|
@@ -105,7 +105,7 @@ dependencies {
|
|
|
105
105
|
//noinspection GradleDynamicVersion
|
|
106
106
|
implementation "com.facebook.react:react-native:+"
|
|
107
107
|
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
108
|
-
implementation('com.ariadnext.android.idcheckio:sdk:
|
|
108
|
+
implementation('com.ariadnext.android.idcheckio:sdk:9.1.0@aar') {
|
|
109
109
|
transitive = true
|
|
110
110
|
}
|
|
111
111
|
implementation 'androidx.appcompat:appcompat:1.7.0'
|
|
Binary file
|
|
@@ -2,33 +2,32 @@ package com.idnowreactidcheckio
|
|
|
2
2
|
|
|
3
3
|
import android.app.Activity
|
|
4
4
|
import android.content.Intent
|
|
5
|
-
import com.ariadnext.idcheckio.
|
|
6
|
-
import com.ariadnext.idcheckio.
|
|
7
|
-
import com.ariadnext.idcheckio.
|
|
8
|
-
import com.ariadnext.idcheckio.
|
|
9
|
-
import com.ariadnext.idcheckio.
|
|
10
|
-
import com.ariadnext.idcheckio.
|
|
11
|
-
import com.ariadnext.idcheckio.
|
|
12
|
-
import com.ariadnext.idcheckio.
|
|
13
|
-
import com.ariadnext.idcheckio.
|
|
14
|
-
import com.ariadnext.idcheckio.
|
|
15
|
-
import com.ariadnext.idcheckio.sdk.utils.extension.getSerializable
|
|
16
|
-
import com.ariadnext.idcheckio.sdk.utils.extension.toJson
|
|
5
|
+
import com.ariadnext.idcheckio.data.params.Framework
|
|
6
|
+
import com.ariadnext.idcheckio.domain.utils.extension.toJson
|
|
7
|
+
import com.ariadnext.idcheckio.external.Idcheckio
|
|
8
|
+
import com.ariadnext.idcheckio.external.error.ErrorMsg
|
|
9
|
+
import com.ariadnext.idcheckio.external.error.IdcheckioError
|
|
10
|
+
import com.ariadnext.idcheckio.external.error.IdcheckioErrorCause
|
|
11
|
+
import com.ariadnext.idcheckio.external.error.toErrorMsg
|
|
12
|
+
import com.ariadnext.idcheckio.external.result.activation.IdcheckioCallback
|
|
13
|
+
import com.ariadnext.idcheckio.external.result.onboarding.OnboardingResultCallback
|
|
14
|
+
import com.ariadnext.idcheckio.external.result.online.IdcheckioResult
|
|
17
15
|
import com.facebook.react.bridge.BaseActivityEventListener
|
|
18
16
|
import com.facebook.react.bridge.Promise
|
|
19
17
|
import com.facebook.react.bridge.ReactApplicationContext
|
|
20
18
|
import com.facebook.react.bridge.ReactContextBaseJavaModule
|
|
21
19
|
import com.facebook.react.bridge.ReactMethod
|
|
22
20
|
import com.facebook.react.bridge.ReadableMap
|
|
23
|
-
import com.idnowreactidcheckio.utils.Extension.filterNotNullValues
|
|
24
21
|
import com.idnowreactidcheckio.utils.Mapper
|
|
25
22
|
|
|
26
|
-
class
|
|
23
|
+
class IDCheckIOBridgeModule(private val reactContext: ReactApplicationContext) :
|
|
27
24
|
ReactContextBaseJavaModule(reactContext), IdcheckioCallback, OnboardingResultCallback {
|
|
28
25
|
/** Name of the module */
|
|
29
|
-
private val name = "
|
|
26
|
+
private val name = "IDCheckIOBridgeModule"
|
|
27
|
+
|
|
30
28
|
/*** Flag to retrieve activity result*/
|
|
31
29
|
private val startRequest = 9537152
|
|
30
|
+
|
|
32
31
|
/*** Keep the promise as we will need to send a response after the async call are done.*/
|
|
33
32
|
private var promise: Promise? = null
|
|
34
33
|
|
|
@@ -36,9 +35,9 @@ class IdnowReactIdcheckioModule(private val reactContext: ReactApplicationContex
|
|
|
36
35
|
reactContext.addActivityEventListener(object : BaseActivityEventListener() {
|
|
37
36
|
override fun onActivityResult(activity: Activity, requestCode: Int, resultCode: Int, data: Intent?) {
|
|
38
37
|
if (requestCode != startRequest) return
|
|
39
|
-
if(resultCode == Activity.RESULT_OK) {
|
|
38
|
+
if (resultCode == Activity.RESULT_OK) {
|
|
40
39
|
promise?.resolve(data?.extras?.getSerializable(Mapper.idcheckioResult) ?: IdcheckioResult())
|
|
41
|
-
} else if(resultCode == Activity.RESULT_CANCELED) {
|
|
40
|
+
} else if (resultCode == Activity.RESULT_CANCELED) {
|
|
42
41
|
promise?.reject(name, data?.extras?.getString(Mapper.errorMsg) ?: IdcheckioError.INTERNAL_ERROR.toErrorMsg().toJson())
|
|
43
42
|
}
|
|
44
43
|
}
|
|
@@ -52,8 +51,9 @@ class IdnowReactIdcheckioModule(private val reactContext: ReactApplicationContex
|
|
|
52
51
|
}
|
|
53
52
|
|
|
54
53
|
@ReactMethod
|
|
55
|
-
fun activate(token: String, extractData: Boolean, promise: Promise){
|
|
54
|
+
fun activate(token: String, extractData: Boolean, promise: Promise) {
|
|
56
55
|
this.promise = promise
|
|
56
|
+
Idcheckio.framework = Framework.REACT_NATIVE
|
|
57
57
|
Idcheckio.activate(token, reactContext, this, extractData)
|
|
58
58
|
}
|
|
59
59
|
|
|
@@ -71,12 +71,9 @@ class IdnowReactIdcheckioModule(private val reactContext: ReactApplicationContex
|
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
@ReactMethod
|
|
74
|
-
fun startOnboarding(folderUid: String,
|
|
74
|
+
fun startOnboarding(folderUid: String, promise: Promise) {
|
|
75
75
|
this.promise = promise
|
|
76
|
-
|
|
77
|
-
Mapper.getOnboardingCustomizationFromReadableMap(reactContext, theme.toHashMap().filterNotNullValues { it?.toString() })
|
|
78
|
-
} ?: OnboardingCustomization()
|
|
79
|
-
reactContext.currentActivity?.let { Idcheckio.startOnboarding(it, folderUid, this, onboardingCustomization) }
|
|
76
|
+
reactContext.currentActivity?.let { Idcheckio.startOnboarding(it, folderUid, this) }
|
|
80
77
|
}
|
|
81
78
|
|
|
82
79
|
/**
|
|
@@ -91,7 +88,7 @@ class IdnowReactIdcheckioModule(private val reactContext: ReactApplicationContex
|
|
|
91
88
|
}
|
|
92
89
|
|
|
93
90
|
@ReactMethod
|
|
94
|
-
fun
|
|
91
|
+
fun startSession(onlineContext: ReadableMap?, params: ReadableMap, promise: Promise) {
|
|
95
92
|
val activity = reactContext.currentActivity ?: run {
|
|
96
93
|
promise.reject(name, noContextError())
|
|
97
94
|
return
|
|
@@ -100,14 +97,15 @@ class IdnowReactIdcheckioModule(private val reactContext: ReactApplicationContex
|
|
|
100
97
|
val intent = Intent(activity, IdnowReactIdcheckioActivity::class.java).apply {
|
|
101
98
|
putExtra(Mapper.params, params.toHashMap())
|
|
102
99
|
onlineContext?.let { putExtra(Mapper.onlineContext, it.toHashMap().toString()) }
|
|
103
|
-
theme?.let { putExtra(Mapper.theme, it.toHashMap()) }
|
|
104
100
|
}
|
|
105
101
|
activity.startActivityForResult(intent, startRequest)
|
|
106
102
|
}
|
|
107
103
|
|
|
108
104
|
/** Return a json ErrorMsg with the no context error. */
|
|
109
|
-
private fun noContextError() = ErrorMsg(
|
|
110
|
-
|
|
105
|
+
private fun noContextError() = ErrorMsg(
|
|
106
|
+
cause = IdcheckioErrorCause.DEVICE_ERROR, details = IdcheckioError.CONTEXT_LOST.name,
|
|
107
|
+
message = "Fail to find a usable activity to start the sdk."
|
|
108
|
+
).toJson()
|
|
111
109
|
|
|
112
110
|
override fun getName(): String {
|
|
113
111
|
return name
|
|
@@ -1,20 +1,19 @@
|
|
|
1
1
|
package com.idnowreactidcheckio
|
|
2
2
|
|
|
3
|
-
import android.R.attr
|
|
4
3
|
import android.annotation.SuppressLint
|
|
5
4
|
import android.content.Intent
|
|
6
5
|
import android.os.Bundle
|
|
7
6
|
import android.view.Window
|
|
7
|
+
import androidx.fragment.app.Fragment
|
|
8
8
|
import androidx.fragment.app.FragmentActivity
|
|
9
|
-
import com.ariadnext.idcheckio.
|
|
10
|
-
import com.ariadnext.idcheckio.
|
|
11
|
-
import com.ariadnext.idcheckio.
|
|
12
|
-
import com.ariadnext.idcheckio.
|
|
13
|
-
import com.ariadnext.idcheckio.
|
|
14
|
-
import com.ariadnext.idcheckio.
|
|
15
|
-
import com.ariadnext.idcheckio.
|
|
16
|
-
import com.ariadnext.idcheckio.
|
|
17
|
-
import com.idnowreactidcheckio.utils.Extension.filterNotNullValues
|
|
9
|
+
import com.ariadnext.idcheckio.domain.utils.extension.toJson
|
|
10
|
+
import com.ariadnext.idcheckio.external.error.ErrorMsg
|
|
11
|
+
import com.ariadnext.idcheckio.external.error.IdcheckioError
|
|
12
|
+
import com.ariadnext.idcheckio.external.error.toErrorMsg
|
|
13
|
+
import com.ariadnext.idcheckio.external.params.OnlineContext
|
|
14
|
+
import com.ariadnext.idcheckio.external.result.online.IdcheckioInteraction
|
|
15
|
+
import com.ariadnext.idcheckio.external.result.online.IdcheckioInteractionInterface
|
|
16
|
+
import com.ariadnext.idcheckio.external.result.online.IdcheckioResult
|
|
18
17
|
import com.idnowreactidcheckio.utils.Mapper
|
|
19
18
|
|
|
20
19
|
|
|
@@ -27,15 +26,15 @@ class IdnowReactIdcheckioActivity : FragmentActivity(), IdcheckioInteractionInte
|
|
|
27
26
|
setContentView(R.layout.activity_idnow_react_idcheckio)
|
|
28
27
|
val params = intent.extras?.getSerializable(Mapper.params) as? HashMap<String, Any?>
|
|
29
28
|
val onlineContext = intent.extras?.getString(Mapper.onlineContext)
|
|
30
|
-
val theme = intent.extras?.getSerializable(Mapper.theme) as? HashMap<String, Any?> ?: HashMap()
|
|
31
29
|
|
|
32
30
|
Mapper.getIdcheckioViewFromParams(params)
|
|
33
|
-
.
|
|
31
|
+
.also { builder ->
|
|
32
|
+
onlineContext?.let { json -> OnlineContext.createFrom(json) }?.let { builder.onlineContext(it) }
|
|
33
|
+
}
|
|
34
34
|
.listener(this)
|
|
35
35
|
.build()
|
|
36
36
|
.also {
|
|
37
|
-
supportFragmentManager.beginTransaction().replace(R.id.idnow_react_idcheckio_container, it).commit()
|
|
38
|
-
it.startOnline(onlineContext?.let { json -> OnlineContext.Companion.createFrom(json) })
|
|
37
|
+
supportFragmentManager.beginTransaction().replace(R.id.idnow_react_idcheckio_container, it as Fragment).commit()
|
|
39
38
|
}
|
|
40
39
|
}
|
|
41
40
|
|
|
@@ -54,6 +53,7 @@ class IdnowReactIdcheckioActivity : FragmentActivity(), IdcheckioInteractionInte
|
|
|
54
53
|
}
|
|
55
54
|
finish()
|
|
56
55
|
}
|
|
56
|
+
|
|
57
57
|
IdcheckioInteraction.ERROR -> {
|
|
58
58
|
Intent().apply {
|
|
59
59
|
putExtra(Mapper.errorMsg, (data as ErrorMsg).toJson())
|
|
@@ -61,7 +61,9 @@ class IdnowReactIdcheckioActivity : FragmentActivity(), IdcheckioInteractionInte
|
|
|
61
61
|
}
|
|
62
62
|
finish()
|
|
63
63
|
}
|
|
64
|
-
|
|
64
|
+
|
|
65
|
+
else -> { /* Do nothing */
|
|
66
|
+
}
|
|
65
67
|
}
|
|
66
68
|
}
|
|
67
69
|
}
|
|
@@ -8,7 +8,7 @@ import com.facebook.react.uimanager.ViewManager
|
|
|
8
8
|
|
|
9
9
|
class IdnowReactIdcheckioPackage : ReactPackage {
|
|
10
10
|
override fun createNativeModules(reactContext: ReactApplicationContext): List<NativeModule> {
|
|
11
|
-
return listOf(
|
|
11
|
+
return listOf(IDCheckIOBridgeModule(reactContext))
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
override fun createViewManagers(reactContext: ReactApplicationContext): List<ViewManager<*, *>> {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
package com.idnowreactidcheckio.bean
|
|
2
2
|
|
|
3
|
-
import com.ariadnext.idcheckio.
|
|
4
|
-
import com.ariadnext.idcheckio.
|
|
5
|
-
import com.ariadnext.idcheckio.
|
|
3
|
+
import com.ariadnext.idcheckio.external.params.DataRequirement
|
|
4
|
+
import com.ariadnext.idcheckio.external.params.Extraction
|
|
5
|
+
import com.ariadnext.idcheckio.external.params.FaceDetection
|
|
6
6
|
|
|
7
7
|
internal data class ExtractionReact(
|
|
8
8
|
var codeline: DataRequirement? = null,
|
|
9
|
-
var face: FaceDetection? = null
|
|
9
|
+
var face: FaceDetection? = null,
|
|
10
10
|
) {
|
|
11
11
|
/**
|
|
12
12
|
* Map to an [Extraction] used by the sdk.
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
package com.idnowreactidcheckio.bean
|
|
2
2
|
|
|
3
|
-
import com.ariadnext.idcheckio.
|
|
3
|
+
import com.ariadnext.idcheckio.external.params.IntegrityCheck
|
|
4
4
|
|
|
5
5
|
internal data class IntegrityCheckReact(
|
|
6
6
|
var readEmrtd: Boolean? = null,
|
|
7
|
-
var docLiveness: Boolean? = null
|
|
7
|
+
var docLiveness: Boolean? = null,
|
|
8
8
|
) {
|
|
9
9
|
/**
|
|
10
10
|
* Map to an [IntegrityCheck] used by the sdk.
|
|
@@ -2,75 +2,40 @@ package com.idnowreactidcheckio.utils
|
|
|
2
2
|
|
|
3
3
|
import android.annotation.SuppressLint
|
|
4
4
|
import android.content.Context
|
|
5
|
-
import com.ariadnext.idcheckio.
|
|
6
|
-
import com.ariadnext.idcheckio.
|
|
7
|
-
import com.ariadnext.idcheckio.
|
|
8
|
-
import com.ariadnext.idcheckio.
|
|
9
|
-
import com.ariadnext.idcheckio.
|
|
10
|
-
import com.ariadnext.idcheckio.
|
|
11
|
-
import com.ariadnext.idcheckio.
|
|
12
|
-
import com.ariadnext.idcheckio.
|
|
13
|
-
import com.ariadnext.idcheckio.
|
|
14
|
-
import com.ariadnext.idcheckio.
|
|
15
|
-
import com.ariadnext.idcheckio.
|
|
16
|
-
import com.ariadnext.idcheckio.
|
|
17
|
-
import com.ariadnext.idcheckio.
|
|
18
|
-
import com.ariadnext.idcheckio.sdk.component.IdcheckioView
|
|
19
|
-
import com.ariadnext.idcheckio.sdk.interfaces.cis.CISType
|
|
20
|
-
import com.facebook.react.bridge.ReactContext
|
|
5
|
+
import com.ariadnext.idcheckio.external.IdcheckioView
|
|
6
|
+
import com.ariadnext.idcheckio.external.params.CISType
|
|
7
|
+
import com.ariadnext.idcheckio.external.params.CaptureMode
|
|
8
|
+
import com.ariadnext.idcheckio.external.params.ConfirmationType
|
|
9
|
+
import com.ariadnext.idcheckio.external.params.DataRequirement
|
|
10
|
+
import com.ariadnext.idcheckio.external.params.DocumentType
|
|
11
|
+
import com.ariadnext.idcheckio.external.params.Extraction
|
|
12
|
+
import com.ariadnext.idcheckio.external.params.FaceDetection
|
|
13
|
+
import com.ariadnext.idcheckio.external.params.FileSize
|
|
14
|
+
import com.ariadnext.idcheckio.external.params.IntegrityCheck
|
|
15
|
+
import com.ariadnext.idcheckio.external.params.Language
|
|
16
|
+
import com.ariadnext.idcheckio.external.params.OnlineConfig
|
|
17
|
+
import com.ariadnext.idcheckio.external.params.Orientation
|
|
21
18
|
import com.idnowreactidcheckio.bean.ExtractionEnum
|
|
22
19
|
import com.idnowreactidcheckio.bean.ExtractionReact
|
|
23
20
|
import com.idnowreactidcheckio.bean.IntegrityCheckEnum
|
|
24
21
|
import com.idnowreactidcheckio.bean.IntegrityCheckReact
|
|
25
22
|
import com.idnowreactidcheckio.bean.OnlineConfigEnum
|
|
26
23
|
import com.idnowreactidcheckio.bean.ParamsEnum
|
|
27
|
-
import com.idnowreactidcheckio.bean.Theme
|
|
28
|
-
import com.idnowreactidcheckio.bean.ThemeEnum
|
|
29
24
|
import com.idnowreactidcheckio.utils.Extension.filterNotNullValues
|
|
30
25
|
|
|
31
26
|
internal object Mapper {
|
|
32
27
|
/** Key to send/retrieve params on a Bundle */
|
|
33
28
|
const val params = "params"
|
|
34
|
-
|
|
35
|
-
const val theme = "theme"
|
|
29
|
+
|
|
36
30
|
/** Key to send/retrieve online context on a Bundle */
|
|
37
31
|
const val onlineContext = "onlineContext"
|
|
32
|
+
|
|
38
33
|
/** Key to send/retrieve result on a Bundle */
|
|
39
34
|
const val idcheckioResult = "idcheckioResult"
|
|
35
|
+
|
|
40
36
|
/** Key to send/retrieve error on a Bundle */
|
|
41
37
|
const val errorMsg = "errorMsg"
|
|
42
38
|
|
|
43
|
-
/**
|
|
44
|
-
* Retrieve an [OnboardingCustomization] from a Map.
|
|
45
|
-
* @param cont the context to get the resources.
|
|
46
|
-
* @param map the map containing all the colors.
|
|
47
|
-
* @return the onboardingCustomization to apply.
|
|
48
|
-
*/
|
|
49
|
-
fun getOnboardingCustomizationFromReadableMap(cont: ReactContext, map: Map<String, String>): OnboardingCustomization {
|
|
50
|
-
return OnboardingCustomization(theme = getDayNightThemeFromReadableMap(cont.applicationContext, map))
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Retrieve a [DayNightTheme] from a Map.
|
|
55
|
-
* @param cont the context to get the resources.
|
|
56
|
-
* @param map the map containing all the colors.
|
|
57
|
-
* @return the dayNightTheme to apply.
|
|
58
|
-
*/
|
|
59
|
-
fun getDayNightThemeFromReadableMap(cont: Context, map: Map<String, String>): DayNightTheme {
|
|
60
|
-
return Theme().apply {
|
|
61
|
-
map.entries.forEach {
|
|
62
|
-
when(it.key) {
|
|
63
|
-
ThemeEnum.PRIMARY_COLOR.jsonValue -> primaryColor = getResFromName(cont, it.value)
|
|
64
|
-
ThemeEnum.BACKGROUND_COLOR.jsonValue -> backgroundColor = getResFromName(cont, it.value)
|
|
65
|
-
ThemeEnum.FOREGROUND_COLOR.jsonValue -> foregroundColor = getResFromName(cont, it.value)
|
|
66
|
-
ThemeEnum.BORDER_COLOR.jsonValue -> borderColor = getResFromName(cont, it.value)
|
|
67
|
-
ThemeEnum.TEXT_COLOR.jsonValue -> textColor = getResFromName(cont, it.value)
|
|
68
|
-
ThemeEnum.TITLE_COLOR.jsonValue -> titleColor = getResFromName(cont, it.value)
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
}.toDayNightTheme()
|
|
72
|
-
}
|
|
73
|
-
|
|
74
39
|
@SuppressLint("DiscouragedApi") // Suppressed as it is the only way for us to do this.
|
|
75
40
|
/**
|
|
76
41
|
* Retrieve a resource for any package by it's identifier name.
|
|
@@ -78,7 +43,7 @@ internal object Mapper {
|
|
|
78
43
|
* @param identifier name of a resources.
|
|
79
44
|
* @return the resources if found or null if not.
|
|
80
45
|
*/
|
|
81
|
-
private fun getResFromName(cont: Context, identifier: String): Int?{
|
|
46
|
+
private fun getResFromName(cont: Context, identifier: String): Int? {
|
|
82
47
|
return cont.resources.getIdentifier(identifier, "color", cont.packageName).takeIf { it != 0 }
|
|
83
48
|
}
|
|
84
49
|
|
|
@@ -126,7 +91,6 @@ internal object Mapper {
|
|
|
126
91
|
ParamsEnum.adjustCrop -> adjustCrop(value.toString().toBoolean())
|
|
127
92
|
ParamsEnum.confirmAbort -> confirmAbort(value.toString().toBoolean())
|
|
128
93
|
ParamsEnum.captureMode -> captureMode(CaptureMode.valueOf(value.toString()))
|
|
129
|
-
ParamsEnum.overrideWordings -> overrideWordings(value as Map<String, String>)
|
|
130
94
|
}
|
|
131
95
|
}
|
|
132
96
|
}
|
package/app.plugin.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const { withPlugins } = require('@expo/config-plugins');
|
|
2
|
+
const addSPMDependency = require('./plugins/addSPMDependency');
|
|
3
|
+
const copyNativeFiles = require('./plugins/copyNativeFiles');
|
|
4
|
+
|
|
5
|
+
const withIDCheckIO = (config, options = {}) => {
|
|
6
|
+
const {
|
|
7
|
+
version = '9.1.0',
|
|
8
|
+
repositoryUrl = 'https://git-externe.rennes.ariadnext.com/idcheckio/idcheckiosdk-release-ios',
|
|
9
|
+
repoName = 'idcheckiosdk-release-ios',
|
|
10
|
+
productName = 'IDCheckIOSDK',
|
|
11
|
+
} = options;
|
|
12
|
+
|
|
13
|
+
return withPlugins(config, [
|
|
14
|
+
[addSPMDependency, { version, repositoryUrl, repoName, productName }],
|
|
15
|
+
copyNativeFiles,
|
|
16
|
+
]);
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
module.exports = withIDCheckIO;
|
|
@@ -13,31 +13,12 @@ Pod::Spec.new do |s|
|
|
|
13
13
|
|
|
14
14
|
s.platform = :ios, "12.0"
|
|
15
15
|
s.source = { :path => "." }
|
|
16
|
-
s.source_files = "ios/**/*.{h,m,mm,swift}"
|
|
17
16
|
s.swift_version = "5.7"
|
|
18
17
|
|
|
19
|
-
|
|
18
|
+
# Swift/Objective-C compatibility
|
|
19
|
+
s.pod_target_xcconfig = {
|
|
20
|
+
"DEFINES_MODULE" => "YES",
|
|
21
|
+
}
|
|
20
22
|
|
|
21
|
-
|
|
22
|
-
# See https://github.com/facebook/react-native/blob/febf6b7f33fdb4904669f99d795eba4c0f95d7bf/scripts/cocoapods/new_architecture.rb#L79.
|
|
23
|
-
if respond_to?(:install_modules_dependencies, true)
|
|
24
|
-
install_modules_dependencies(s)
|
|
25
|
-
else
|
|
26
|
-
s.dependency "React-Core"
|
|
27
|
-
|
|
28
|
-
# Don't install the dependencies when we run `pod install` in the old architecture.
|
|
29
|
-
if ENV["RCT_NEW_ARCH_ENABLED"] == "1"
|
|
30
|
-
s.compiler_flags = folly_compiler_flags + " -DRCT_NEW_ARCH_ENABLED=1"
|
|
31
|
-
s.pod_target_xcconfig = {
|
|
32
|
-
"HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\"",
|
|
33
|
-
"OTHER_CPLUSPLUSFLAGS" => "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1",
|
|
34
|
-
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17",
|
|
35
|
-
}
|
|
36
|
-
s.dependency "React-Codegen"
|
|
37
|
-
s.dependency "RCT-Folly"
|
|
38
|
-
s.dependency "RCTRequired"
|
|
39
|
-
s.dependency "RCTTypeSafety"
|
|
40
|
-
s.dependency "ReactCommon/turbomodule/core"
|
|
41
|
-
end
|
|
42
|
-
end
|
|
23
|
+
s.source_files = ""
|
|
43
24
|
end
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
#import <React/RCTBridgeModule.h>
|
|
2
|
+
|
|
3
|
+
@interface RCT_EXTERN_MODULE(IDCheckIOBridgeModule, NSObject)
|
|
4
|
+
|
|
5
|
+
RCT_EXTERN_METHOD(
|
|
6
|
+
preload:(BOOL)extractData
|
|
7
|
+
)
|
|
8
|
+
|
|
9
|
+
RCT_EXTERN_METHOD(
|
|
10
|
+
activate: (NSString *)token
|
|
11
|
+
extractData: (BOOL) extractData
|
|
12
|
+
resolver: (RCTPromiseResolveBlock) resolve
|
|
13
|
+
rejecter: (RCTPromiseRejectBlock)reject
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
RCT_EXTERN_METHOD(
|
|
17
|
+
startOnboarding: (NSString *)folderUid
|
|
18
|
+
resolver: (RCTPromiseResolveBlock) resolve
|
|
19
|
+
rejecter: (RCTPromiseRejectBlock)reject
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
RCT_EXTERN_METHOD(
|
|
23
|
+
startSession: (NSDictionary *)onlineContext
|
|
24
|
+
params: (NSDictionary *)params
|
|
25
|
+
resolver: (RCTPromiseResolveBlock) resolve
|
|
26
|
+
rejecter: (RCTPromiseRejectBlock)reject
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
@end
|