Skip to content

Commit df65eb0

Browse files
Update IDCheck.io sdk version to 7.1.8. Add a theming API to update the color of the sdk.
1 parent affb076 commit df65eb0

File tree

14 files changed

+269
-35
lines changed

14 files changed

+269
-35
lines changed

ReactIdcheckioClient/Dictionnary.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { CISType, Codeline, ConfirmationType, DocumentType, Extraction, FaceDetection, FeedbackLevel, FileSize, IDCheckioOrientation, IDCheckioParamsBuilder, IntegrityCheck, Language, OnlineConfig, ScanBothSides } from "react-idcheckio"
1+
import { CISType, CaptureMode, Codeline, ConfirmationType, DocumentType, Extraction, FaceDetection, FeedbackLevel, FileSize, IDCheckioOrientation, IDCheckioParamsBuilder, IntegrityCheck, Language, OnlineConfig, ScanBothSides } from "react-idcheckio"
22

33
export const paramsIDOffline = new IDCheckioParamsBuilder()
44
.setDocType(DocumentType.ID)
@@ -65,9 +65,8 @@ export const paramsVehicleRegistration = new IDCheckioParamsBuilder()
6565

6666
export const paramsIban = new IDCheckioParamsBuilder()
6767
.setDocType(DocumentType.PHOTO)
68-
.setConfirmationType(ConfirmationType.DATA_OR_PICTURE)
6968
.setOrientation(IDCheckioOrientation.PORTRAIT)
70-
.setUseHd(true)
69+
.setCaptureMode(CaptureMode.PROMPT)
7170
.setOnlineConfig(new OnlineConfig({ cisType: CISType.IBAN }))
7271
.build()
7372

ReactIdcheckioClient/SdkColor.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { IDCheckTheme } from "react-idcheckio";
2+
3+
export const colorsList = [
4+
new IDCheckTheme(),
5+
new IDCheckTheme({primaryColor: "#FF0000B7", foregroundColor: "#FFFFFFFF", backgroundColor: "#FFFFFFFF", borderColor: "#FF0000B7"}),
6+
new IDCheckTheme({primaryColor: "#0000B7"}),
7+
new IDCheckTheme({primaryColor: "#FFAA66CC"}),
8+
new IDCheckTheme({primaryColor: "#FFCBAB51", foregroundColor: "#FF000000", backgroundColor: "#FF000000", borderColor: "#FFCBAB51"})
9+
]

ReactIdcheckioClient/index.js

Lines changed: 46 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ import React, {
55
Component
66
} from 'react';
77
import IdcheckioModule from './IdcheckioModule';
8-
import {Picker} from '@react-native-picker/picker';
8+
import RNPickerSelect from 'react-native-picker-select';
99
import * as Dictionnary from './Dictionnary';
10+
import * as SdkColor from './SdkColor';
1011
import {
1112
AppRegistry,
1213
StyleSheet,
@@ -29,7 +30,8 @@ class Resultat extends Component {
2930
sdkResult: null,
3031
isIps: false,
3132
folderUid: "",
32-
selectedValue: 0
33+
selectedValue: 0,
34+
selectedColor: 0
3335
};
3436
}
3537

@@ -40,6 +42,12 @@ class Resultat extends Component {
4042
})
4143
}
4244

