Use new comparator

This commit is contained in:
ismailgulek
2021-06-02 14:31:34 +03:00
parent 434a3f8050
commit 9c42f18911
@@ -74,17 +74,8 @@
// Sort rooms according to their last messages (most recent first)
NSComparator comparator = ^NSComparisonResult(MXKRecentCellData *recentCellData1, MXKRecentCellData *recentCellData2) {
NSComparisonResult result = NSOrderedAscending;
if (recentCellData2.roomSummary.lastMessageOriginServerTs > recentCellData1.roomSummary.lastMessageOriginServerTs)
{
result = NSOrderedDescending;
}
else if (recentCellData2.roomSummary.lastMessageOriginServerTs == recentCellData1.roomSummary.lastMessageOriginServerTs)
{
result = NSOrderedSame;
}
return result;
return [recentCellData1.roomSummary.lastMessage compareOriginServerTs:recentCellData2.roomSummary.lastMessage];
};
[cellData sortUsingComparator:comparator];