Commit b89a8a42 authored by Javokhir's avatar Javokhir
Browse files

2.2.7

parent bc38de4a
...@@ -2,10 +2,20 @@ ...@@ -2,10 +2,20 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
## [2.2.7] - 2 Nov, 2023
- Added new `withMinAge(value: Int)` method for the minimum age to use the MyID service.
- 🔨 Fixed PINFL bug on versions below Android 8.1.
- Added error texts in inputs.
## [2.2.6] - 22 Oct, 2023
- Added new `withScreenOrientation(value: MyIdScreenOrientation)` method for screen orientation.
## [2.2.5] - 19 Oct, 2023 ## [2.2.5] - 19 Oct, 2023
- 🔐 Added enhanced security measures - 🔐 Added enhanced security measures.
- Added `withClientHash` method, which is mandatory if using withEntryType(AUTH) - Added `withClientHash` method, which is mandatory if using withEntryType(MyIdEntryType.AUTH).
## [2.2.4] - 20 Sep, 2023 ## [2.2.4] - 20 Sep, 2023
......
...@@ -36,8 +36,6 @@ You can define custom colors inside your own `colors.xml` file: ...@@ -36,8 +36,6 @@ You can define custom colors inside your own `colors.xml` file:
* `myidColorPrimary`: Defines the color of SDK which guides the user through the flow * `myidColorPrimary`: Defines the color of SDK which guides the user through the flow
* `myidColorSecondary`: Defines the color of the frames
* `myidColorError`: Defines the color of the error buttons, icons and states * `myidColorError`: Defines the color of the error buttons, icons and states
* `myidPrimaryButtonColor`: Defines the background color of the primary action buttons * `myidPrimaryButtonColor`: Defines the background color of the primary action buttons
......
...@@ -45,7 +45,7 @@ repositories { ...@@ -45,7 +45,7 @@ repositories {
} }
dependencies { dependencies {
implementation("uz.myid.sdk.capture:myid-capture-sdk:2.2.5") implementation("uz.myid.sdk.capture:myid-capture-sdk:2.2.7")
} }
``` ```
...@@ -67,7 +67,7 @@ Add following lines to the **_AndroidManifest.xml_**: ...@@ -67,7 +67,7 @@ Add following lines to the **_AndroidManifest.xml_**:
``` kotlin ``` kotlin
class ExampleActivity : AppCompatActivity(), MyIdResultListener { class ExampleActivity : AppCompatActivity(), MyIdResultListener {
private val myIdClient = MyIdClient() private val client = MyIdClient()
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
...@@ -80,25 +80,14 @@ class ExampleActivity : AppCompatActivity(), MyIdResultListener { ...@@ -80,25 +80,14 @@ class ExampleActivity : AppCompatActivity(), MyIdResultListener {
logo = R.drawable.image_logo logo = R.drawable.image_logo
) )
val myIdConfig = MyIdConfig.builder(clientId = /* Your client id */) val config = MyIdConfig.builder(clientId = /* Your client id */)
.withClientHash(/* Your clientHash */, /* Your clientHashId */) .withClientHash(/* Your clientHash */, /* Your clientHashId */)
.withPassportData(passportData) .withPassportData(passportData)
.withBirthDate(dateOfBirth) .withBirthDate(dateOfBirth)
.withSdkHash(sdkHash)
.withExternalId(externalId)
.withThreshold(threshold)
.withBuildMode(MyIdBuildMode.PRODUCTION) .withBuildMode(MyIdBuildMode.PRODUCTION)
.withEntryType(MyIdEntryType.AUTH)
.withResidency(MyIdResidentType.RESIDENT)
.withLocale(Locale("en"))
.withCameraShape(MyIdCameraShape.CIRCLE)
.withResolution(MyIdResolution.RESOLUTION_480)
.withImageFormat(MyIdImageFormat.PNG)
.withOrganizationDetails(organizationDetails)
.withPhoto(false)
.build() .build()
val intent = client.createIntent(activity = this, myIdConfig = myIdConfig) val intent = client.createIntent(activity = this, config)
result.launch(intent) result.launch(intent)
} }
...@@ -111,7 +100,7 @@ class ExampleActivity : AppCompatActivity(), MyIdResultListener { ...@@ -111,7 +100,7 @@ class ExampleActivity : AppCompatActivity(), MyIdResultListener {
``` kotlin ``` kotlin
class ExampleActivity : AppCompatActivity(), MyIdResultListener { class ExampleActivity : AppCompatActivity(), MyIdResultListener {
private val myIdClient = MyIdClient() private val client = MyIdClient()
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
...@@ -120,7 +109,7 @@ class ExampleActivity : AppCompatActivity(), MyIdResultListener { ...@@ -120,7 +109,7 @@ class ExampleActivity : AppCompatActivity(), MyIdResultListener {
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data) super.onActivityResult(requestCode, resultCode, data)
myIdClient.handleActivityResult(resultCode, this) client.handleActivityResult(resultCode, this)
} }
private fun startMyId() { private fun startMyId() {
...@@ -129,22 +118,11 @@ class ExampleActivity : AppCompatActivity(), MyIdResultListener { ...@@ -129,22 +118,11 @@ class ExampleActivity : AppCompatActivity(), MyIdResultListener {
logo = R.drawable.image_logo logo = R.drawable.image_logo
) )
val myIdConfig = MyIdConfig.builder(clientId = /* Your client id */) val config = MyIdConfig.builder(clientId = /* Your client id */)
.withClientHash(/* Your clientHash */, /* Your clientHashId */) .withClientHash(/* Your clientHash */, /* Your clientHashId */)
.withPassportData(passportData) .withPassportData(passportData)
.withBirthDate(dateOfBirth) .withBirthDate(dateOfBirth)
.withSdkHash(sdkHash)
.withExternalId(externalId)
.withThreshold(threshold)
.withBuildMode(MyIdBuildMode.PRODUCTION) .withBuildMode(MyIdBuildMode.PRODUCTION)
.withEntryType(MyIdEntryType.AUTH)
.withResidency(MyIdResidentType.RESIDENT)
.withLocale(Locale("en"))
.withCameraShape(MyIdCameraShape.CIRCLE)
.withResolution(MyIdResolution.RESOLUTION_480)
.withImageFormat(MyIdImageFormat.PNG)
.withOrganizationDetails(organizationDetails)
.withPhoto(false)
.build() .build()
/* /*
...@@ -152,7 +130,7 @@ class ExampleActivity : AppCompatActivity(), MyIdResultListener { ...@@ -152,7 +130,7 @@ class ExampleActivity : AppCompatActivity(), MyIdResultListener {
Must be an Activity or Fragment (support library). Must be an Activity or Fragment (support library).
This request code will be important for you on onActivityResult() to identify the MyIdResultListener. This request code will be important for you on onActivityResult() to identify the MyIdResultListener.
*/ */
myIdClient.startActivityForResult(this, 1, myIdConfig) client.startActivityForResult(this, 1, config)
} }
} }
``` ```
...@@ -163,16 +141,18 @@ Method | Notes | Default ...@@ -163,16 +141,18 @@ Method | Notes | Default
--- | --- | --- --- | --- | ---
`withClientHash(clientHash: String, clientHashId: String)` | Provided by MyID sales team | Mandatory, if using withEntryType(MyIdEntryType.AUTH) `withClientHash(clientHash: String, clientHashId: String)` | Provided by MyID sales team | Mandatory, if using withEntryType(MyIdEntryType.AUTH)
`withPassportData(value: String)` | Passport serial number or PINFL data | Optional `withPassportData(value: String)` | Passport serial number or PINFL data | Optional
`withBirthDate(value: String)` | Date of birth in. Format: `dd.MM.yyyy` | Optional `withBirthDate(value: String)` | Date of birth. Format: `dd.MM.yyyy` | Optional
`withSdkHash(value: String)` | 32 characters long string | Optional `withMinAge(value: Int)` | To set a specific minimum age to use MyID service | 16
`withSdkHash(value: String)` | 32 characters long string (Note 1.2) | Optional
`withExternalId(value: String)` | 36 characters long. Should match with UUID4 regex | Optional `withExternalId(value: String)` | 36 characters long. Should match with UUID4 regex | Optional
`withThreshold(value: Float)` | The value can be in the range of `0.50` - `0.99` | 0.50 `withThreshold(value: Float)` | The value can be in the range of `0.50` - `0.99` | 0.50
`withBuildMode(value: MyIdBuildMode)` | Build mode | MyIdBuildMode.PRODUCTION `withBuildMode(value: MyIdBuildMode)` | Build mode (Note 1.4) | MyIdBuildMode.PRODUCTION
`withEntryType(value: MyIdEntryType)` | Customizing the SDK Entry types | MyIdEntryType.AUTH `withEntryType(value: MyIdEntryType)` | Customizing the SDK Entry types (Note 1.5) | MyIdEntryType.AUTH
`withResidency(value: MyIdResidentType)` | To set a specific resident type | MyIdResidentType.RESIDENT `withResidency(value: MyIdResidentType)` | To set a specific resident type | MyIdResidentType.RESIDENT
`withLocale(value: Locale)` | To set a specific locale | Locale("uz") `withLocale(value: Locale)` | To set a specific locale | Locale("uz")
`withCameraShape(value: MyIdCameraShape)` | To set a specific camera shape | MyIdCameraShape.CIRCLE `withCameraShape(value: MyIdCameraShape)` | To set a specific camera shape (Note 1.6) | MyIdCameraShape.CIRCLE
`withResolution(value: MyIdResolution)` | To set a specific camera resolution | MyIdResolution.RESOLUTION_480 `withResolution(value: MyIdResolution)` | To set a specific camera resolution | MyIdResolution.RESOLUTION_480
`withScreenOrientation(value: MyIdScreenOrientation)` | To set a specific screen orientation | MyIdScreenOrientation.FULL
`withImageFormat(value: MyIdImageFormat)` | To set a specific image format | MyIdImageFormat.PNG `withImageFormat(value: MyIdImageFormat)` | To set a specific image format | MyIdImageFormat.PNG
`withOrganizationDetails(value: MyIdOrganizationDetails)` | Custom Organization Details | Optional `withOrganizationDetails(value: MyIdOrganizationDetails)` | Custom Organization Details | Optional
`withPhoto(value: Boolean)` | Return SDK face bitmap | false `withPhoto(value: Boolean)` | Return SDK face bitmap | false
...@@ -204,7 +184,7 @@ and **[ELLIPSE](images/screen04.jpg)** types. ...@@ -204,7 +184,7 @@ and **[ELLIPSE](images/screen04.jpg)** types.
### 1.2 Handling callbacks ### 1.2 Handling callbacks
```kotlin ```kotlin
val myIdResultListener: MyIdResultListener = object : MyIdResultListener { val resultListener: MyIdResultListener = object : MyIdResultListener {
override fun onSuccess(result: MyIdResult) { override fun onSuccess(result: MyIdResult) {
// Get face bitmap and result code // Get face bitmap and result code
......
...@@ -35,5 +35,5 @@ android { ...@@ -35,5 +35,5 @@ android {
dependencies { dependencies {
implementation("com.google.android.material:material:1.10.0") implementation("com.google.android.material:material:1.10.0")
implementation("uz.myid.sdk.capture:myid-capture-sdk:2.2.5") implementation("uz.myid.sdk.capture:myid-capture-sdk:2.2.7")
} }
\ No newline at end of file
...@@ -9,23 +9,16 @@ import androidx.activity.result.ActivityResultLauncher; ...@@ -9,23 +9,16 @@ import androidx.activity.result.ActivityResultLauncher;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import java.util.Locale;
import uz.myid.android.sdk.capture.MyIdClient; import uz.myid.android.sdk.capture.MyIdClient;
import uz.myid.android.sdk.capture.MyIdConfig; import uz.myid.android.sdk.capture.MyIdConfig;
import uz.myid.android.sdk.capture.MyIdException; import uz.myid.android.sdk.capture.MyIdException;
import uz.myid.android.sdk.capture.MyIdResult; import uz.myid.android.sdk.capture.MyIdResult;
import uz.myid.android.sdk.capture.MyIdResultListener; import uz.myid.android.sdk.capture.MyIdResultListener;
import uz.myid.android.sdk.capture.model.MyIdBuildMode; import uz.myid.android.sdk.capture.model.MyIdBuildMode;
import uz.myid.android.sdk.capture.model.MyIdCameraShape;
import uz.myid.android.sdk.capture.model.MyIdEntryType;
import uz.myid.android.sdk.capture.model.MyIdImageFormat;
import uz.myid.android.sdk.capture.model.MyIdResidentType;
import uz.myid.android.sdk.capture.model.MyIdResolution;
public class ExampleJavaActivity extends AppCompatActivity implements MyIdResultListener { public class ExampleJavaActivity extends AppCompatActivity implements MyIdResultListener {
private final MyIdClient myIdClient = new MyIdClient(); private final MyIdClient client = new MyIdClient();
@Override @Override
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
...@@ -50,29 +43,19 @@ public class ExampleJavaActivity extends AppCompatActivity implements MyIdResult ...@@ -50,29 +43,19 @@ public class ExampleJavaActivity extends AppCompatActivity implements MyIdResult
private void startMyId() { private void startMyId() {
String clientId = "client_id"; String clientId = "client_id";
String clientHash = "client_hash";
String clientHashId = "client_hash_id";
String passportData = "passport_data"; String passportData = "passport_data";
String dateOfBirth = "date_of_birth"; String dateOfBirth = "date_of_birth";
String sdkHash = "sdk_hash";
String externalId = "external_id";
float threshold = 0.5f;
MyIdConfig myIdConfig = new MyIdConfig.Builder(clientId) MyIdConfig config = new MyIdConfig.Builder(clientId)
.withClientHash(clientHash, clientHashId)
.withPassportData(passportData) .withPassportData(passportData)
.withBirthDate(dateOfBirth) .withBirthDate(dateOfBirth)
.withSdkHash(sdkHash)
.withExternalId(externalId)
.withThreshold(threshold)
.withBuildMode(MyIdBuildMode.PRODUCTION) .withBuildMode(MyIdBuildMode.PRODUCTION)
.withEntryType(MyIdEntryType.AUTH)
.withResidency(MyIdResidentType.RESIDENT)
.withLocale(new Locale("en"))
.withCameraShape(MyIdCameraShape.CIRCLE)
.withResolution(MyIdResolution.RESOLUTION_480)
.withImageFormat(MyIdImageFormat.PNG)
.withPhoto(false)
.build(); .build();
Intent intent = myIdClient.createIntent(this, myIdConfig); Intent intent = client.createIntent(this, config);
result.launch(intent); result.launch(intent);
} }
......
...@@ -25,7 +25,7 @@ import uz.myid.android.sdk.capture.model.MyIdResolution; ...@@ -25,7 +25,7 @@ import uz.myid.android.sdk.capture.model.MyIdResolution;
public class ExampleJavaFragment extends Fragment implements MyIdResultListener { public class ExampleJavaFragment extends Fragment implements MyIdResultListener {
private final MyIdClient myIdClient = new MyIdClient(); private final MyIdClient client = new MyIdClient();
@Override @Override
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
...@@ -50,29 +50,19 @@ public class ExampleJavaFragment extends Fragment implements MyIdResultListener ...@@ -50,29 +50,19 @@ public class ExampleJavaFragment extends Fragment implements MyIdResultListener
private void startMyId() { private void startMyId() {
String clientId = "client_id"; String clientId = "client_id";
String clientHash = "client_hash";
String clientHashId = "client_hash_id";
String passportData = "passport_data"; String passportData = "passport_data";
String dateOfBirth = "date_of_birth"; String dateOfBirth = "date_of_birth";
String sdkHash = "sdk_hash";
String externalId = "external_id";
float threshold = 0.5f;
MyIdConfig myIdConfig = new MyIdConfig.Builder(clientId) MyIdConfig config = new MyIdConfig.Builder(clientId)
.withClientHash(clientHash, clientHashId)
.withPassportData(passportData) .withPassportData(passportData)
.withBirthDate(dateOfBirth) .withBirthDate(dateOfBirth)
.withSdkHash(sdkHash)
.withExternalId(externalId)
.withThreshold(threshold)
.withBuildMode(MyIdBuildMode.PRODUCTION) .withBuildMode(MyIdBuildMode.PRODUCTION)
.withEntryType(MyIdEntryType.AUTH)
.withResidency(MyIdResidentType.RESIDENT)
.withLocale(new Locale("en"))
.withCameraShape(MyIdCameraShape.CIRCLE)
.withResolution(MyIdResolution.RESOLUTION_480)
.withImageFormat(MyIdImageFormat.PNG)
.withPhoto(false)
.build(); .build();
Intent intent = myIdClient.createIntent(requireActivity(), myIdConfig); Intent intent = client.createIntent(requireActivity(), config);
result.launch(intent); result.launch(intent);
} }
......
...@@ -2,13 +2,17 @@ package uz.myid.sdk.sample ...@@ -2,13 +2,17 @@ package uz.myid.sdk.sample
import android.os.Bundle import android.os.Bundle
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
import uz.myid.android.sdk.capture.* import uz.myid.android.sdk.capture.MyIdClient
import uz.myid.android.sdk.capture.model.* import uz.myid.android.sdk.capture.MyIdConfig
import java.util.* import uz.myid.android.sdk.capture.MyIdException
import uz.myid.android.sdk.capture.MyIdResult
import uz.myid.android.sdk.capture.MyIdResultListener
import uz.myid.android.sdk.capture.model.MyIdBuildMode
import uz.myid.android.sdk.capture.takeUserResult
class ExampleKotlinFragment : Fragment(), MyIdResultListener { class ExampleKotlinFragment : Fragment(), MyIdResultListener {
private val myIdClient = MyIdClient() private val client = MyIdClient()
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
...@@ -29,34 +33,19 @@ class ExampleKotlinFragment : Fragment(), MyIdResultListener { ...@@ -29,34 +33,19 @@ class ExampleKotlinFragment : Fragment(), MyIdResultListener {
private fun startMyId() { private fun startMyId() {
val clientId = "client_id" val clientId = "client_id"
val clientHash = "client_hash"
val clientHashId = "client_hash_id"
val passportData = "passport_data" val passportData = "passport_data"
val dateOfBirth = "date_of_birth" val dateOfBirth = "date_of_birth"
val sdkHash = "sdk_hash"
val externalId = "external_id"
val threshold = 0.50f
val organizationDetails = MyIdOrganizationDetails( val config = MyIdConfig.Builder(clientId)
phoneNumber = "1234567", .withClientHash(clientHash, clientHashId)
)
val myIdConfig = MyIdConfig.Builder(clientId)
.withPassportData(passportData) .withPassportData(passportData)
.withBirthDate(dateOfBirth) .withBirthDate(dateOfBirth)
.withSdkHash(sdkHash)
.withExternalId(externalId)
.withThreshold(threshold)
.withBuildMode(MyIdBuildMode.PRODUCTION) .withBuildMode(MyIdBuildMode.PRODUCTION)
.withEntryType(MyIdEntryType.AUTH)
.withResidency(MyIdResidentType.RESIDENT)
.withLocale(Locale("en"))
.withCameraShape(MyIdCameraShape.CIRCLE)
.withResolution(MyIdResolution.RESOLUTION_480)
.withImageFormat(MyIdImageFormat.PNG)
.withOrganizationDetails(organizationDetails)
.withPhoto(false)
.build() .build()
val intent = myIdClient.createIntent(requireActivity(), myIdConfig) val intent = client.createIntent(requireActivity(), config)
result.launch(intent) result.launch(intent)
} }
......
...@@ -3,13 +3,16 @@ package uz.myid.sdk.sample ...@@ -3,13 +3,16 @@ package uz.myid.sdk.sample
import android.content.Intent import android.content.Intent
import android.os.Bundle import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import uz.myid.android.sdk.capture.* import uz.myid.android.sdk.capture.MyIdClient
import uz.myid.android.sdk.capture.model.* import uz.myid.android.sdk.capture.MyIdConfig
import java.util.* import uz.myid.android.sdk.capture.MyIdException
import uz.myid.android.sdk.capture.MyIdResult
import uz.myid.android.sdk.capture.MyIdResultListener
import uz.myid.android.sdk.capture.model.MyIdBuildMode
class ExampleWithOnActivityResultActivity : AppCompatActivity(), MyIdResultListener { class ExampleWithOnActivityResultActivity : AppCompatActivity(), MyIdResultListener {
private val myIdClient = MyIdClient() private val client = MyIdClient()
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
...@@ -18,7 +21,7 @@ class ExampleWithOnActivityResultActivity : AppCompatActivity(), MyIdResultListe ...@@ -18,7 +21,7 @@ class ExampleWithOnActivityResultActivity : AppCompatActivity(), MyIdResultListe
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data) super.onActivityResult(requestCode, resultCode, data)
myIdClient.handleActivityResult(resultCode, this) client.handleActivityResult(resultCode, this)
} }
override fun onSuccess(result: MyIdResult) { override fun onSuccess(result: MyIdResult) {
...@@ -35,31 +38,16 @@ class ExampleWithOnActivityResultActivity : AppCompatActivity(), MyIdResultListe ...@@ -35,31 +38,16 @@ class ExampleWithOnActivityResultActivity : AppCompatActivity(), MyIdResultListe
private fun startMyId() { private fun startMyId() {
val clientId = "client_id" val clientId = "client_id"
val clientHash = "client_hash"
val clientHashId = "client_hash_id"
val passportData = "passport_data" val passportData = "passport_data"
val dateOfBirth = "date_of_birth" val dateOfBirth = "date_of_birth"
val sdkHash = "sdk_hash"
val externalId = "external_id"
val threshold = 0.50f
val organizationDetails = MyIdOrganizationDetails( val config = MyIdConfig.Builder(clientId)
phoneNumber = "1234567", .withClientHash(clientHash, clientHashId)
)
val myIdConfig = MyIdConfig.Builder(clientId)
.withPassportData(passportData) .withPassportData(passportData)
.withBirthDate(dateOfBirth) .withBirthDate(dateOfBirth)
.withSdkHash(sdkHash)
.withExternalId(externalId)
.withThreshold(threshold)
.withBuildMode(MyIdBuildMode.PRODUCTION) .withBuildMode(MyIdBuildMode.PRODUCTION)
.withEntryType(MyIdEntryType.AUTH)
.withResidency(MyIdResidentType.RESIDENT)
.withLocale(Locale("en"))
.withCameraShape(MyIdCameraShape.CIRCLE)
.withResolution(MyIdResolution.RESOLUTION_480)
.withImageFormat(MyIdImageFormat.PNG)
.withOrganizationDetails(organizationDetails)
.withPhoto(false)
.build() .build()
/* /*
...@@ -67,6 +55,6 @@ class ExampleWithOnActivityResultActivity : AppCompatActivity(), MyIdResultListe ...@@ -67,6 +55,6 @@ class ExampleWithOnActivityResultActivity : AppCompatActivity(), MyIdResultListe
Must be an Activity or Fragment (support library). Must be an Activity or Fragment (support library).
This request code will be important for you on onActivityResult() to identify the MyIdResultListener. This request code will be important for you on onActivityResult() to identify the MyIdResultListener.
*/ */
myIdClient.startActivityForResult(this, 1, myIdConfig) client.startActivityForResult(this, 1, config)
} }
} }
\ No newline at end of file
...@@ -9,15 +9,8 @@ import uz.myid.android.sdk.capture.MyIdException ...@@ -9,15 +9,8 @@ import uz.myid.android.sdk.capture.MyIdException
import uz.myid.android.sdk.capture.MyIdResult import uz.myid.android.sdk.capture.MyIdResult
import uz.myid.android.sdk.capture.MyIdResultListener import uz.myid.android.sdk.capture.MyIdResultListener
import uz.myid.android.sdk.capture.model.MyIdBuildMode import uz.myid.android.sdk.capture.model.MyIdBuildMode
import uz.myid.android.sdk.capture.model.MyIdCameraShape
import uz.myid.android.sdk.capture.model.MyIdEntryType
import uz.myid.android.sdk.capture.model.MyIdImageFormat
import uz.myid.android.sdk.capture.model.MyIdOrganizationDetails
import uz.myid.android.sdk.capture.model.MyIdResidentType
import uz.myid.android.sdk.capture.model.MyIdResolution
import uz.myid.android.sdk.capture.takeUserResult import uz.myid.android.sdk.capture.takeUserResult
import uz.myid.sdk.sample.databinding.ActivityMainBinding import uz.myid.sdk.sample.databinding.ActivityMainBinding
import java.util.Locale
class MainActivity : AppCompatActivity(), MyIdResultListener { class MainActivity : AppCompatActivity(), MyIdResultListener {
...@@ -26,39 +19,12 @@ class MainActivity : AppCompatActivity(), MyIdResultListener { ...@@ -26,39 +19,12 @@ class MainActivity : AppCompatActivity(), MyIdResultListener {
private val client = MyIdClient() private val client = MyIdClient()
private var buildMode = MyIdBuildMode.PRODUCTION private var buildMode = MyIdBuildMode.PRODUCTION
private var entryType = MyIdEntryType.AUTH
private var residency = MyIdResidentType.RESIDENT
private var locale = Locale("en")
private var shape = MyIdCameraShape.CIRCLE
private var code = ""
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
setContentView(binding.root) setContentView(binding.root)
with(binding) { with(binding) {
radioGroupLang.setOnCheckedChangeListener { _, checkedId ->
locale = when (checkedId) {
R.id.radioUz -> Locale("uz")
R.id.radioEn -> Locale("en")
else -> Locale("ru")
}
}
radioGroupEntryType.setOnCheckedChangeListener { _, checkedId ->
entryType = if (checkedId == R.id.radioFace) {
MyIdEntryType.FACE
} else {
MyIdEntryType.AUTH
}
}
radioGroupResidentType.setOnCheckedChangeListener { _, checkedId ->
residency = when (checkedId) {
R.id.radioManual -> MyIdResidentType.USER_DEFINED
R.id.radioNonResident -> MyIdResidentType.NON_RESIDENT
else -> MyIdResidentType.RESIDENT
}
}
radioGroupBuildMode.setOnCheckedChangeListener { _, checkedId -> radioGroupBuildMode.setOnCheckedChangeListener { _, checkedId ->
buildMode = if (checkedId == R.id.radioProd) { buildMode = if (checkedId == R.id.radioProd) {
MyIdBuildMode.PRODUCTION MyIdBuildMode.PRODUCTION
...@@ -66,21 +32,12 @@ class MainActivity : AppCompatActivity(), MyIdResultListener { ...@@ -66,21 +32,12 @@ class MainActivity : AppCompatActivity(), MyIdResultListener {
MyIdBuildMode.DEBUG MyIdBuildMode.DEBUG
} }
} }
radioGroupShape.setOnCheckedChangeListener { _, checkedId ->
shape = if (checkedId == R.id.radioCircle) {
MyIdCameraShape.CIRCLE
} else {
MyIdCameraShape.ELLIPSE
}
}
buttonStart.setOnClickListener { startMyId() } buttonStart.setOnClickListener { startMyId() }
} }
} }
override fun onSuccess(result: MyIdResult) { override fun onSuccess(result: MyIdResult) {
code = result.code.orEmpty()
with(binding) { with(binding) {
imageResult.setImageBitmap(result.bitmap) imageResult.setImageBitmap(result.bitmap)
""" """
...@@ -91,8 +48,6 @@ class MainActivity : AppCompatActivity(), MyIdResultListener { ...@@ -91,8 +48,6 @@ class MainActivity : AppCompatActivity(), MyIdResultListener {
} }
override fun onError(e: MyIdException) { override fun onError(e: MyIdException) {
code = ""
with(binding) { with(binding) {
imageResult.setImageBitmap(null) imageResult.setImageBitmap(null)
""" """
...@@ -103,8 +58,6 @@ class MainActivity : AppCompatActivity(), MyIdResultListener { ...@@ -103,8 +58,6 @@ class MainActivity : AppCompatActivity(), MyIdResultListener {
} }
override fun onUserExited() { override fun onUserExited() {
code = ""
with(binding) { with(binding) {
imageResult.setImageBitmap(null) imageResult.setImageBitmap(null)
"User exited sdk".also { textResult.text = it } "User exited sdk".also { textResult.text = it }
...@@ -112,10 +65,6 @@ class MainActivity : AppCompatActivity(), MyIdResultListener { ...@@ -112,10 +65,6 @@ class MainActivity : AppCompatActivity(), MyIdResultListener {
} }
private fun startMyId() { private fun startMyId() {
val organizationDetails = MyIdOrganizationDetails(
phoneNumber = binding.inputPhoneNumber.value
)
val config = MyIdConfig.builder(binding.inputClientId.value) val config = MyIdConfig.builder(binding.inputClientId.value)
.withClientHash( .withClientHash(
clientHash = binding.inputClientHash.value, clientHash = binding.inputClientHash.value,
...@@ -123,18 +72,7 @@ class MainActivity : AppCompatActivity(), MyIdResultListener { ...@@ -123,18 +72,7 @@ class MainActivity : AppCompatActivity(), MyIdResultListener {
) )
.withPassportData(binding.inputPassportData.value) .withPassportData(binding.inputPassportData.value)
.withBirthDate(binding.inputDate.value) .withBirthDate(binding.inputDate.value)
.withSdkHash(binding.inputSdkHash.value)
.withExternalId(binding.inputExternalId.value)
.withThreshold(binding.thresholdSlider.value)
.withBuildMode(buildMode) .withBuildMode(buildMode)
.withEntryType(entryType)
.withResidency(residency)
.withLocale(locale)
.withCameraShape(shape)
.withOrganizationDetails(organizationDetails)
.withResolution(MyIdResolution.RESOLUTION_480)
.withImageFormat(MyIdImageFormat.PNG)
.withPhoto(binding.checkboxWithPhoto.isChecked)
.build() .build()
val intent = client.createIntent(this, config) val intent = client.createIntent(this, config)
......
...@@ -100,76 +100,6 @@ ...@@ -100,76 +100,6 @@
android:textAppearance="@style/TextAppearance.Material3.BodyLarge" /> android:textAppearance="@style/TextAppearance.Material3.BodyLarge" />
</com.google.android.material.textfield.TextInputLayout> </com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
style="@style/Widget.Material3.TextInputLayout.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:hint="@string/sdk_hash"
app:helperText="* Optional"
app:helperTextEnabled="true">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/inputSdkHash"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:importantForAutofill="no"
android:inputType="textMultiLine"
android:textAppearance="@style/TextAppearance.Material3.BodyLarge" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
style="@style/Widget.Material3.TextInputLayout.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:hint="@string/external_id"
app:helperText="* Optional"
app:helperTextEnabled="true">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/inputExternalId"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:importantForAutofill="no"
android:inputType="textMultiLine"
android:textAppearance="@style/TextAppearance.Material3.BodyLarge" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
style="@style/Widget.Material3.TextInputLayout.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:hint="@string/organization_phone_number"
app:helperText="* Optional"
app:helperTextEnabled="true">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/inputPhoneNumber"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:importantForAutofill="no"
android:inputType="phone"
android:textAppearance="@style/TextAppearance.Material3.BodyLarge" />
</com.google.android.material.textfield.TextInputLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="@string/threshold"
android:textAppearance="@style/TextAppearance.Material3.BodyLarge" />
<com.google.android.material.slider.Slider
android:id="@+id/thresholdSlider"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:stepSize="0.01"
android:valueFrom="0.50"
android:valueTo="0.99"
app:labelBehavior="floating" />
<RadioGroup <RadioGroup
android:id="@+id/radioGroupBuildMode" android:id="@+id/radioGroupBuildMode"
android:layout_width="wrap_content" android:layout_width="wrap_content"
...@@ -194,127 +124,6 @@ ...@@ -194,127 +124,6 @@
android:textAppearance="@style/TextAppearance.Material3.BodyLarge" /> android:textAppearance="@style/TextAppearance.Material3.BodyLarge" />
</RadioGroup> </RadioGroup>
<RadioGroup
android:id="@+id/radioGroupEntryType"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:checkedButton="@id/radioAuth"
android:orientation="horizontal">
<RadioButton
android:id="@+id/radioAuth"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/auth"
android:textAppearance="@style/TextAppearance.Material3.BodyLarge" />
<RadioButton
android:id="@+id/radioFace"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:text="@string/face"
android:textAppearance="@style/TextAppearance.Material3.BodyLarge" />
</RadioGroup>
<RadioGroup
android:id="@+id/radioGroupResidentType"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:checkedButton="@id/radioResident"
android:orientation="horizontal">
<RadioButton
android:id="@+id/radioManual"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/manual"
android:textAppearance="@style/TextAppearance.Material3.BodyLarge" />
<RadioButton
android:id="@+id/radioResident"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:text="@string/resident"
android:textAppearance="@style/TextAppearance.Material3.BodyLarge" />
<RadioButton
android:id="@+id/radioNonResident"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:text="@string/non_resident"
android:textAppearance="@style/TextAppearance.Material3.BodyLarge" />
</RadioGroup>
<RadioGroup
android:id="@+id/radioGroupLang"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:checkedButton="@id/radioEn"
android:orientation="horizontal">
<RadioButton
android:id="@+id/radioUz"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/uzbek"
android:textAppearance="@style/TextAppearance.Material3.BodyLarge" />
<RadioButton
android:id="@+id/radioEn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:text="@string/english"
android:textAppearance="@style/TextAppearance.Material3.BodyLarge" />
<RadioButton
android:id="@+id/radioRu"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:text="@string/russian"
android:textAppearance="@style/TextAppearance.Material3.BodyLarge" />
</RadioGroup>
<RadioGroup
android:id="@+id/radioGroupShape"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:checkedButton="@id/radioCircle"
android:orientation="horizontal">
<RadioButton
android:id="@+id/radioCircle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/circle"
android:textAppearance="@style/TextAppearance.Material3.BodyLarge" />
<RadioButton
android:id="@+id/radioEllipse"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:text="@string/ellipse"
android:textAppearance="@style/TextAppearance.Material3.BodyLarge" />
</RadioGroup>
<CheckBox
android:id="@+id/checkboxWithPhoto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:checked="false"
android:text="@string/with_photo"
android:textAppearance="@style/TextAppearance.Material3.BodyLarge" />
<com.google.android.material.button.MaterialButton <com.google.android.material.button.MaterialButton
android:id="@+id/buttonStart" android:id="@+id/buttonStart"
style="@style/Widget.Material3.Button.UnelevatedButton" style="@style/Widget.Material3.Button.UnelevatedButton"
...@@ -344,6 +153,6 @@ ...@@ -344,6 +153,6 @@
android:layout_width="200dp" android:layout_width="200dp"
android:layout_height="200dp" android:layout_height="200dp"
android:layout_marginTop="16dp" android:layout_marginTop="16dp"
android:contentDescription="@string/image" /> android:importantForAccessibility="no" />
</LinearLayout> </LinearLayout>
</androidx.core.widget.NestedScrollView> </androidx.core.widget.NestedScrollView>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<resources> <resources>
<string name="app_name">MyID Sample</string> <string name="app_name">MyID Sample</string>
<string name="auth">Auth</string>
<string name="birth_date">Birth date</string> <string name="birth_date">Birth date</string>
<string name="circle">Circle</string>
<string name="client_id">Client ID</string> <string name="client_id">Client ID</string>
<string name="client_hash">Client hash</string> <string name="client_hash">Client hash</string>
<string name="client_hash_id">Client hash ID</string> <string name="client_hash_id">Client hash ID</string>
<string name="dev">Dev</string> <string name="dev">Dev</string>
<string name="ellipse">Ellipse</string>
<string name="english">English</string>
<string name="external_id">External id</string>
<string name="face">Face</string>
<string name="image">Image</string>
<string name="manual">Manual</string>
<string name="non_resident">Non resident</string>
<string name="organization_phone_number">Phone number</string>
<string name="passport">Passport or PINFL</string> <string name="passport">Passport or PINFL</string>
<string name="prod">Prod</string> <string name="prod">Prod</string>
<string name="resident">Resident</string>
<string name="result_image">Result image</string> <string name="result_image">Result image</string>
<string name="russian">Russian</string>
<string name="scan_face_data">Scan face data</string> <string name="scan_face_data">Scan face data</string>
<string name="sdk_hash">Sdk hash</string>
<string name="threshold">Threshold</string>
<string name="uzbek">Uzbek</string>
<string name="with_photo">With photo</string>
<string name="without_photo">Without photo</string>
</resources> </resources>
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