45+
setSelectedColor(value){
46+
this.setState({
47+
selectedColor: value
48+
})
49+
}
50+
4351
setFolderUid(value){
4452
this.setState({
4553
folderUid: value
@@ -54,6 +62,10 @@ class Resultat extends Component {
5462

5563
capture() {
5664
let selectedParams = Dictionnary.paramsList[this.state.selectedValue]
65+
let selectedTheme = SdkColor.colorsList[this.state.selectedColor]
66+
let themedParams = { ...selectedParams.params, theme: selectedTheme }
67+
console.log(selectedTheme);
68+
console.log(selectedParams);
5769
//Retrieve the online context from last session, it will be used as parameter for the next session
5870
let onlineContext
5971
if(this.state.sdkResult != null && this.state.sdkResult.onlineContext != null) {
@@ -67,7 +79,7 @@ class Resultat extends Component {
6779
} else {
6880
// Capture mode
6981
if (selectedParams.isOnline) {
70-
IdcheckioModule.startOnline(selectedParams.params, onlineContext)
82+
IdcheckioModule.startOnline(themedParams, onlineContext)
7183
.then(data => {
7284
console.log(data);
7385
let results = JSON.parse(data)
@@ -185,22 +197,37 @@ class Resultat extends Component {
185197
<Text style = {styles.activationText}>{(this.state.sdkActivated)? "SDK activated! 🎉" : "SDK not activated"}</Text>
186198
<View style={styles.elementContainer} key='Choose your configuration'>
187199
<Text style={styles.picker}> Choose your configuration </Text>
188-
<Picker
200+
<RNPickerSelect
189201
selectedValue={this.state.selectedValue}
190202
onValueChange={(v) => this.setSelectedValue(v)}
191-
mode="dropdown">
192-
<Picker.Item label={Dictionnary.paramsList[0].name} value='0'/>
193-
<Picker.Item label={Dictionnary.paramsList[1].name} value='1'/>
194-
<Picker.Item label={Dictionnary.paramsList[2].name} value='2'/>
195-
<Picker.Item label={Dictionnary.paramsList[3].name} value='3'/>
196-
<Picker.Item label={Dictionnary.paramsList[4].name} value='4'/>
197-
<Picker.Item label={Dictionnary.paramsList[5].name} value='5'/>
198-
<Picker.Item label={Dictionnary.paramsList[6].name} value='6'/>
199-
<Picker.Item label={Dictionnary.paramsList[7].name} value='7'/>
200-
<Picker.Item label={Dictionnary.paramsList[8].name} value='8'/>
201-
<Picker.Item label={Dictionnary.paramsList[9].name} value='9'/>
202-
<Picker.Item label='Start Ips' value='10'/>
203-
</Picker>
203+
mode="dropdown"
204+
items={[
205+
{ label: Dictionnary.paramsList[0].name, value: '0' },
206+
{ label: Dictionnary.paramsList[1].name, value: '1' },
207+
{ label: Dictionnary.paramsList[2].name, value: '2' },
208+
{ label: Dictionnary.paramsList[3].name, value: '3' },
209+
{ label: Dictionnary.paramsList[4].name, value: '4' },
210+
{ label: Dictionnary.paramsList[5].name, value: '5' },
211+
{ label: Dictionnary.paramsList[6].name, value: '6' },
212+
{ label: Dictionnary.paramsList[7].name, value: '7' },
213+
{ label: Dictionnary.paramsList[8].name, value: '8' },
214+
{ label: Dictionnary.paramsList[9].name, value: '9' },
215+
{ label: 'Start Ips', value: '10' }
216+
]}/>
217+
</View>
218+
<View style={styles.elementContainer} key='Choose your theme'>
219+
<Text style={styles.picker}> Choose your theme </Text>
220+
<RNPickerSelect
221+
selectedValue={this.state.selectedColor}
222+
onValueChange={(v) => this.setSelectedColor(v)}
223+
mode="dropdown"
224+
items={[
225+
{ label: "Default", value: '0' },
226+
{ label: "Yris", value: '1' },
227+
{ label: "Blue", value: '2' },
228+
{ label: "Purple", value: '3' },
229+
{ label: "Dark Gold", value: '4' }
230+
]}/>
204231
</View>
205232
<TextInput style={styles.input} display= {(this.state.isIps)? 'flex' : 'none'} onChangeText={(text) => this.setFolderUid(text)}/>
206233
<Button disabled = {this.state.sdkActivated} onPress = {() => {this.activate()}}
@@ -241,6 +268,8 @@ const styles = StyleSheet.create({
241268
margin: 10,
242269
},
243270
picker: {
271+
paddingTop: 8,
272+
paddingBottom: 8,
244273
fontSize: 18,
245274
textAlign: 'center'
246275
},

ReactIdcheckioClient/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
{
22
"name": "ReactIdcheckioClient",
3-
"version": "7.0.1",
3+
"version": "7.1.8",
44
"private": true,
55
"scripts": {
66
"android": "react-native run-android",
77
"ios": "react-native run-ios",
88
"start": "react-native start"
99
},
1010
"dependencies": {
11-
"@react-native-picker/picker": "^1.16.1",
12-
"react": "17.0.1",
11+
"react": "17.0.2",
1312
"react-idcheckio": "file:.yalc/react-idcheckio",
14-
"react-native": "^0.68.2",
15-
"react-native-image-picker": "^4.0.3"
13+
"react-native": "0.68.2",
14+
"react-native-image-picker": "^4.9.3",
15+
"react-native-picker-select": "^8.1.0"
1616
},
1717
"jest": {
1818
"preset": "react-native"

react-idcheckio/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,4 +249,13 @@ showError(error) {
249249
}
250250
```
251251

252+
## Theming
253+
254+
If you want to change the colors of the sdk to match your theme, it's possible !
255+
You need to first create an IDCheckTheme() object with your own colors and then add it in the builder in the theme parameter.
256+
```javascript
257+
new IDCheckTheme({primaryColor: "#FF0000B7", foregroundColor: "#FFFFFFFF", backgroundColor: "#FFFFFFFF", borderColor: "#FF0000B7"})
258+
```
259+
260+
252261
-&nbsp; To learn more informations on those methods and theirs parameters. Please refer to the official IDCheck.io sdk documentation.
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
Pod::Spec.new do |s|
22
s.name = "ReactIdcheckio"
3-
s.version = "7.1.0"
3+
s.version = "7.1.8"
44
s.summary = "React Native plugin for IDCheck.io Mobile SDK for iOS"
55
s.homepage = "https://www.github.com//react-idcheckio"
66
s.license = { :type => "ISC" }
77
s.authors = { "" => "" }
88
s.platform = :ios, "10.0"
99
s.source = { :path => "." }
1010
s.source_files = "ios", "ios/**/*.{h,m,swift}"
11-
s.swift_version = '5.5'
11+
s.swift_version = '5.7'
1212

1313
s.dependency 'React'
14-
s.dependency 'IDCheckIOSDK', '~> 7.1.0'
14+
s.dependency 'IDCheckIOSDK', '~> 7.1.7'
1515
end

react-idcheckio/android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ repositories {
4545

4646
dependencies {
4747
implementation "com.facebook.react:react-native:${safeExtGet('reactnativeVersion', '+')}"
48-
implementation('com.ariadnext.android.idcheckio:sdk:7.1.0@aar') {
48+
implementation('com.ariadnext.android.idcheckio:sdk:7.1.8@aar') {
4949
transitive = true
5050
}
5151
}

react-idcheckio/android/src/main/java/com/ariadnext/idcheckio/IdcheckioConst.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,19 @@ public class IdcheckioConst {
2121
public static final String BIOMETRIC_CONSENT = "biometricConsent";
2222
public static final String ENABLE_MANUAL_ANALYSIS = "enableManualAnalysis";
2323

24+
public static final String THEME = "theme";
25+
public static final String PRIMARY_COLOR = "primaryColor";
26+
public static final String FOREGROUND_COLOR = "foregroundColor";
27+
public static final String BACKGROUND_COLOR = "backgroundColor";
28+
public static final String BORDER_COLOR = "borderColor";
29+
public static final String TEXT_COLOR = "textColor";
30+
public static final String TITLE_COLOR = "titleColor";
31+
2432
public static final String LANGUAGE = "language";
2533
public static final String MANUAL_BUTTON_TIMER = "manualButtonTimer";
2634
public static final String MAX_PICTURE_FILESIZE = "maxPictureFilesize";
2735
public static final String FEEDBACK_LEVEL = "feedbackLevel";
2836
public static final String ADJUST_CROP = "adjustCrop";
2937
public static final String CONFIRM_ABORT = "confirmAbort";
38+
public static final String CAPTURE_MODE = "captureMode";
3039
}

react-idcheckio/android/src/main/java/com/ariadnext/idcheckio/ParameterUtils.java

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
package com.ariadnext.idcheckio;
22

33
import static com.ariadnext.idcheckio.IdcheckioConst.ADJUST_CROP;
4+
import static com.ariadnext.idcheckio.IdcheckioConst.BACKGROUND_COLOR;
45
import static com.ariadnext.idcheckio.IdcheckioConst.BIOMETRIC_CONSENT;
6+
import static com.ariadnext.idcheckio.IdcheckioConst.BORDER_COLOR;
7+
import static com.ariadnext.idcheckio.IdcheckioConst.CAPTURE_MODE;
58
import static com.ariadnext.idcheckio.IdcheckioConst.CIS_TYPE;
69
import static com.ariadnext.idcheckio.IdcheckioConst.CONFIRM_ABORT;
710
import static com.ariadnext.idcheckio.IdcheckioConst.CONFIRM_TYPE;
@@ -12,19 +15,27 @@
1215
import static com.ariadnext.idcheckio.IdcheckioConst.FACE_DETECTION;
1316
import static com.ariadnext.idcheckio.IdcheckioConst.FEEDBACK_LEVEL;
1417
import static com.ariadnext.idcheckio.IdcheckioConst.FOLDER_UID;
18+
import static com.ariadnext.idcheckio.IdcheckioConst.FOREGROUND_COLOR;
1519
import static com.ariadnext.idcheckio.IdcheckioConst.INTEGRITY_CHECK;
1620
import static com.ariadnext.idcheckio.IdcheckioConst.IS_REFERENCE_DOC;
1721
import static com.ariadnext.idcheckio.IdcheckioConst.LANGUAGE;
1822
import static com.ariadnext.idcheckio.IdcheckioConst.MANUAL_BUTTON_TIMER;
1923
import static com.ariadnext.idcheckio.IdcheckioConst.MAX_PICTURE_FILESIZE;
2024
import static com.ariadnext.idcheckio.IdcheckioConst.ONLINE_CONFIG;
2125
import static com.ariadnext.idcheckio.IdcheckioConst.ORIENTATION;
26+
import static com.ariadnext.idcheckio.IdcheckioConst.PRIMARY_COLOR;
2227
import static com.ariadnext.idcheckio.IdcheckioConst.READ_EMRTD;
2328
import static com.ariadnext.idcheckio.IdcheckioConst.SCAN_BOTH_SIDES;
2429
import static com.ariadnext.idcheckio.IdcheckioConst.SIDE_1_EXTRACTION;
2530
import static com.ariadnext.idcheckio.IdcheckioConst.SIDE_2_EXTRACTION;
31+
import static com.ariadnext.idcheckio.IdcheckioConst.TEXT_COLOR;
32+
import static com.ariadnext.idcheckio.IdcheckioConst.THEME;
33+
import static com.ariadnext.idcheckio.IdcheckioConst.TITLE_COLOR;
2634
import static com.ariadnext.idcheckio.IdcheckioConst.USE_HD;
2735

36+
import android.graphics.Color;
37+
38+
import com.ariadnext.idcheckio.sdk.bean.CaptureMode;
2839
import com.ariadnext.idcheckio.sdk.bean.ConfirmationType;
2940
import com.ariadnext.idcheckio.sdk.bean.DataRequirement;
3041
import com.ariadnext.idcheckio.sdk.bean.DocumentType;
@@ -37,6 +48,7 @@
3748
import com.ariadnext.idcheckio.sdk.bean.Language;
3849
import com.ariadnext.idcheckio.sdk.bean.OnlineConfig;
3950
import com.ariadnext.idcheckio.sdk.bean.Orientation;
51+
import com.ariadnext.idcheckio.sdk.bean.Theme;
4052
import com.ariadnext.idcheckio.sdk.component.IdcheckioView;
4153
import com.ariadnext.idcheckio.sdk.interfaces.cis.CISType;
4254

@@ -97,6 +109,12 @@ public static IdcheckioView.Builder getIDCheckioViewFromCall(HashMap<String, Obj
97109
case CONFIRM_ABORT:
98110
idcheckioView.confirmAbort(Boolean.parseBoolean(value.toString()));
99111
break;
112+
case CAPTURE_MODE:
113+
idcheckioView.captureMode(CaptureMode.valueOf(value.toString()));
114+
break;
115+
case THEME:
116+
idcheckioView.theme(getTheme((HashMap<String, Object>) value));
117+
break;
100118
}
101119
}
102120
return idcheckioView;
@@ -179,4 +197,55 @@ private static OnlineConfig getOnlineConfig(HashMap<String, Object> configMap) {
179197
}
180198
return onlineConfig;
181199
}
200+
201+
private static Theme getTheme(HashMap<String, Object> themeMap) {
202+
Integer primaryColor = null;
203+
Integer foregroundColor = null;
204+
Integer backgroundColor = null;
205+
Integer borderColor = null;
206+
Integer textColor = null;
207+
Integer titleColor = null;
208+
if(themeMap.containsKey(PRIMARY_COLOR)) {
209+
Object primaryColorOpt = themeMap.get(PRIMARY_COLOR);
210+
if(primaryColorOpt != null) {
211+
primaryColor = Color.parseColor(primaryColorOpt.toString());
212+
}
213+
}
214+
215+
if(themeMap.containsKey(FOREGROUND_COLOR)) {
216+
Object foregroundColorOpt = themeMap.get(FOREGROUND_COLOR);
217+
if(foregroundColorOpt != null) {
218+
foregroundColor = Color.parseColor(foregroundColorOpt.toString());
219+
}
220+
}
221+
222+
if(themeMap.containsKey(BACKGROUND_COLOR)) {
223+
Object backgroundColorOpt = themeMap.get(BACKGROUND_COLOR);
224+
if(backgroundColorOpt != null) {
225+
backgroundColor = Color.parseColor(backgroundColorOpt.toString());
226+
}
227+
}
228+
229+
if(themeMap.containsKey(BORDER_COLOR)) {
230+
Object borderColorOpt = themeMap.get(BORDER_COLOR);
231+
if(borderColorOpt != null) {
232+
borderColor = Color.parseColor(borderColorOpt.toString());
233+
}
234+
}
235+
236+
if(themeMap.containsKey(TEXT_COLOR)) {
237+
Object textColorOpt = themeMap.get(TEXT_COLOR);
238+
if(textColorOpt != null) {
239+
textColor = Color.parseColor(textColorOpt.toString());
240+
}
241+
}
242+
243+
if(themeMap.containsKey(TITLE_COLOR)) {
244+
Object titleColorOpt = themeMap.get(TITLE_COLOR);
245+
if(titleColorOpt != null) {
246+
titleColor = Color.parseColor(titleColorOpt.toString());
247+
}
248+
}
249+
return new Theme(foregroundColor, borderColor, backgroundColor, primaryColor, titleColor, textColor);
250+
}
182251
}

0 commit comments

Comments
 (0)