From 23feb04ddd5fad5b08d707d6c17fd3c4a82728c6 Mon Sep 17 00:00:00 2001 From: Brandon McAnsh Date: Fri, 30 Oct 2026 11:54:40 -0400 Subject: [PATCH] fix(resources): read Compose strings through the Compose loader on Android #1894 moved the transaction-history titles from R.string to Res.string, and AndroidResources resolved a StringResource back to R by name with getIdentifier. Nothing references those strings by id anymore, so the release resource shrinker strips all 36 of them (resources.txt: "string:title_activity_sentTo ... is not reachable") and the lookup returns "". Feed rows with a resolved counterparty ("Sent to X", "Received from X", tips, boosts, converts) render with no title, as do the transaction-details titles, subtitles and status labels. Read the string with Compose's getString instead, as the desktop ComposeResourceHelper already does. The composeResources .cvr assets ship in the release APK and the shrinker leaves them alone. --- .../com/getcode/util/resources/AndroidResources.kt | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/ui/resources/src/androidMain/kotlin/com/getcode/util/resources/AndroidResources.kt b/ui/resources/src/androidMain/kotlin/com/getcode/util/resources/AndroidResources.kt index c1b7463d3b..a007dc57db 100644 --- a/ui/resources/src/androidMain/kotlin/com/getcode/util/resources/AndroidResources.kt +++ b/ui/resources/src/androidMain/kotlin/com/getcode/util/resources/AndroidResources.kt @@ -10,7 +10,9 @@ import androidx.annotation.RawRes import androidx.annotation.StringRes import androidx.appcompat.content.res.AppCompatResources import androidx.core.content.res.ResourcesCompat +import kotlinx.coroutines.runBlocking import org.jetbrains.compose.resources.StringResource +import org.jetbrains.compose.resources.getString as getComposeString import timber.log.Timber import java.io.File @@ -26,12 +28,11 @@ class AndroidResources( return context.getString(resourceId, *formatArgs) } - // Compose resources keep the Android resource name as their key, and every module's resources are - // merged into the app package, so the key resolves to the same R entry Android always read. - override fun getString(resource: StringResource, vararg formatArgs: Any): String { - val id = getIdentifier(resource.key, ResourceType.String) ?: return "" - return context.getString(id, *formatArgs) - } + // Read through the Compose loader (the packaged composeResources assets), not R by the resource's + // key: a string reached only through that name lookup looks unused to the release resource + // shrinker, which strips it, so every such title rendered blank in shipped builds. + override fun getString(resource: StringResource, vararg formatArgs: Any): String = + runBlocking { getComposeString(resource, *formatArgs) } override fun getRawResource(@RawRes resourceId: Int): String { return try {