From 80c2490336ee1d6151bd2e7a52b5267bc419f47b Mon Sep 17 00:00:00 2001 From: SpiritCroc Date: Thu, 17 Sep 2020 12:19:55 +0200 Subject: [PATCH] Revert "Fix sorting rooms when filtering out events from overview" This reverts commit 4d3229a3212c60efd07b509eeda77a7554711037. --- .../home/room/list/ChronologicalRoomComparator.kt | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/vector/src/main/java/im/vector/app/features/home/room/list/ChronologicalRoomComparator.kt b/vector/src/main/java/im/vector/app/features/home/room/list/ChronologicalRoomComparator.kt index 8087efc7dd..06616683bc 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/list/ChronologicalRoomComparator.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/list/ChronologicalRoomComparator.kt @@ -16,19 +16,18 @@ package im.vector.app.features.home.room.list -import im.vector.app.features.home.room.ScSdkPreferences import org.matrix.android.sdk.api.session.room.model.RoomSummary import javax.inject.Inject -class ChronologicalRoomComparator @Inject constructor(val scSdkPreferences: ScSdkPreferences) : Comparator { +class ChronologicalRoomComparator @Inject constructor() : Comparator { override fun compare(leftRoomSummary: RoomSummary?, rightRoomSummary: RoomSummary?): Int { return when { - rightRoomSummary?.scLatestPreviewableEvent(scSdkPreferences)?.root == null -> -1 - leftRoomSummary?.scLatestPreviewableEvent(scSdkPreferences)?.root == null -> 1 + rightRoomSummary?.latestPreviewableEvent?.root == null -> -1 + leftRoomSummary?.latestPreviewableEvent?.root == null -> 1 else -> { - val rightTimestamp = rightRoomSummary.scLatestPreviewableEvent(scSdkPreferences)?.root?.originServerTs ?: 0 - val leftTimestamp = leftRoomSummary.scLatestPreviewableEvent(scSdkPreferences)?.root?.originServerTs ?: 0 + val rightTimestamp = rightRoomSummary.latestPreviewableEvent?.root?.originServerTs ?: 0 + val leftTimestamp = leftRoomSummary.latestPreviewableEvent?.root?.originServerTs ?: 0 val deltaTimestamp = rightTimestamp - leftTimestamp