Revert "Fix sorting rooms when filtering out events from overview"

This reverts commit 4d3229a321.
This commit is contained in:
SpiritCroc 2020-09-17 12:19:55 +02:00
parent e6cf19fe94
commit 80c2490336
1 changed files with 5 additions and 6 deletions

View File

@ -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<RoomSummary> {
class ChronologicalRoomComparator @Inject constructor() : Comparator<RoomSummary> {
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