@idnow/react-idcheckio 7.2.2 → 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.
Files changed (56) hide show
  1. package/.editorconfig +15 -0
  2. package/.gitattributes +2 -0
  3. package/README.md +236 -193
  4. package/android/build.gradle +95 -37
  5. package/android/gradle.properties +5 -0
  6. package/android/src/main/AndroidManifest.xml +5 -4
  7. package/android/src/main/AndroidManifestNew.xml +9 -0
  8. package/android/src/main/java/com/idnowreactidcheckio/IdnowReactIdcheckioActivity.kt +67 -0
  9. package/android/src/main/java/com/idnowreactidcheckio/IdnowReactIdcheckioModule.kt +115 -0
  10. package/android/src/main/java/com/idnowreactidcheckio/IdnowReactIdcheckioPackage.kt +17 -0
  11. package/android/src/main/java/com/idnowreactidcheckio/bean/ExtractionEnum.kt +6 -0
  12. package/android/src/main/java/com/idnowreactidcheckio/bean/ExtractionReact.kt +20 -0
  13. package/android/src/main/java/com/idnowreactidcheckio/bean/IntegrityCheckEnum.kt +6 -0
  14. package/android/src/main/java/com/idnowreactidcheckio/bean/IntegrityCheckReact.kt +18 -0
  15. package/android/src/main/java/com/idnowreactidcheckio/bean/OnlineConfigEnum.kt +9 -0
  16. package/android/src/main/java/com/idnowreactidcheckio/bean/ParamsEnum.kt +19 -0
  17. package/android/src/main/java/com/idnowreactidcheckio/bean/Theme.kt +29 -0
  18. package/android/src/main/java/com/idnowreactidcheckio/bean/ThemeEnum.kt +13 -0
  19. package/android/src/main/java/com/idnowreactidcheckio/utils/Extension.kt +20 -0
  20. package/android/src/main/java/com/idnowreactidcheckio/utils/Mapper.kt +178 -0
  21. package/android/src/main/res/layout/activity_idnow_react_idcheckio.xml +9 -0
  22. package/idnow-react-idcheckio.podspec +43 -0
  23. package/ios/IdnowReactIdcheckio-Bridging-Header.h +2 -0
  24. package/ios/IdnowReactIdcheckio.mm +29 -0
  25. package/ios/IdnowReactIdcheckio.swift +131 -0
  26. package/ios/Models/ExtractionEnum.swift +13 -0
  27. package/ios/Models/ExtractionReact.swift +23 -0
  28. package/ios/Models/IntegrityCheckEnum.swift +13 -0
  29. package/ios/Models/IntegrityCheckReact.swift +24 -0
  30. package/ios/Models/OnlineConfigEnum.swift +16 -0
  31. package/ios/Models/ParamsEnum.swift +26 -0
  32. package/ios/Models/ThemeEnum.swift +20 -0
  33. package/ios/Models/ThemeReact.swift +32 -0
  34. package/ios/Utils/Mapper.swift +139 -0
  35. package/package.json +14 -11
  36. package/release-public.sh +4 -4
  37. package/src/index.d.ts +259 -0
  38. package/src/index.js +270 -0
  39. package/tsconfig.json +12 -0
  40. package/ReactIdcheckio.podspec +0 -15
  41. package/android/.project +0 -17
  42. package/android/.settings/org.eclipse.buildship.core.prefs +0 -13
  43. package/android/src/main/java/com/ariadnext/idcheckio/IdcheckioActivity.java +0 -133
  44. package/android/src/main/java/com/ariadnext/idcheckio/IdcheckioConst.java +0 -39
  45. package/android/src/main/java/com/ariadnext/idcheckio/IdcheckioModule.java +0 -189
  46. package/android/src/main/java/com/ariadnext/idcheckio/IdcheckioPackage.java +0 -22
  47. package/android/src/main/java/com/ariadnext/idcheckio/ParameterUtils.java +0 -251
  48. package/idcheckio_params.js +0 -343
  49. package/index.js +0 -6
  50. package/ios/Idcheckio.h +0 -11
  51. package/ios/Idcheckio.m +0 -301
  52. package/ios/Idcheckio.xcodeproj/project.pbxproj +0 -340
  53. package/ios/Idcheckio.xcworkspace/contents.xcworkspacedata +0 -10
  54. package/ios/Idcheckio.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
  55. package/ios/IdcheckioKeys.h +0 -49
  56. package/ios/IdcheckioSdk+Utils.swift +0 -35
