Commit 7e4c8eae authored by Javohir Savriy's avatar Javohir Savriy
Browse files

Merge branch '2.1.3' into '2.1.2'

Published 2.1.3 version

See merge request !4
parents cb054ff2 7c9fe85b
......@@ -2,6 +2,18 @@
All notable changes to this project will be documented in this file.
## [2.1.3] - 30 Jan, 2023
### New features
- Added an option to handle result on `onActivityResult` method. For more information, please visit our [README](README.md#with-onactivityresult-method).
- Added Content-Language for every request.
### Changed features
- UI: Increased image compression quality parameter.
- UI: Improved Auth screen ui components
## [2.1.2] - 25 Nov, 2022
### New features
......
......@@ -51,11 +51,11 @@ libraries (For example libs) and copy MyID SDK provided libraries.
Add reference to library to module **_build.gradle_**:
``` gradle
implementation(files("libs/myid-sdk-2.1.2-release.aar"))
implementation(files("libs/myid-sdk-2.1.3-release.aar"))
```
**Note:** You can get `myid-sdk-2.1.2-release.aar` file
from [here](app/libs/myid-sdk-2.1.2-release.aar)
**Note:** You can get `myid-sdk-2.1.3-release.aar` file
from [here](android-sample/app/libs/myid-sdk-2.1.3-release.aar)
After synchronization, You should be able to access to SDK classes from your source code.
......@@ -63,7 +63,7 @@ MyID Android SDK also requires following libraries to be added:
``` gradle
dependencies {
implementation(files("libs/myid-sdk-2.1.2-release.aar"))
implementation(files("libs/myid-sdk-2.1.3-release.aar"))
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4")
......@@ -104,8 +104,10 @@ Add following lines to the **_AndroidManifest.xml_**:
## Usage
### With Activity Result API
``` kotlin
class YourActivity : AppCompatActivity(), MyIdResultListener {
class ExampleActivity : AppCompatActivity(), MyIdResultListener {
private val myIdClient = MyIdClient()
......@@ -142,6 +144,53 @@ class YourActivity : AppCompatActivity(), MyIdResultListener {
}
```
### With `onActivityResult` method
``` kotlin
class ExampleActivity : AppCompatActivity(), MyIdResultListener {
private val myIdClient = MyIdClient()
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
startMyId()
}
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
myIdClient.handleActivityResult(resultCode, this)
}
private fun startMyId() {
val organizationDetails = OrganizationDetails(
phoneNumber = "1234567",
logo = R.drawable.image_logo
)
val myIdConfig = MyIdConfig.builder(clientId = /* Your client id */)
.withPassportData(passportData)
.withBirthDate(dateOfBirth)
.withSdkHash(sdkHash)
.withExternalId(externalId)
.withThreshold(threshold)
.withBuildMode(MyIdBuildMode.PRODUCTION)
.withEntryType(MyIdEntryType.AUTH)
.withLocale(Locale("en"))
.withCameraShape(MyIdCameraShape.CIRCLE)
.withOrganizationDetails(organizationDetails)
.withPhoto(false)
.build()
/*
Start the flow. 1 should be your request code (customize as needed).
Must be an Activity or Fragment (support library).
This request code will be important for you on onActivityResult() to identify the MyIdResultListener.
*/
myIdClient.startActivityForResult(this, 1, myIdConfig)
}
}
```
### 1.1 Methods
Method | Notes | Default
......
......@@ -37,7 +37,7 @@ android {
}
dependencies {
implementation(files("libs/myid-sdk-2.1.2-release.aar"))
implementation(files("libs/myid-sdk-2.1.3-release.aar"))
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4")
......@@ -52,12 +52,12 @@ dependencies {
implementation("androidx.camera:camera-lifecycle:$cameraVersion")
implementation("androidx.camera:camera-view:$cameraVersion")
implementation("io.ktor:ktor-client-android:2.1.2")
implementation("io.sentry:sentry-android:6.7.0-alpha.1")
implementation("com.google.android.gms:play-services-mlkit-face-detection:17.1.0")
implementation("com.google.android.gms:play-services-mlkit-text-recognition:18.0.2")
implementation("com.google.android.gms:play-services-mlkit-barcode-scanning:18.1.0")
implementation("io.ktor:ktor-client-android:2.1.2")
implementation("io.sentry:sentry-android:6.7.0-alpha.1")
implementation("com.google.android.material:material:1.7.0")
implementation("com.google.android.material:material:1.8.0")
}
\ No newline at end of file
package uz.myid.sdk.sample
import android.content.Intent
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import uz.myid.android.sdk.capture.*
import uz.myid.android.sdk.capture.model.OrganizationDetails
import java.util.*
class ExampleWithOnActivityResultActivity : AppCompatActivity(), MyIdResultListener {
private val myIdClient = MyIdClient()
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
startMyId()
}
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
myIdClient.handleActivityResult(resultCode, this)
}
override fun onSuccess(result: MyIdResult) {
// Get face bitmap and result code
}
override fun onError(e: MyIdException) {
// Get error message and code
}
override fun onUserExited() {
// User exited sdk
}
private fun startMyId() {
val clientId = "client_id"
val passportData = "passport_data"
val dateOfBirth = "date_of_birth"
val sdkHash = "sdk_hash"
val externalId = "external_id"
val threshold = 0.50f
val organizationDetails = OrganizationDetails(
phoneNumber = "1234567",
)
val myIdConfig = MyIdConfig.Builder(clientId)
.withPassportData(passportData)
.withBirthDate(dateOfBirth)
.withSdkHash(sdkHash)
.withExternalId(externalId)
.withThreshold(threshold)
.withBuildMode(MyIdBuildMode.PRODUCTION)
.withEntryType(MyIdEntryType.AUTH)
.withLocale(Locale("en"))
.withCameraShape(MyIdCameraShape.CIRCLE)
.withOrganizationDetails(organizationDetails)
.withPhoto(false)
.build()
/*
Start the flow. 1 should be your request code (customize as needed).
Must be an Activity or Fragment (support library).
This request code will be important for you on onActivityResult() to identify the MyIdResultListener.
*/
myIdClient.startActivityForResult(this, 1, myIdConfig)
}
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment