wear: perf - debug-signed R8 release build for on-device testing, Gson keep rules, cache time formatter, memoize file chip stat

This commit is contained in:
callebtc 2026-07-28 22:16:32 +02:00
parent fb93d2d85f
commit 156a5f3218
3 changed files with 25 additions and 6 deletions

View File

@ -30,6 +30,9 @@ android {
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
// Sign with the debug key so release builds can be installed over the
// debug app during development (same signature = seamless upgrade).
signingConfig = signingConfigs.getByName("debug")
}
}

13
wear/proguard-rules.pro vendored Normal file
View File

@ -0,0 +1,13 @@
# Gson reflection targets in the shared bitchat sources (persisted state payloads).
-keep class com.bitchat.android.favorites.** { *; }
-keep class com.bitchat.android.services.SeenMessageStore$* { *; }
-keepclassmembers class * {
@com.google.gson.annotations.SerializedName <fields>;
}
# Kotlin metadata needed by reflection-based serialization.
-keepattributes Signature, InnerClasses, EnclosingMethod
# Tink references JSR-305 annotations not present on Android.
-dontwarn javax.annotation.Nullable
-dontwarn javax.annotation.concurrent.GuardedBy

View File

@ -221,10 +221,12 @@ fun MessageItem(
onOpen = onOpenImage
)
BitchatMessageType.Audio -> VoiceNoteItem(path = message.content.trim())
BitchatMessageType.File -> FileMessageChip(
name = File(message.content.trim()).name,
sizeBytes = File(message.content.trim()).length()
)
BitchatMessageType.File -> {
val path = message.content.trim()
val file = remember(path) { File(path) }
val sizeBytes = remember(path) { file.length() }
FileMessageChip(name = file.name, sizeBytes = sizeBytes)
}
BitchatMessageType.Message -> Text(
text = message.content,
style = ChatVisualTokens.MessageBodyStyle,
@ -235,5 +237,6 @@ fun MessageItem(
}
}
private fun formatTime(date: Date): String =
SimpleDateFormat("HH:mm", Locale.getDefault()).format(date)
private val timeFormat = SimpleDateFormat("HH:mm", Locale.getDefault())
private fun formatTime(date: Date): String = timeFormat.format(date)