This commit is contained in:
Eric85710 2026-05-21 17:34:13 +08:00
parent 91882fecb1
commit 5ba40c2b3b

View file

@ -169,11 +169,14 @@ fun Tg_Message(
}
val ChatRoom.displayTitle: String
get() = when (roomType) {
val ChatRoom?.displayTitle: String
get() {
if (this == null) return "未知聊天室"
return when (roomType) {
"direct", "dm" -> partner?.displayName ?: partner?.username ?: "未知使用者"
else -> roomName ?: "未命名群組"
}
}
@OptIn(ExperimentalMaterial3Api::class)
@Composable
@ -322,6 +325,8 @@ fun RoomItem(
// 🚀 修正 2:onClick 改成攜帶兩個參數 (roomId, roomName)
onClick: (String, String) -> Unit
) {
val title = room.displayTitle
Card(
modifier = Modifier
.fillMaxWidth()