Fix threads sort order, newest first

This commit is contained in:
ariskotsomitopoulos 2021-12-14 16:30:59 +02:00
parent 5ceed4096e
commit 2aa24f0a0d
3 changed files with 5 additions and 2 deletions

View File

@ -27,5 +27,6 @@ data class ThreadDetails(
val numberOfThreads: Int = 0,
val threadSummarySenderInfo: SenderInfo? = null,
val threadSummaryLatestTextMessage: String? = null,
val lastMessageTimestamp: Long? = null,
var threadNotificationState: ThreadNotificationState = ThreadNotificationState.NO_NEW_MESSAGE
)

View File

@ -113,7 +113,9 @@ internal object EventMapper {
)
},
threadNotificationState = eventEntity.threadNotificationState,
threadSummaryLatestTextMessage = eventEntity.threadSummaryLatestMessage?.root?.asDomain()?.getDecryptedTextSummary().orEmpty()
threadSummaryLatestTextMessage = eventEntity.threadSummaryLatestMessage?.root?.asDomain()?.getDecryptedTextSummary().orEmpty(),
lastMessageTimestamp = eventEntity.threadSummaryLatestMessage?.root?.originServerTs
)
}
}

View File

@ -55,7 +55,7 @@ class ThreadListController @Inject constructor(
it.timelineEvent
}
?.forEach { timelineEvent ->
val date = dateFormatter.format(timelineEvent.root.originServerTs, DateFormatKind.ROOM_LIST)
val date = dateFormatter.format(timelineEvent.root.threadDetails?.lastMessageTimestamp, DateFormatKind.ROOM_LIST)
threadList {
id(timelineEvent.eventId)
avatarRenderer(host.avatarRenderer)