package/.editorconfig ADDED
@@ -0,0 +1,15 @@
1
+ # EditorConfig helps developers define and maintain consistent
2
+ # coding styles between different editors and IDEs
3
+ # editorconfig.org
4
+
5
+ root = true
6
+
7
+ [*]
8
+
9
+ indent_style = space
10
+ indent_size = 2
11
+
12
+ end_of_line = lf
13
+ charset = utf-8
14
+ trim_trailing_whitespace = true
15
+ insert_final_newline = true
package/.gitattributes CHANGED
@@ -1 +1,3 @@
1
1
  *.pbxproj -text
2
+ # specific for windows script files
3
+ *.bat text eol=crlf
package/README.md CHANGED
@@ -2,233 +2,276 @@
2
2
 
3
3
  ## Getting started
4
4
 
5
- #### Local setup for react-idcheckio
6
- See [GitHub documentation](https://github.com/ariadnext/React-Native-SmartSDK/tree/master/react-idcheckio#getting-started) for setting up the local library.
7
-
8
5
  ### Install from NPM
9
- ```
6
+ ```sh
10
7
  // with npm
11
- npm install react-idcheckio
8
+ npm install @idnow/react-idcheckio
12
9
 
13
10
  // with yarn
14
- yarn add react-idcheckio
11
+ yarn add @idnow/react-idcheckio
15
12
  ```
16
13
 
17
- ## Platform specific configuration
18
-
19
- #### iOS
14
+ ## Usage
20
15
 
21
- 1. In your project folder, go to your ios directory and open the Podfile :
22
- - Change the minimum version to at least '10.0'
23
- - Add the following lines before the target :
24
- ```
25
- source 'https://github.com/CocoaPods/Specs.git'
26
- source 'https://git-externe.rennes.ariadnext.com/idcheckio/axt-podspecs.git'
27
- ```
28
- - Add `use_frameworks!` before the `use_native_modules!`
16
+ You will have access to four methods to communicate with the sdk.
29
17
 
30
- 2. Retrieve the sdk using `pod install --repo-update`
31
- - ⚠️⚠️   You will need to have a .netrc file configurated with our credentials. Check the official documentation for more informations.  ⚠️⚠️
18
+ ```js
19
+ /**
20
+ * Preload the native models of the sdk.
21
+ *
22
+ * @param extractData - A boolean indicating whether to use extract data. True by default.
23
+ * @returns Void on success.
24
+ */
25
+ export function preload(extractData: boolean): void;
32
26
 
33
- 3. In your project, open the `*.plist` file and the two following entries :
34
- - "Privacy - Camera Usage Description" : "Camera is being used to scan documents"
27
+ /**
28
+ * Activates the sdk with the given token.
29
+ *
30
+ * @param token - The token string used for activation.
31
+ * @param extractData - A boolean indicating whether to use extract data. True by default.
32
+ * @returns Void on success.
33
+ * @throws An error of type {@link IDCheckioError} if the activation fails.
34
+ */
35
+ export function activate(token: string, extractData: boolean): Promise<void>;
35
36
 
36
- #### Android
37
+ /**
38
+ * Start an onboarding session with the given folder uid.
39
+ *
40
+ * @param folderUid - The folder that will be used to run the session.
41
+ * @param theme - A theme to customize SDK colors.
42
+ * @returns Void on success.
43
+ * @throws An error of type {@link IDCheckioError} if the session fails.
44
+ */
45
+ export function startOnboarding(folderUid: string, theme: IDCheckTheme | null): Promise<void>;
37
46
 
38
- 1. Insert the following lines inside the dependencies block in `android/app/build.gradle`:
39
- ```groovy
40
- implementation 'androidx.multidex:multidex:2.0.1'
47
+ /**
48
+ * Start the capture of one document with the given parameters.
49
+ *
50
+ * @param parameters - The parameters to configure the capture session.
51
+ * @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
+ * @returns {@link IDCheckioResult}
54
+ * @throws An error of type {@link IDCheckioError} if the capture fails.
55
+ */
56
+ export function start(parameters: IDCheckioParams, onlineContext: IDCheckioOnlineContext | null, theme: IDCheckTheme | null): Promise<IDCheckioResult>;
41
57
  ```
42
- - In the `android.defaultConfig` block, add the line `multiDexEnabled true`
43
- - In the `android` block, add the following lines :
44
- ```groovy
45
- packagingOptions {
46
- pickFirst '**/armeabi-v7a/libc++_shared.so'
47
- pickFirst '**/x86/libc++_shared.so'
48
- pickFirst '**/arm64-v8a/libc++_shared.so'
49
- pickFirst '**/x86_64/libc++_shared.so'
50
- pickFirst '**/x86/libjsc.so'
51
- pickFirst '**/armeabi-v7a/libjsc.so'
52
- pickFirst 'META-INF/DEPENDENCIES'
53
- pickFirst 'META-INF/notice.txt'
54
- pickFirst 'META-INF/license.txt'
55
- }
58
+ ### Preload
59
+ The `preload` is completely optional and will preload the embedded model of the sdk, this way the `activate` will be faster afterwards.
60
+ You don't to wait for a result, there is no result expected.
61
+ ```js
62
+ import { preload } from '@idnow/react-idcheckio';
63
+
64
+ const preloadSdk = preload(true);
56
65
  ```
57
66
 
58
- 2. Add a new maven repository to retrieve the sdk from our nexus. If you have in your main `build.gradle` an `allprojects{}` block containing your repositories, add the following lines in it else add them in the plugin's `build.gradle` :
59
- ```groovy
60
- maven {
61
- credentials {
62
- username = "$YOUR_USERNAME"
63
- password = "$YOUR_PASSWORD"
67
+ ### Activate
68
+ The `activate` is a mandatory call that need to be done once before starting any session. The token is unique and will be provided by our CS team, contact them at csm@idnow.io if needed.
69
+ On a success, no result is expected, on error you will receive an `IDCheckioError`, check the error section for more information.
70
+ ```js
71
+ import { activate } from '@idnow/react-idcheckio';
72
+
73
+ const activateSdk = async () => {
74
+ activate('YOUR_ACTIVATION_TOKEN', true).then(
75
+ () => {
76
+ setIsSdkActivated(true);
77
+ },
78
+ (error) => {
79
+ handleError(error.message);
64
80
  }
65
- url "https://repoman.rennes.ariadnext.com/content/repositories/com.ariadnext.idcheckio/"
66
- }
81
+ );
82
+ };
67
83
  ```
68
84
 
69
- ## Usage
85
+ ### Start an onboarding (recommended)
86
+ The onboarding mode is the recommended mode to start the sdk as it simplify a lot the integration and improve the UX.
87
+ To start it you need to call the `startOnboarding` with a CIS folderUid, if the folder already exists, every captured document will be pushed into it. And if the folderUid does not exist it will be created.
70
88
 
71
- 1. Create a file `IdcheckioModule.js` and copy the following lines :
72
- ```javascript
73
- 'use strict';
74
- import { NativeModules } from 'react-native';
75
- module.exports = NativeModules.IdcheckioModule;
76
- ```
89
+ 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
+
91
+ You can also provide an `IDCheckTheme` to customize the colors of the sdk, check the associated section for more information.
92
+
93
+ No result is expected, you will also receive an `IDCheckioError` if something happens during the session.
94
+ ```js
95
+ import { startOnboarding } from '@idnow/react-idcheckio';
77
96
 
78
- 2. Open your `index.js` or any other files where you want to use the IdcheckioModule and add `import IdcheckioModule from './IdcheckioModule';` to the imports at the top of the file.
79
-
80
- 3. (Optional) Before starting, the sdk will ask for permissions (`CAMERA`). But you can if you want ask them by youself before using the following method :
81
- ```javascript
82
- async requestPermissions() {
83
- try {
84
- const granted = await PermissionsAndroid.requestMultiple(
85
- [PermissionsAndroid.PERMISSIONS.CAMERA]
86
- )
87
- if (granted[PermissionsAndroid.PERMISSIONS.CAMERA] === PermissionsAndroid.RESULTS.GRANTED) {} else {
88
- console.log("Permission denied")
89
- }
90
- } catch (err) {
91
- console.warn(err);
97
+ const startCapture = async () => {
98
+ let theme = new IDCheckTheme({});
99
+ startOnboarding(generateUUID(), theme).then(
100
+ () => {
101
+ Alert.alert('Success', 'Onboarding ended successfully.');
102
+ },
103
+ (error) => {
104
+ handleError(error.message);
92
105
  }
93
- }
106
+ );
107
+ };
94
108
  ```
95
109
 
96
- 4. Before doing any call to the sdk, you can use the `preload()` method. It will accelerate the future call the to the capture process. You won't receive any callback when calling this method.
97
- ```javascript
98
- preload() {
99
- IdcheckioModule.preload(true);
100
- }
101
- ```
110
+ ### Start a capture session
111
+ The start mode is a single capture of a document that can be configured directly in the code.
112
+ 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
+
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` and an optional `IDCheckTheme`.
102
115
 
103
- 5. Before capturing any document, you need to activate the sdk. To do so, add your activation token on the javascript side and use it to call the `activate()` method.
104
- ```javascript
105
- activate() {
106
- IdcheckioModule.activate(demoToken, true)
107
- .then(data => {
108
- this.setState({sdkActivated: true})
109
- console.log("Activated");
116
+ The result is an `IDCheckioResult` that will only contain an `IDCheckioOnlineContext`. I will explain more about this `IDCheckioOnlineContext` in the dedicated section.
117
+ Like others calls, you will also receive an `IDCheckioError` if something happens during the session.
118
+ ```js
119
+ import { useState } from 'react';
120
+ import { start } from '@idnow/react-idcheckio';
121
+
122
+ const [onlineContext, setOnlineContext] = useState<IDCheckioOnlineContext | null>(null);
123
+
124
+ const startCapture = async () => {
125
+ let theme = new IDCheckTheme({});
126
+ let params = new IDCheckioParamsBuilder().build();
127
+ start(params, onlineContext, theme).then(
128
+ (result) => {
129
+ setOnlineContext(result.onlineContext);
130
+ Alert.alert('Success', 'Capture ended successfully.');
110
131
  },
111
- cause => {
112
- this.showError(cause);
113
- })
114
- .catch(err => {
115
- console.log(err);
116
- });
117
- }
132
+ (error) => {
133
+ handleError(error.message);
134
+ }
135
+ );
136
+ };
118
137
  ```
119
138
 
120
- 6. To start the capture of a document, you have to call the start method with your wanted parameters. Check the `Dictionnary.js` file to find some recommandations on the parameters. You will then receive the result in a string that can be parse into a json object.
121
- ```javascript
122
- export const paramsIDOffline = new IDCheckioParamsBuilder()
123
- .setDocType(DocumentType.ID)
124
- .setOrientation(IDCheckioOrientation.PORTRAIT)
125
- .setUseHd(false)
126
- .setConfirmationType(ConfirmationType.DATA_OR_PICTURE)
127
- .setScanBothSides(ScanBothSides.ENABLED)
128
- .setSideOneExtraction(new Extraction(Codeline.VALID, FaceDetection.ENABLED))
129
- .setSideTwoExtraction(new Extraction(Codeline.REJECT, FaceDetection.DISABLED))
130
- .setLanguage(Language.fr)
131
- .setManualButtonTimer(10)
132
- .setMaxPictureFilesize(FileSize.TWO_MEGA_BYTES)
133
- .setFeedbackLevel(FeedbackLevel.ALL)
134
- .setAdjustCrop(false)
135
- .setConfirmAbort(false)
136
- .build()
137
-
138
- IdcheckioModule.start(Dictionnary.paramsIDOffline)
139
- .then(data => {
140
- results = JSON.parse(data);
141
- this.response_server(results);
142
- },
143
- cause => {
144
- this.showError(cause);
145
- })
146
- .catch(err => {
147
- console.log(err);
148
- });
149
- ```
139
+ #### Recommended parameters for each document type
140
+
141
+ Here is a list of the best practice we recommend for each document.
142
+ ```js
143
+ const id = new IDCheckioParamsBuilder()
144
+ .setDocType(DocumentType.ID)
145
+ .setOrientation(IDCheckioOrientation.PORTRAIT)
146
+ .setIntegrityCheck(new IntegrityCheck({ readEmrtd: false, docLiveness: false }))
147
+ .setOnlineConfig(new OnlineConfig({ isReferenceDocument: true }))
148
+ .build()
149
+
150
+ const liveness = new IDCheckioParamsBuilder()
151
+ .setDocType(DocumentType.LIVENESS)
152
+ .setOrientation(IDCheckioOrientation.PORTRAIT)
153
+ .setConfirmAbort(true)
154
+ .build()
155
+
156
+ const frenchHealthCard = new IDCheckioParamsBuilder()
157
+ .setDocType(DocumentType.FRENCH_HEALTH_CARD)
158
+ .setConfirmationType(ConfirmationType.DATA_OR_PICTURE)
159
+ .setOrientation(IDCheckioOrientation.PORTRAIT)
160
+ .build()
161
+
162
+ const selfie = new IDCheckioParamsBuilder()
163
+ .setDocType(DocumentType.SELFIE)
164
+ .setConfirmationType(ConfirmationType.DATA_OR_PICTURE)
165
+ .setOrientation(IDCheckioOrientation.PORTRAIT)
166
+ .build()
167
+
168
+ const addressProof = new IDCheckioParamsBuilder()
169
+ .setDocType(DocumentType.A4)
170
+ .setConfirmationType(ConfirmationType.DATA_OR_PICTURE)
171
+ .setOrientation(IDCheckioOrientation.PORTRAIT)
172
+ .setUseHd(true)
173
+ .setOnlineConfig(new OnlineConfig({ cisType: CISType.ADDRESS_PROOF }))
174
+ .build()
150
175
 
151
- 7. To start an online capture of a document, you have the method the `startOnline()` method. You will receive the result in a string that can be parse into a json object.
152
- ```javascript
153
- export const paramsLiveness = new IDCheckioParamsBuilder()
154
- .setDocType(DocumentType.LIVENESS)
155
- .setOrientation(IDCheckioOrientation.PORTRAIT)
156
- .setConfirmAbort(true)
157
- .build()
158
-
159
- IdcheckioModule.startOnline(paramsLiveness, onlineContext)
160
- .then(data => {
161
- console.log(data);
162
- let results = JSON.parse(data)
163
- this.response_server(results);
164
- },
165
- cause => {
166
- this.showError(cause);
167
- })
168
- .catch(err => {
169
- console.log(err);
170
- });
176
+ const vehicleRegistration = new IDCheckioParamsBuilder()
177
+ .setDocType(DocumentType.VEHICLE_REGISTRATION)
178
+ .setConfirmationType(ConfirmationType.DATA_OR_PICTURE)
179
+ .setOrientation(IDCheckioOrientation.PORTRAIT)
180
+ .setSideOneExtraction(new Extraction(Codeline.VALID, FaceDetection.DISABLED))
181
+ .build()
182
+
183
+ const iban = new IDCheckioParamsBuilder()
184
+ .setDocType(DocumentType.PHOTO)
185
+ .setOrientation(IDCheckioOrientation.PORTRAIT)
186
+ .setCaptureMode(CaptureMode.PROMPT)
187
+ .setOnlineConfig(new OnlineConfig({ cisType: CISType.IBAN }))
188
+ .build()
189
+
190
+ const attachment = new IDCheckioParamsBuilder()
191
+ .setDocType(DocumentType.PHOTO)
192
+ .setConfirmationType(ConfirmationType.DATA_OR_PICTURE)
193
+ .setOrientation(IDCheckioOrientation.PORTRAIT)
194
+ .setUseHd(true)
195
+ .setAdjustCrop(true)
196
+ .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
+ .build()
171
204
  ```
172
205
 
173
- 8. To just analyze a document, you have the method the `analyze()` method. You will receive the result in a string that can be parse into a json object.
174
- ```javascript
175
- analyze(params, onlineContext){
176
- const options = {
177
- title: 'Select Document',
178
- storageOptions: {
179
- skipBackup: true,
180
- path: 'images',
181
- },
182
- };
183
-
184
- launchImageLibrary(options, (response) => {
185
- if (response.didCancel) {
186
- console.log('User cancelled image picker');
187
- } else if (response.error) {
188
- console.log('ImagePicker Error: ', response.error);
189
- } else if (response.customButton) {
190
- console.log('User tapped custom button: ', response.customButton);
191
- } else {
192
- const source = { uri: response.assets[0].uri };
193
- // You can also display the image using data:
194
- // const source = { uri: 'data:image/jpeg;base64,' + response.data };
195
- IdcheckioModule.analyze(params, source.uri, null, true, onlineContext)
196
- .then(data => {
197
- console.log(data);
198
- let results = JSON.parse(data)
199
- this.response_server(results);
200
- },
201
- cause => {
202
- this.showError(cause);
203
- })
204
- .catch(err => {
205
- console.log(err);
206
- });
207
- }
208
- });
209
- }
206
+ #### IDCheckioOnlineContext
207
+ The `IDCheckioOnlineContext` is an object that will be used by the sdk to chain the capture in a none onboarding mode.
208
+ In the first capture, you can set it to null and for the other captures you need to retrieve the `IDCheckioOnlineContext` from the latest `IDCheckioResult` and set it to the next call of the `start` method.
209
+
210
+ #### IDCheckioResult
211
+ The `IDCheckioResult` is only used in response of a `start` to retrieve the `IDCheckioOnlineContext`.
212
+ ```js
213
+ export type IDCheckioResult = {
214
+ onlineContext: IDCheckioOnlineContext;
215
+ };
210
216
  ```
211
217
 
212
- 9. To handle error, you can parse the message of the error and use this object to do some error handling. To know a bit more about the error system in the sdk, look at `4.2.10. IdcheckioError` in the developer's guide.
213
- ```javascript
214
- showError(error) {
215
- console.log(error);
216
- var errorMsg = JSON.parse(error.message.replace("\n", "\\n"));
217
- console.log("cause: " + errorMsg.cause);
218
- console.log("details: " + errorMsg.details);
219
- console.log("message: " + errorMsg.message);
220
- console.log("subCause: " + errorMsg.subCause);
221
- alert(errorMsg.message);
222
- }
218
+ ### IDCheckioError
219
+ Here is the content of an error, you will find this object in the message of the error you will receive.
220
+ ```js
221
+ export type IDCheckioError = {
222
+ cause: IDCheckioErrorCause;
223
+ details: string;
224
+ subCause?: IDCheckioSubCause | undefined;
225
+ message?: string | undefined;
226
+ };
227
+
228
+ export type IDCheckioErrorCause =
229
+ | 'CUSTOMER_ERROR'
230
+ | 'NETWORK_ERROR'
231
+ | 'USER_ERROR'
232
+ | 'INTERNAL_ERROR'
233
+ | 'DEVICE_ERROR'
234
+ | 'DOCUMENT_ERROR';
235
+
236
+ export type IDCheckioSubCause =
237
+ | 'MISSING_PERMISSIONS'
238
+ | 'CANCELLED_BY_USER'
239
+ | 'MODEL_REJECTED'
240
+ | 'ANALYSIS_EXPIRED_DOC'
241
+ | 'PVID_NOT_ELIGIBLE'
242
+ | 'UNIDENTIFIED'
243
+ | 'DOC_NOT_USABLE_FACEREC'
244
+ | 'UNSUPPORTED_FILE_EXTENSION';
223
245
  ```
246
+ Two possibilities here, the easier is to handle the `IDCheckioErrorCause` and show generic errors for all or each cause.
247
+
248
+ 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
+ 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, ...)
224
250
 
225
- ## Theming
226
251
 
227
- If you want to change the colors of the sdk to match your theme, it's possible !
228
- You need to first create an IDCheckTheme() object with your own colors and then add it in the builder in the theme parameter.
229
- ```javascript
230
- new IDCheckTheme({primaryColor: "#FF0000B7", foregroundColor: "#FFFFFFFF", backgroundColor: "#FFFFFFFF", borderColor: "#FF0000B7"})
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" })
231
275
  ```
232
276
 
233
277
 
234
- - ✅ &nbsp; To learn more informations on those methods and theirs parameters. Please refer to the official IDCheck.io sdk documentation.
@@ -1,51 +1,109 @@
1
1
  buildscript {
2
- ext.safeExtGet = {prop, fallback ->
3
- rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
4
- }
5
- repositories {
6
- google()
7
- jcenter()
8
- }
2
+ // Buildscript is evaluated before everything else so we can't use getExtOrDefault
3
+ def kotlin_version = rootProject.ext.has("kotlinVersion") ? rootProject.ext.get("kotlinVersion") : project.properties["IdnowReactIdcheckio_kotlinVersion"]
9
4
 
10
- dependencies {
11
- // Matches recent template from React Native (0.60)
12
- // https://github.com/facebook/react-native/blob/0.60-stable/template/android/build.gradle#L16
13
- classpath("com.android.tools.build:gradle:${safeExtGet('gradlePluginVersion', '3.4.1')}")
14
- }
5
+ repositories {
6
+ google()
7
+ mavenCentral()
8
+ }
9
+
10
+ dependencies {
11
+ classpath "com.android.tools.build:gradle:8.2.2"
12
+ // noinspection DifferentKotlinGradleVersion
13
+ classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
14
+ }
15
+ }
16
+
17
+ def reactNativeArchitectures() {
18
+ def value = rootProject.getProperties().get("reactNativeArchitectures")
19
+ return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"]
20
+ }
21
+
22
+ def isNewArchitectureEnabled() {
23
+ return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true"
15
24
  }
16
25
 
17
- apply plugin: 'com.android.library'
26
+ apply plugin: "com.android.library"
27
+ apply plugin: "kotlin-android"
28
+
29
+ if (isNewArchitectureEnabled()) {
30
+ apply plugin: "com.facebook.react"
31
+ }
32
+
33
+ def getExtOrDefault(name) {
34
+ return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties["IdnowReactIdcheckio_" + name]
35
+ }
36
+
37
+ def getExtOrIntegerDefault(name) {
38
+ return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["IdnowReactIdcheckio_" + name]).toInteger()
39
+ }
40
+
41
+ def supportsNamespace() {
42
+ def parsed = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.')
43
+ def major = parsed[0].toInteger()
44
+ def minor = parsed[1].toInteger()
45
+
46
+ // Namespace support was added in 7.3.0
47
+ return (major == 7 && minor >= 3) || major >= 8
48
+ }
18
49
 
