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
* 🔥 Added new ability to customize the organization logo used in the SDK flow.
......
package uz.uzinfocom.myid
import android.app.Activity
import android.content.Context
import android.content.res.Resources.NotFoundException
import android.os.Build
import io.flutter.plugin.common.MethodChannel
import uz.myid.android.sdk.capture.MyIdClient
......@@ -119,9 +121,11 @@ class MyIdSdk(
val orgMap = config["organizationDetails"] as? HashMap<String, Any?>
val drawableName = orgMap?.fetch("logo")
val packageName = currentActivity?.packageName
val resources = currentActivity?.resources
val drawableId = resources?.getIdentifier(drawableName, "drawable", packageName)
val drawableId = try {
currentActivity?.resIdByName(drawableName, "drawable")
} catch (e: NotFoundException) {
null
}
organizationDetails = MyIdOrganizationDetails(
phoneNumber = orgMap?.fetch("phone"),
......@@ -202,4 +206,11 @@ class MyIdSdk(
}
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> {
clientHashId: clientHashId,
buildMode: MyIdBuildMode.PRODUCTION,
entryType: MyIdEntryType.AUTH,
organizationDetails: const MyIdOrganizationDetails(
phone: "phone",
logo: "logo1",
)
),
iosAppearance: const MyIdIOSAppearance()
);
......
......@@ -121,7 +121,7 @@ packages:
path: ".."
relative: true
source: path
version: "1.2.2"
version: "1.2.3"
path:
dependency: transitive
description:
......
name: myid
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
repository: https://pub.dev/packages/myid
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