Skip to content

Commit

Permalink
Final commit for 4.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
JumioMobileTeam committed Sep 23, 2022
1 parent 293eaaa commit 2624a9c
Show file tree
Hide file tree
Showing 52 changed files with 1,526 additions and 661 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 4.3.0
* Updated Jumio SDK Android and iOS to 4.3.0
* Update dependencies to Flutter 3.3.2 and Dart 2.18.1

## 4.2.0
* Updated Jumio SDK Android and iOS to 4.2.0
* Update dependencies to Flutter 3.0.1 and Dart 2.17.1
Expand Down
13 changes: 6 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Official Jumio Mobile SDK plugin for Flutter

This plugin is compatible with version 4.2.0 of the Jumio SDK. If you have questions, please reach out to your Account Manager or contact [Jumio Support](#support).
This plugin is compatible with version 4.3.0 of the Jumio SDK. If you have questions, please reach out to your Account Manager or contact [Jumio Support](#support).

# Table of Contents
- [Compatibility](#compatibility)
Expand All @@ -24,7 +24,7 @@ This plugin is compatible with version 4.2.0 of the Jumio SDK. If you have quest
- [Support](#support)

## Compatibility
Compatibility has been tested with a Flutter version of 3.0.1 and Dart 2.17.1
Compatibility has been tested with a Flutter version of 3.3.2 and Dart 2.18.1

## Setup
Create Flutter project and add the Jumio Mobile SDK module to it.
Expand All @@ -40,7 +40,7 @@ dependencies:
flutter:
sdk: flutter

jumio_mobile_sdk_flutter: ^4.2.0
jumio_mobile_sdk_flutter: ^4.3.0
```

And install the dependency:
Expand All @@ -59,15 +59,14 @@ flutter pub get

### Android
__AndroidManifest__
Open your AndroidManifest.xml file and change `allowBackup` to false. Add user permission `HIGH_SAMPLING_RATE_SENSORS` to access sensor data with a sampling rate greater than 200 Hz.
Open your AndroidManifest.xml file and change `allowBackup` to false.

```xml
<application
...
android:allowBackup="false">
</application>
...
<uses-permission android:name="android.permission.HIGH_SAMPLING_RATE_SENSORS"/>
```

Make sure your compileSdkVersion, minSdkVersion and buildToolsVersion are high enough.
Expand Down Expand Up @@ -97,14 +96,14 @@ android {
__Upgrade Gradle build tools__
The plugin requires at least version 4.0.0 of the Android build tools. This transitively requires and upgrade of the Gradle wrapper to version 7 and an update to Java 11.

Upgrade build tools version to 7.2.0 in android/build.gradle:
Upgrade build tools version to 7.2.1 in android/build.gradle:

```groovy
buildscript {
...
dependencies {
...
classpath 'com.android.tools.build:gradle:7.2.0'
classpath 'com.android.tools.build:gradle:7.2.1'
}
}
```
Expand Down
10 changes: 6 additions & 4 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ group 'com.jumio.jumiomobilesdk'
version '1.0-SNAPSHOT'

buildscript {
ext.kotlin_version = '1.6.20'
ext.kotlin_version = '1.7.0'
repositories {
google()
mavenCentral()
gradlePluginPortal()
}

dependencies {
classpath 'com.android.tools.build:gradle:7.2.0'
classpath 'com.android.tools.build:gradle:7.2.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
Expand All @@ -36,7 +36,7 @@ apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'

android {
compileSdkVersion 31
compileSdkVersion 32

sourceSets {
main.java.srcDirs += 'src/main/kotlin'
Expand All @@ -51,13 +51,15 @@ android {
}

ext {
SDK_VERSION = "4.2.0"
SDK_VERSION = "4.3.0"
}

dependencies {
// Jumio dependencies
implementation "com.jumio.android:core:${SDK_VERSION}"
implementation "com.jumio.android:linefinder:${SDK_VERSION}"
// Flutter can't properly handle results after activity restarts caused by Docfinder module
//implementation "com.jumio.android:docfinder:${SDK_VERSION}"
implementation "com.jumio.android:mrz:${SDK_VERSION}"
implementation "com.jumio.android:nfc:${SDK_VERSION}"
implementation "com.jumio.android:barcode:${SDK_VERSION}"
Expand Down
131 changes: 68 additions & 63 deletions android/src/main/kotlin/com/jumio/jumiomobilesdk/JumioModule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import android.content.Intent
import com.jumio.defaultui.JumioActivity
import com.jumio.sdk.credentials.JumioCredentialCategory.FACE
import com.jumio.sdk.credentials.JumioCredentialCategory.ID
import com.jumio.sdk.enums.JumioDataCenter
import com.jumio.sdk.result.JumioResult
import io.flutter.plugin.common.MethodCall

class JumioModule : ModuleBase() {

companion object {
private const val REQUEST_CODE = 101
}
Expand All @@ -27,40 +27,32 @@ class JumioModule : ModuleBase() {
override fun handleActivityResult(requestCode: Int, resultCode: Int, data: Intent?): Boolean {
return if (requestCode == REQUEST_CODE) {
if (data != null) {
val jumioResult =
data.getSerializableExtra(JumioActivity.EXTRA_RESULT) as JumioResult
val jumioResult = data.getSerializableExtra(JumioActivity.EXTRA_RESULT) as JumioResult

if (jumioResult.isSuccess) {
sendScanResult(jumioResult)
} else {
sendCancelResult(jumioResult)
}
if (jumioResult.isSuccess) sendScanResult(jumioResult) else sendCancelResult(jumioResult)
}
true
} else {
false
}
}

private fun init(
authorizationToken: String,
dataCenter: String,
) {
if (authorizationToken.isEmpty() || dataCenter.isEmpty()) {
showErrorMessage("Missing required parameters one-time session authorization token, or dataCenter.")
} else {
try {
initSdk(dataCenter, authorizationToken)
} catch (e: Exception) {
showErrorMessage("Error initializing the Netverify SDK: " + e.localizedMessage)
}
private fun init(authorizationToken: String, dataCenter: String) {
val jumioDataCenter = getJumioDataCenter(dataCenter)

when {
jumioDataCenter == null -> showErrorMessage("Invalid Datacenter value.")
authorizationToken.isEmpty() -> showErrorMessage("Missing required parameters one-time session authorization token.")
else ->
try {
initSdk(dataCenter, authorizationToken)
} catch (e: Exception) {
showErrorMessage("Error initializing the Jumio SDK: " + e.localizedMessage)
}
}
}

private fun initSdk(
dataCenter: String,
authorizationToken: String
) {
private fun initSdk(dataCenter: String, authorizationToken: String) {
val intent = Intent(hostActivity, JumioActivity::class.java).apply {
putExtra(JumioActivity.EXTRA_TOKEN, authorizationToken)
putExtra(JumioActivity.EXTRA_DATACENTER, dataCenter)
Expand All @@ -80,59 +72,66 @@ class JumioModule : ModuleBase() {
private fun sendScanResult(jumioResult: JumioResult) {
val accountId = jumioResult.accountId
val credentialInfoList = jumioResult.credentialInfos
val workflowId = jumioResult.workflowExecutionId

val result = mutableMapOf<String, Any?>(
"accountId" to accountId
"accountId" to accountId,
"workflowId" to workflowId
)
val credentialArray = mutableListOf<MutableMap<String, Any?>>()

credentialInfoList?.let {
credentialInfoList.forEach {
val eventResultMap = mutableMapOf<String, Any?>(
"credentialCategory" to it.category.toString(),
"credentialId" to it.id,
"credentialCategory" to it.category.toString()
)

if (it.category == ID) {
val idResult = jumioResult.getIDResult(it)

idResult?.let {
eventResultMap.putAll(
mapOf(
"selectedCountry" to idResult.country,
"selectedDocumentType" to idResult.idType,
"idNumber" to idResult.documentNumber,
"personalNumber" to idResult.personalNumber,
"issuingDate" to idResult.issuingDate,
"expiryDate" to idResult.expiryDate,
"issuingCountry" to idResult.issuingCountry,
"lastName" to idResult.lastName,
"firstName" to idResult.firstName,
"gender" to idResult.gender,
"nationality" to idResult.nationality,
"dateOfBirth" to idResult.dateOfBirth,
"addressLine" to idResult.address,
"city" to idResult.city,
"subdivision" to idResult.subdivision,
"postCode" to idResult.postalCode,
"placeOfBirth" to idResult.placeOfBirth,
"mrzLine1" to idResult.mrzLine1,
"mrzLine2" to idResult.mrzLine2,
"mrzLine3" to idResult.mrzLine3,
).compact()
)
when (it.category) {
ID -> {
val idResult = jumioResult.getIDResult(it)

idResult?.let {
eventResultMap.putAll(
mapOf(
"selectedCountry" to idResult.country,
"selectedDocumentType" to idResult.idType,
"idNumber" to idResult.documentNumber,
"personalNumber" to idResult.personalNumber,
"issuingDate" to idResult.issuingDate,
"expiryDate" to idResult.expiryDate,
"issuingCountry" to idResult.issuingCountry,
"lastName" to idResult.lastName,
"firstName" to idResult.firstName,
"gender" to idResult.gender,
"nationality" to idResult.nationality,
"dateOfBirth" to idResult.dateOfBirth,
"addressLine" to idResult.address,
"city" to idResult.city,
"subdivision" to idResult.subdivision,
"postCode" to idResult.postalCode,
"placeOfBirth" to idResult.placeOfBirth,
"mrzLine1" to idResult.mrzLine1,
"mrzLine2" to idResult.mrzLine2,
"mrzLine3" to idResult.mrzLine3,
).compact()
)
}
}
} else if (it.category == FACE) {
val faceResult = jumioResult.getFaceResult(it)

faceResult?.let {
eventResultMap.putAll(
mapOf(
"passed" to faceResult.passed.toString(),
).compact()
)
FACE -> {
val faceResult = jumioResult.getFaceResult(it)

faceResult?.let {
eventResultMap.putAll(
mapOf(
"passed" to faceResult.passed.toString(),
).compact()
)
}
}
else -> {}
}

credentialArray.add(eventResultMap)
}
result["credentials"] = credentialArray
Expand All @@ -159,4 +158,10 @@ class JumioModule : ModuleBase() {
)
}
}

private fun getJumioDataCenter(dataCenter: String) = try {
JumioDataCenter.valueOf(dataCenter)
} catch (e: IllegalArgumentException) {
null
}
}
3 changes: 2 additions & 1 deletion example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
compileSdkVersion 31
compileSdkVersion 32

sourceSets {
main.java.srcDirs += 'src/main/kotlin'
Expand All @@ -51,6 +51,7 @@ android {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
}
}
}
Expand Down
40 changes: 40 additions & 0 deletions example/android/app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# To enable ProGuard in your project, edit project.properties
# to define the proguard.config property as described in that file.
#
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in ${sdk.dir}/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the ProGuard
# include property in project.properties.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# Add any project specific keep options here:

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

-keep class io.flutter.embedding.android.FlutterActivity
-keep class com.jumio.** { *; }
-keep class jumio.** { *; }
-keep class com.microblink.** { *; }
-keep class com.microblink.**$* { *; }
-keep public class com.iproov.sdk.IProov {public *; }

-keep class org.jmrtd.** { *; }
-keep class net.sf.scuba.** {*;}
-keep class org.bouncycastle.** {*;}
-keep class org.ejbca.** {*;}

-dontwarn java.nio.**
-dontwarn org.codehaus.**
-dontwarn org.ejbca.**
-dontwarn org.bouncycastle.**
-dontwarn module-info
-dontwarn com.microblink.**
-dontwarn javax.annotation.Nullable
4 changes: 0 additions & 4 deletions example/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,6 @@
screen fades out. A splash screen is useful to avoid any visual
gap between the end of Android's launch screen and the painting of
Flutter's first frame. -->
<meta-data
android:name="io.flutter.embedding.android.SplashScreenDrawable"
android:resource="@drawable/launch_background"
/>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
Expand Down
2 changes: 1 addition & 1 deletion example/android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
buildscript {
ext.kotlin_version = '1.5.30'
ext.kotlin_version = '1.7.0'
repositories {
google()
mavenCentral()
Expand Down
1 change: 0 additions & 1 deletion example/android/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@ org.gradle.jvmargs=-Xmx1536M
android.useAndroidX=true
android.enableJetifier=true
android.enableR8=true
android.jetifier.ignorelist=bcprov-jdk15on
2 changes: 1 addition & 1 deletion example/ios/Flutter/AppFrameworkInfo.plist
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
<key>CFBundleVersion</key>
<string>1.0</string>
<key>MinimumOSVersion</key>
<string>9.0</string>
<string>11.0</string>
</dict>
</plist>

0 comments on commit 2624a9c

Please sign in to comment.