19
50
  android {
20
- compileSdkVersion safeExtGet('compileSdkVersion', 31)
21
-
22
- defaultConfig {
23
- minSdkVersion safeExtGet('minSdkVersion', 21)
24
- targetSdkVersion safeExtGet('targetSdkVersion', 31)
25
- versionCode 1
26
- multiDexEnabled true
27
- versionName "1.0"
51
+ if (supportsNamespace()) {
52
+ namespace "com.idnowreactidcheckio"
53
+
54
+ sourceSets {
55
+ main {
56
+ manifest.srcFile "src/main/AndroidManifestNew.xml"
57
+ }
58
+ }
59
+ }
60
+
61
+ compileSdkVersion getExtOrIntegerDefault("compileSdkVersion")
62
+
63
+ defaultConfig {
64
+ minSdkVersion getExtOrIntegerDefault("minSdkVersion")
65
+ targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
66
+
67
+ }
68
+
69
+ buildTypes {
70
+ release {
71
+ minifyEnabled false
28
72
  }
73
+ }
74
+
75
+ lintOptions {
76
+ disable "GradleCompatible"
77
+ }
78
+
79
+ compileOptions {
80
+ sourceCompatibility JavaVersion.VERSION_17
81
+ targetCompatibility JavaVersion.VERSION_17
82
+ }
83
+
84
+ kotlinOptions {
85
+ jvmTarget = JavaVersion.VERSION_17.toString()
86
+ }
29
87
  }
30
88
 
31
89
  repositories {
32
- mavenLocal()
33
- maven {
34
- // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
35
- url("$rootDir/../node_modules/react-native/android")
36
- }
37
- maven {
38
- // Android JSC is installed from npm
39
- url("$rootDir/../node_modules/jsc-android/dist")
40
- }
41
- google()
42
- jcenter()
43
- maven { url 'https://jitpack.io' }
90
+ mavenCentral()
91
+ google()
44
92
  }
45
93
 
94
+ def kotlin_version = getExtOrDefault("kotlinVersion")
95
+
46
96
  dependencies {
47
- implementation "com.facebook.react:react-native:${safeExtGet('reactnativeVersion', '+')}"
48
- implementation('com.ariadnext.android.idcheckio:sdk:7.2.2@aar') {
49
- transitive = true
50
- }
97
+ // For < 0.71, this will be from the local maven repo
98
+ // For > 0.71, this will be replaced by `com.facebook.react:react-android:$version` by react gradle plugin
99
+ //noinspection GradleDynamicVersion
100
+ implementation "com.facebook.react:react-native:+"
101
+ implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
102
+ implementation('com.ariadnext.android.idcheckio:sdk:8.0.0@aar') {
103
+ transitive = true
104
+ }
105
+ implementation 'androidx.appcompat:appcompat:1.7.0'
106
+ implementation 'com.google.android.material:material:1.12.0'
107
+ implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
51
108
  }
109
+
@@ -0,0 +1,5 @@
1
+ IdnowReactIdcheckio_kotlinVersion=1.9.10
2
+ IdnowReactIdcheckio_minSdkVersion=21
3
+ IdnowReactIdcheckio_targetSdkVersion=34
4
+ IdnowReactIdcheckio_compileSdkVersion=34
5
+ IdnowReactIdcheckio_ndkversion=21.4.7075529