android: show message time instead of message id in bubbles
Some checks failed
CI / test (push) Failing after 2m10s

This commit is contained in:
Codex
2026-03-09 14:19:14 +03:00
parent c835dfda15
commit e2a87ffb2e

View File

@@ -55,6 +55,9 @@ import androidx.hilt.navigation.compose.hiltViewModel
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import coil.compose.AsyncImage
import ru.daemonlord.messenger.domain.message.model.MessageItem
import java.time.Instant
import java.time.ZoneId
import java.time.format.DateTimeFormatter
@Composable
fun ChatRoute(
@@ -609,7 +612,7 @@ private fun MessageBubble(
else -> ""
}
Text(
text = "${message.id}$status",
text = "${formatMessageTime(message.createdAt)}$status",
style = MaterialTheme.typography.labelSmall,
)
}
@@ -617,6 +620,17 @@ private fun MessageBubble(
}
}
private val messageTimeFormatter: DateTimeFormatter = DateTimeFormatter.ofPattern("HH:mm")
private fun formatMessageTime(createdAt: String): String {
return runCatching {
Instant.parse(createdAt)
.atZone(ZoneId.systemDefault())
.toLocalTime()
.format(messageTimeFormatter)
}.getOrElse { "--:--" }
}
@Composable
private fun AudioAttachmentPlayer(url: String) {
var isPlaying by remember(url) { mutableStateOf(false) }