Skip to content

Commit 6570fbc

Browse files
authored
Merge pull request #24 from klippa-app/development
Development
2 parents 800632e + 18e8971 commit 6570fbc

File tree

8 files changed

+135
-35
lines changed

8 files changed

+135
-35
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
## 0.2.8
2+
3+
* Bump Android to 0.7.5
4+
* Bump iOS to 0.5.18
5+
* Added `German` and `French` support.
6+
* Added `enableAutoCapture` to `IdentityBuilder`.
7+
* Added `validationIncludeList` and `validationExcludeList` to `IdentityBuilder`.
8+
19
## 0.2.7
210

311
* Bump Android to 0.7.3

README.md

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,14 @@ To display extra debug info, add the following to the builder:
148148
identityBuilder.isDebug = true;
149149
```
150150

151+
### Enable Auto Capture
152+
153+
To configure if the camera should automatically take a photo if the conditions are right.
154+
155+
```dart
156+
identityBuilder.enableAutoCapture = true;
157+
```
158+
151159
### Intro/Success screens
152160

153161
To configure whether to show intro/success screens, add the following to the builder:
@@ -169,7 +177,7 @@ identityBuilder.retryThreshold = 1;
169177
Add the following to the builder:
170178

171179
```dart
172-
// We support English, Dutch and Spanish.
180+
// We support English, Dutch, Spanish, German and French.
173181
identityBuilder.language = KIVLanguage.Dutch;
174182
```
175183

@@ -205,6 +213,28 @@ identityBuilder.verifyIncludeList = [
205213
identityBuilder.verifyExcludeList = [];
206214
```
207215

216+
### Validation Include & Exclude lists
217+
218+
You can edit the validation include list: the failed validations that are shown to the user Or the validation exclude list: the failed validations that are hidden from the user.
219+
For more information regarding validations check out the [API documentation](https://custom-ocr.klippa.com/docs#tag/IdentityVerification/operation/createIdentityVerificationSession).
220+
221+
```dart
222+
identityBuilder.validationIncludeList = [
223+
"DetectFace",
224+
"CompareFace",
225+
"DetectSignature",
226+
"CompareSignature",
227+
"CheckRequiredField",
228+
"MatchSidesFront",
229+
"MatchSidesBack",
230+
"FieldValidation",
231+
"MatchVizMrz",
232+
"MrzChecksum"
233+
]
234+
235+
identityBuilder.validationExcludeList = []
236+
```
237+
208238
## How to change the colors of the SDK?
209239

210240
### Android

android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,6 @@ android {
5353

5454
dependencies {
5555
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
56-
def klippaIdentityVerificationVersion = project.hasProperty('klippaIdentityVerificationVersion') ? project.klippaIdentityVerificationVersion : "0.7.3"
56+
def klippaIdentityVerificationVersion = project.hasProperty('klippaIdentityVerificationVersion') ? project.klippaIdentityVerificationVersion : "0.7.5"
5757
implementation "com.klippa:identity_verification:$klippaIdentityVerificationVersion"
5858
}

android/src/main/kotlin/com/klippa/identity_verification/klippa_identity_verification_sdk/KlippaIdentityVerificationSdkPlugin.kt

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,12 @@ class KlippaIdentityVerificationSdkPlugin : FlutterPlugin, MethodCallHandler, Ac
9696
"KIVLanguage.Spanish" -> {
9797
identitySession.language = IdentitySession.KIVLanguage.Spanish
9898
}
99+
"KIVLanguage.German" -> {
100+
identitySession.language = IdentitySession.KIVLanguage.German
101+
}
102+
"KIVLanguage.French" -> {
103+
identitySession.language = IdentitySession.KIVLanguage.French
104+
}
99105
}
100106
}
101107

@@ -111,6 +117,10 @@ class KlippaIdentityVerificationSdkPlugin : FlutterPlugin, MethodCallHandler, Ac
111117
identitySession.isDebug = isDebug
112118
}
113119

120+
call.argument<Boolean>("EnableAutoCapture")?.let { enableAutoCapture ->
121+
identitySession.enableAutoCapture = enableAutoCapture
122+
}
123+
114124
call.argument<List<String>>("VerifyIncludeList")?.let { include ->
115125
identitySession.kivIncludeList = include
116126
}
@@ -119,6 +129,14 @@ class KlippaIdentityVerificationSdkPlugin : FlutterPlugin, MethodCallHandler, Ac
119129
identitySession.kivExcludeList = exclude
120130
}
121131

132+
call.argument<List<String>>("ValidationIncludeList")?.let { include ->
133+
identitySession.kivValidationIncludeList = include
134+
}
135+
136+
call.argument<List<String>>("ValidationExcludeList")?.let { exclude ->
137+
identitySession.kivValidationExcludeList = exclude
138+
}
139+
122140
call.argument<Int>("RetryThreshold")?.let { retryThreshold ->
123141
identitySession.retryThreshold = retryThreshold
124142
}
@@ -154,7 +172,8 @@ class KlippaIdentityVerificationSdkPlugin : FlutterPlugin, MethodCallHandler, Ac
154172
IdentitySessionResultCode.DEVICE_DOES_NOT_SUPPORT_NFC,
155173
IdentitySessionResultCode.DEVICE_NFC_DISABLED,
156174
IdentitySessionResultCode.TAKING_PHOTO_FAILED,
157-
IdentitySessionResultCode.UNKNOWN_ERROR -> identityVerificationCanceled(mappedResultCode.message())
175+
IdentitySessionResultCode.UNKNOWN_ERROR,
176+
IdentitySessionResultCode.INCORRECT_SESSION_SETUP -> identityVerificationCanceled(mappedResultCode.message())
158177
}
159178

