Commit 347df4f3 authored by Javokhir's avatar Javokhir
Browse files

Fixed drawable name is null bug

parent c4a91b91
## 1.2.3
* 🔨 Fixed a bug in Android where retrieving a drawable resource by its name caused errors or returned "name is null" error.
## 1.2.2 ## 1.2.2
* 🔥 Added new ability to customize the organization logo used in the SDK flow. * 🔥 Added new ability to customize the organization logo used in the SDK flow.
......
package uz.uzinfocom.myid package uz.uzinfocom.myid
import android.app.Activity import android.app.Activity
import android.content.Context
import android.content.res.Resources.NotFoundException
import android.os.Build import android.os.Build
import io.flutter.plugin.common.MethodChannel import io.flutter.plugin.common.MethodChannel
import uz.myid.android.sdk.capture.MyIdClient import uz.myid.android.sdk.capture.MyIdClient
...@@ -119,9 +121,11 @@ class MyIdSdk( ...@@ -119,9 +121,11 @@ class MyIdSdk(
val orgMap = config["organizationDetails"] as? HashMap<String, Any?> val orgMap = config["organizationDetails"] as? HashMap<String, Any?>
val drawableName = orgMap?.fetch("logo") val drawableName = orgMap?.fetch("logo")
val packageName = currentActivity?.packageName val drawableId = try {
val resources = currentActivity?.resources currentActivity?.resIdByName(drawableName, "drawable")
val drawableId = resources?.getIdentifier(drawableName, "drawable", packageName) } catch (e: NotFoundException) {
null
}
organizationDetails = MyIdOrganizationDetails( organizationDetails = MyIdOrganizationDetails(
phoneNumber = orgMap?.fetch("phone"), phoneNumber = orgMap?.fetch("phone"),
...@@ -202,4 +206,11 @@ class MyIdSdk( ...@@ -202,4 +206,11 @@ class MyIdSdk(
} }
return result?.toString().orEmpty() return result?.toString().orEmpty()
} }
private fun Context.resIdByName(resIdName: String?, resType: String): Int {
resIdName?.let {
return resources.getIdentifier(it, resType, packageName)
}
throw NotFoundException()
}
} }
\ No newline at end of file
...@@ -37,10 +37,6 @@ class _MyAppState extends State<MyApp> { ...@@ -37,10 +37,6 @@ class _MyAppState extends State<MyApp> {
clientHashId: clientHashId, clientHashId: clientHashId,
buildMode: MyIdBuildMode.PRODUCTION, buildMode: MyIdBuildMode.PRODUCTION,
entryType: MyIdEntryType.AUTH, entryType: MyIdEntryType.AUTH,
organizationDetails: const MyIdOrganizationDetails(
phone: "phone",
logo: "logo1",
)
), ),
iosAppearance: const MyIdIOSAppearance() iosAppearance: const MyIdIOSAppearance()
); );
......
...@@ -121,7 +121,7 @@ packages: ...@@ -121,7 +121,7 @@ packages:
path: ".." path: ".."
relative: true relative: true
source: path source: path
version: "1.2.2" version: "1.2.3"
path: path:
dependency: transitive dependency: transitive
description: description:
......
name: myid name: myid
description: MyID SDK plugin for Flutter. Package supports iOS and Android to verify users identity. description: MyID SDK plugin for Flutter. Package supports iOS and Android to verify users identity.
version: 1.2.2 version: 1.2.3
homepage: https://pub.dev/packages/myid homepage: https://pub.dev/packages/myid
repository: https://pub.dev/packages/myid repository: https://pub.dev/packages/myid
issue_tracker: https://gitlab.myid.uz/myid-public-code/myid-sample-flutter/-/issues issue_tracker: https://gitlab.myid.uz/myid-public-code/myid-sample-flutter/-/issues
......
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