mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-09-29 07:52:56 +02:00
Makes stringRes Stable for compose
This commit is contained in:
@@ -49,7 +49,19 @@ fun stringRes(id: Int): String = resourceCache.get(id) ?: stringResource(id).als
|
|||||||
@Composable
|
@Composable
|
||||||
fun stringRes(
|
fun stringRes(
|
||||||
id: Int,
|
id: Int,
|
||||||
vararg args: Any,
|
vararg args: String,
|
||||||
|
): String =
|
||||||
|
String
|
||||||
|
.format(
|
||||||
|
LocalConfiguration.current.locales.get(0),
|
||||||
|
resourceCache.get(id) ?: stringResource(id).also { resourceCache.put(id, it) },
|
||||||
|
*args,
|
||||||
|
)
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun stringRes(
|
||||||
|
id: Int,
|
||||||
|
vararg args: Int?,
|
||||||
): String =
|
): String =
|
||||||
String
|
String
|
||||||
.format(
|
.format(
|
||||||
@@ -66,7 +78,22 @@ fun stringRes(
|
|||||||
fun stringRes(
|
fun stringRes(
|
||||||
ctx: Context,
|
ctx: Context,
|
||||||
id: Int,
|
id: Int,
|
||||||
vararg args: Any?,
|
vararg args: String?,
|
||||||
|
): String {
|
||||||
|
val res = ctx.resources
|
||||||
|
|
||||||
|
return String
|
||||||
|
.format(
|
||||||
|
res.configuration.locales.get(0),
|
||||||
|
resourceCache.get(id) ?: res.getString(id).also { resourceCache.put(id, it) },
|
||||||
|
*args,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun stringRes(
|
||||||
|
ctx: Context,
|
||||||
|
id: Int,
|
||||||
|
vararg args: Int?,
|
||||||
): String {
|
): String {
|
||||||
val res = ctx.resources
|
val res = ctx.resources
|
||||||
|
|
||||||
|
@@ -685,7 +685,7 @@ fun authenticate(
|
|||||||
stringRes(
|
stringRes(
|
||||||
context,
|
context,
|
||||||
R.string.biometric_authentication_failed_explainer_with_error,
|
R.string.biometric_authentication_failed_explainer_with_error,
|
||||||
errString,
|
errString.toString(),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user