Use new comparator

This commit is contained in:
ismailgulek 2021-06-02 14:31:34 +03:00
parent c51e51d564
commit 5ccf4a4737
No known key found for this signature in database
GPG key ID: E96336D42D9470A9

View file

@ -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];