160179
return true

ios/Classes/SwiftKlippaIdentityVerificationSdkPlugin.swift

Lines changed: 51 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ public class SwiftKlippaIdentityVerificationSdkPlugin: NSObject, FlutterPlugin,
4545
builder.kivLanguage = IdentityBuilder.KIVLanguage.Dutch
4646
} else if (language == "KIVLanguage.Spanish") {
4747
builder.kivLanguage = IdentityBuilder.KIVLanguage.Spanish
48+
} else if (language == "KIVLanguage.German") {
49+
builder.kivLanguage = IdentityBuilder.KIVLanguage.German
50+
} else if (language == "KIVLanguage.French") {
51+
builder.kivLanguage = IdentityBuilder.KIVLanguage.French
4852
}
4953
}
5054

@@ -60,32 +64,35 @@ public class SwiftKlippaIdentityVerificationSdkPlugin: NSObject, FlutterPlugin,
6064
builder.isDebug = isDebug
6165
}
6266

67+
if let enableAutoCapture = builderArgs["EnableAutoCapture"] as? Bool {
68+
builder.enableAutoCapture = enableAutoCapture
69+
}
6370
if let textColor = builderArgs["Colors.textColor"] as? String {
64-
builder.kivColors.textColor = hexColorToUIColor(hex: textColor)
71+
builder.kivColors.textColor = UIColor(hexString: textColor)
6572
}
6673

6774
if let backgroundColor = builderArgs["Colors.backgroundColor"] as? String {
68-
builder.kivColors.backgroundColor = hexColorToUIColor(hex: backgroundColor)
75+
builder.kivColors.backgroundColor = UIColor(hexString: backgroundColor)
6976
}
7077

7178
if let buttonSuccessColor = builderArgs["Colors.buttonSuccessColor"] as? String {
72-
builder.kivColors.buttonSuccessColor = hexColorToUIColor(hex: buttonSuccessColor)
79+
builder.kivColors.buttonSuccessColor = UIColor(hexString: buttonSuccessColor)
7380
}
7481

7582
if let buttonErrorColor = builderArgs["Colors.buttonErrorColor"] as? String {
76-
builder.kivColors.buttonErrorColor = hexColorToUIColor(hex: buttonErrorColor)
83+
builder.kivColors.buttonErrorColor = UIColor(hexString: buttonErrorColor)
7784
}
7885

7986
if let buttonOtherColor = builderArgs["Colors.buttonOtherColor"] as? String {
80-
builder.kivColors.buttonOtherColor = hexColorToUIColor(hex: buttonOtherColor)
87+
builder.kivColors.buttonOtherColor = UIColor(hexString: buttonOtherColor)
8188
}
8289

8390
if let progressBarBackground = builderArgs["Colors.progressBarBackground"] as? String {
84-
builder.kivColors.progressBarBackground = hexColorToUIColor(hex: progressBarBackground)
91+
builder.kivColors.progressBarBackground = UIColor(hexString: progressBarBackground)
8592
}
8693

8794
if let progressBarForeground = builderArgs["Colors.progressBarForeground"] as? String {
88-
builder.kivColors.progressBarForeground = hexColorToUIColor(hex: progressBarForeground)
95+
builder.kivColors.progressBarForeground = UIColor(hexString: progressBarForeground)
8996
}
9097

9198
if let fontName = builderArgs["Fonts.fontName"] as? String {
@@ -104,6 +111,14 @@ public class SwiftKlippaIdentityVerificationSdkPlugin: NSObject, FlutterPlugin,
104111
builder.kivVerifyExcludeList = excludeList
105112
}
106113

114+
if let validationIncludeList = builderArgs["ValidationIncludeList"] as? [String] {
115+
builder.kivValidationIncludeList = validationIncludeList
116+
}
117+
118+
if let validationExcludeList = builderArgs["ValidationExcludeList"] as? [String] {
119+
builder.kivValidationExcludeList = validationExcludeList
120+
}
121+
107122
if let retryThreshold = builderArgs["RetryThreshold"] as? Int {
108123
builder.retryThreshold = retryThreshold
109124
}
@@ -115,28 +130,6 @@ public class SwiftKlippaIdentityVerificationSdkPlugin: NSObject, FlutterPlugin,
115130
rootViewController.present(viewController, animated:true, completion:nil)
116131
}
117132

