diff --git a/vector/src/main/java/im/vector/riotredesign/features/home/room/list/RoomSummaryController.kt b/vector/src/main/java/im/vector/riotredesign/features/home/room/list/RoomSummaryController.kt index 1845b1e1..9d8e555f 100644 --- a/vector/src/main/java/im/vector/riotredesign/features/home/room/list/RoomSummaryController.kt +++ b/vector/src/main/java/im/vector/riotredesign/features/home/room/list/RoomSummaryController.kt @@ -18,7 +18,10 @@ package im.vector.riotredesign.features.home.room.list import androidx.annotation.StringRes import com.airbnb.epoxy.TypedEpoxyController +import im.vector.matrix.android.api.session.events.model.EventType +import im.vector.matrix.android.api.session.events.model.toModel import im.vector.matrix.android.api.session.room.model.RoomSummary +import im.vector.matrix.android.api.session.room.model.message.MessageContent import im.vector.riotredesign.core.extensions.localDateTime import im.vector.riotredesign.core.resources.DateProvider import im.vector.riotredesign.core.resources.StringProvider @@ -90,7 +93,12 @@ class RoomSummaryController(private val stringProvider: StringProvider, val currentData = DateProvider.currentLocalDateTime() val isSameDay = date.toLocalDate() == currentData.toLocalDate() //TODO: get formatted - lastMessageFormatted = lastMessage.content?.toString() ?: "" + if (lastMessage.type == EventType.MESSAGE) { + val content = lastMessage.content?.toModel() + lastMessageFormatted = content?.body ?: "" + } else { + lastMessageFormatted = lastMessage.type + } lastMessageTime = if (isSameDay) { timelineDateFormatter.formatMessageHour(date) } else {