mirror of
https://github.com/permissionlesstech/bitchat-android.git
synced 2026-08-08 06:46:11 +00:00
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:
parent
fb93d2d85f
commit
156a5f3218
@ -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
13
wear/proguard-rules.pro
vendored
Normal 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
|
||||
@ -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)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user