feat: Implement iOS support and unify Compose Multiplatform infrastructure (#4876)

This commit is contained in:
James Rich 2026-03-21 18:19:13 -05:00 committed by GitHub
parent f04924ded5
commit d136b162a4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
170 changed files with 2208 additions and 2432 deletions

View file

@ -25,12 +25,22 @@ fun getString(stringResource: StringResource): String = runBlocking { composeGet
/** Retrieves a formatted string from the [StringResource] in a blocking manner. */
fun getString(stringResource: StringResource, vararg formatArgs: Any): String = runBlocking {
val pattern = composeGetString(stringResource)
if (formatArgs.isNotEmpty()) {
val resolvedArgs =
formatArgs
.map { arg ->
if (arg is StringResource) {
composeGetString(arg)
} else {
arg
}
}
.toTypedArray()
if (resolvedArgs.isNotEmpty()) {
@Suppress("SpreadOperator")
pattern.format(*formatArgs)
composeGetString(stringResource, *resolvedArgs)
} else {
pattern
composeGetString(stringResource)
}
}
@ -50,11 +60,10 @@ suspend fun getStringSuspend(stringResource: StringResource, vararg formatArgs:
}
.toTypedArray()
val pattern = composeGetString(stringResource)
return if (resolvedArgs.isNotEmpty()) {
@Suppress("SpreadOperator")
pattern.format(*resolvedArgs)
composeGetString(stringResource, *resolvedArgs)
} else {
pattern
composeGetString(stringResource)
}
}