118-
private func hexColorToUIColor(hex: String) -> UIColor? {
119-
let r, g, b, a: CGFloat
120-
121-
let start = hex.index(hex.startIndex, offsetBy: 1)
122-
let hexColor = String(hex[start...])
123-
124-
if hexColor.count == 8 {
125-
let scanner = Scanner(string: hexColor)
126-
var hexNumber: UInt64 = 0
127-
128-
if scanner.scanHexInt64(&hexNumber) {
129-
a = CGFloat((hexNumber & 0xff000000) >> 24) / 255
130-
r = CGFloat((hexNumber & 0x00ff0000) >> 16) / 255
131-
g = CGFloat((hexNumber & 0x0000ff00) >> 8) / 255
132-
b = CGFloat(hexNumber & 0x000000ff) / 255
133-
134-
return UIColor.init(red: r, green: g, blue: b, alpha: a)
135-
}
136-
}
137-
return nil
138-
}
139-
140133
public func identityVerificationFinished() {
141134
let resultMap = Dictionary<String, Any>.init()
142135
resultHandler!(resultMap)
@@ -170,3 +163,32 @@ public class SwiftKlippaIdentityVerificationSdkPlugin: NSObject, FlutterPlugin,
170163
}
171164

172165
}
166+
167+
extension UIColor {
168+
convenience init(hexString: String) {
169+
var newString = hexString
170+
if newString.first != "#" {
171+
newString.insert("#", at: newString.startIndex)
172+
}
173+
let hex = newString.trimmingCharacters(in: CharacterSet.alphanumerics.inverted)
174+
var int = UInt64()
175+
Scanner(string: hex).scanHexInt64(&int)
176+
let a, r, g, b: UInt64
177+
switch hex.count {
178+
case 3: // RGB (12-bit)
179+
(a, r, g, b) = (255, (int >> 8) * 17, (int >> 4 & 0xF) * 17, (int & 0xF) * 17)
180+
case 6: // RGB (24-bit)
181+
(a, r, g, b) = (255, int >> 16, int >> 8 & 0xFF, int & 0xFF)
182+
case 8: // ARGB (32-bit)
183+
(a, r, g, b) = (int >> 24, int >> 16 & 0xFF, int >> 8 & 0xFF, int & 0xFF)
184+
default:
185+
(a, r, g, b) = (255, 0, 0, 0)
186+
}
187+
self.init(
188+
red: CGFloat(r) / 255,
189+
green: CGFloat(g) / 255,
190+
blue: CGFloat(b) / 255,
191+
alpha: CGFloat(a) / 255
192+
)
193+
}
194+
}

ios/sdk_version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.5.14
1+
0.5.18

lib/klippa_identity_verification_sdk.dart

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import 'dart:async';
22
import 'package:flutter/services.dart';
33

44
/// Available languages for the Identity Verification SDK.
5-
enum KIVLanguage { English, Dutch, Spanish }
5+
enum KIVLanguage { English, Dutch, Spanish, German, French }
66

77
/// Custom fonts for the SDK.
88
class KIVFonts {
@@ -51,6 +51,12 @@ class IdentityBuilder {
5151
/// The list of items to exclude in the data verification screen.
5252
List<String>? verifyExcludeList;
5353

54+
/// The list of validations to include.
55+
List<String>? validationIncludeList;
56+
57+
/// The list of validations to exclude.
58+
List<String>? validationExcludeList;
59+
5460
/// The language that the SDK uses.
5561
KIVLanguage? language;
5662

@@ -63,6 +69,9 @@ class IdentityBuilder {
6369
/// Whether the SDK should report debug information.
6470
bool? isDebug;
6571

72+
/// Whether the SDK should automatically take photos when conditions are right.
73+
bool? enableAutoCapture;
74+
6675
/// The threshold the user can attempt a task before a contact support button is shown.
6776
int? retryThreshold;
6877

@@ -165,6 +174,10 @@ class KlippaIdentityVerificationSdk {
165174
parameters['IsDebug'] = builder.isDebug;
166175
}
167176

177+
if (builder.enableAutoCapture != null) {
178+
parameters['EnableAutoCapture'] = builder.enableAutoCapture;
179+
}
180+
168181
if (builder.verifyIncludeList != null) {
169182
parameters['VerifyIncludeList'] = builder.verifyIncludeList;
170183
}
@@ -173,6 +186,14 @@ class KlippaIdentityVerificationSdk {
173186
parameters['VerifyExcludeList'] = builder.verifyExcludeList;
174187
}
175188

189+
if (builder.validationIncludeList != null) {
190+
parameters['ValidationIncludeList'] = builder.validationIncludeList;
191+
}
192+
193+
if (builder.validationExcludeList != null) {
194+
parameters['ValidationExcludeList'] = builder.validationExcludeList;
195+
}
196+
176197
if (builder.retryThreshold != null) {
177198
parameters["RetryThreshold"] = builder.retryThreshold;
178199
}

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: klippa_identity_verification_sdk
22
description: Allows you to do identity verification with the Klippa Identity Verification SDK from Flutter apps.
3-
version: 0.2.7
3+
version: 0.2.8
44
homepage: https://github.com/klippa-app/flutter-klippa-identity-verification-sdk
55

66
environment:

0 commit comments

Comments
 (0)