Skip to content

Commit

Permalink
bump sdk versions + add support for new features.
Browse files Browse the repository at this point in the history
  • Loading branch information
RobinFarmer committed May 27, 2024
1 parent 992143b commit ffdaf23
Show file tree
Hide file tree
Showing 8 changed files with 95 additions and 7 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
## 0.0.10

* Bump Android to 0.7.4
* Bump iOS to 0.5.16
* Added `German` and `French` support.
* Added `enableAutoCapture` to `IdentityBuilder`.
* Added `validationIncludeList` and `validationExcludeList` to `IdentityBuilder`.

## 0.0.9

* Bump Android to 0.7.3
Expand Down
32 changes: 31 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,12 +184,20 @@ To configure how often a user can attempt a task before the `contact support` bu
identityBuilder.retryThreshold = 1
```

### Enable Auto Capture

To configure if the camera should automatically take a photo if the conditions are right.

```typescript
identityBuilder.enableAutoCapture = true
```

### Language

Add the following to the builder:

``` typescript
// We support English, Dutch and Spanish
// We support English, Dutch, Spanish, German and French
identityBuilder.language = KIVLanguage.Dutch
```

Expand Down Expand Up @@ -223,6 +231,28 @@ identityBuilder.verifyIncludeList = [
identityBuilder.verifyExcludeList = []
```

### Validation Include & Exclude lists

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.
For more information regarding validations check out the [API documentation](https://custom-ocr.klippa.com/docs#tag/IdentityVerification/operation/createIdentityVerificationSession).

```typescript
identityBuilder.validationIncludeList = [
"DetectFace",
"CompareFace",
"DetectSignature",
"CompareSignature",
"CheckRequiredField",
"MatchSidesFront",
"MatchSidesBack",
"FieldValidation",
"MatchVizMrz",
"MrzChecksum"
]

identityBuilder.validationExcludeList = []
```

### Colors

#### Android
Expand Down
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ dependencies {
implementation "com.facebook.react:react-native"
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"

def fallbackKlippaVersion = "0.7.3"
def fallbackKlippaVersion = "0.7.4"
def klippaIdentityVerificationVersion = project.hasProperty('klippaIdentityVerificationVersion') ? project.klippaIdentityVerificationVersion : fallbackKlippaVersion
implementation "com.klippa:identity_verification:$klippaIdentityVerificationVersion"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,13 @@ class KlippaIdentityVerificationSdkModule(private val reactContext: ReactApplica
identitySession.retryThreshold = retryThreshold.toInt()
}

(config["enableAutoCapture"] as? Boolean)?.let { enableAutoCapture ->
identitySession.enableAutoCapture = enableAutoCapture
}

setVerificationLists(config, identitySession)

setValidationLists(config, identitySession)

return identitySession
}
Expand All @@ -116,6 +121,21 @@ class KlippaIdentityVerificationSdkModule(private val reactContext: ReactApplica
}
}

private fun setValidationLists(
config: Map<String, Any>,
identitySession: IdentitySession
) {
@Suppress("UNCHECKED_CAST")
(config["validationIncludeList"] as? List<String>)?.also { validationIncludeList ->
identitySession.kivValidationIncludeList = validationIncludeList
}

@Suppress("UNCHECKED_CAST")
(config["validationExcludeList"] as? List<String>)?.also { validationExcludeList ->
identitySession.kivValidationExcludeList = validationExcludeList
}
}

private fun setBuilderOptionalScreens(
config: Map<String, Any>,
identitySession: IdentitySession
Expand All @@ -138,6 +158,8 @@ class KlippaIdentityVerificationSdkModule(private val reactContext: ReactApplica
"English" -> identitySession.language = IdentitySession.KIVLanguage.English
"Dutch" -> identitySession.language = IdentitySession.KIVLanguage.Dutch
"Spanish" -> identitySession.language = IdentitySession.KIVLanguage.Spanish
"German" -> identitySession.language = IdentitySession.KIVLanguage.German
"French" -> identitySession.language = IdentitySession.KIVLanguage.French
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion ios/.sdk_version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.5.14
0.5.16
24 changes: 22 additions & 2 deletions ios/KlippaIdentityVerificationSdk.swift
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,18 @@ class KlippaIdentityVerificationSdk: NSObject {
builder.retryThreshold = Int(retryThreshold)
}

if let enableAutoCapture = config["enableAutoCapture"] as? Bool {
builder.enableAutoCapture = enableAutoCapture
}

setBuilderColors(config, builder)

setBuilderFonts(config, builder)

setVerificationLists(config, builder)

setValidationLists(config, builder)

return builder
}

Expand Down Expand Up @@ -105,15 +111,19 @@ class KlippaIdentityVerificationSdk: NSObject {
builder.kivLanguage = .Dutch
} else if language == "Spanish" {
builder.kivLanguage = .Spanish
} else if language == "German" {
builder.kivLanguage = .German
} else if language == "French" {
builder.kivLanguage = .French
}
}
}

// MARK: Customize Optional Screens

fileprivate func setBuilderOptionalScreens(_ config: [String : Any], _ builder: IdentityBuilder) {
if let hasInstroScreen = config["hasIntroScreen"] as? Bool {
builder.hasIntroScreen = hasInstroScreen
if let hasIntroScreen = config["hasIntroScreen"] as? Bool {
builder.hasIntroScreen = hasIntroScreen
}

if let hasSuccessScreen = config["hasSuccessScreen"] as? Bool {
Expand All @@ -133,6 +143,16 @@ class KlippaIdentityVerificationSdk: NSObject {
}
}

fileprivate func setValidationLists(_ config: [String : Any], _ builder: IdentityBuilder) {
if let validationIncludeList = config["validationIncludeList"] as? [String] {
builder.kivValidationIncludeList = validationIncludeList
}

if let validationExcludeList = config["validationExcludeList"] as? [String] {
builder.kivValidationExcludeList = validationExcludeList
}
}

// MARK: Customize Fonts

fileprivate func setBuilderFonts(_ config: [String : Any], _ builder: IdentityBuilder) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@klippa/react-native-klippa-identity-verification-sdk",
"title": "React Native Klippa Identity Verification SDK",
"version": "0.0.9",
"version": "0.0.10",
"description": "A React Native plugin to use the Klippa Identity Verification SDK",
"homepage": "https://github.com/klippa-app/react-native-klippa-identity-verification-sdk",
"main": "lib/commonjs/index",
Expand Down
10 changes: 9 additions & 1 deletion src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ export function startSession(builder: IdentityBuilder, sessionToken: string): Pr
export enum KIVLanguage {
English = "English",
Dutch = "Dutch",
Spanish = "Spanish"
Spanish = "Spanish",
German = "German",
French = "French"
}

export class KIVFonts {
Expand Down Expand Up @@ -47,12 +49,18 @@ export class IdentityBuilder {

verifyExcludeList?: Array<string>

validationIncludeList?: Array<string>

validationExcludeList?: Array<string>

hasIntroScreen?: boolean

hasSuccessScreen?: boolean

isDebug?: boolean

retryThreshold?: number

enableAutoCapture?: boolean
}

0 comments on commit ffdaf23

Please sign in to comment.