Merge branch 'krille/sort-invites-on-top' into 'master'

Sort invites on top

See merge request famedly/famedlysdk!363
This commit is contained in:
Sorunome 2020-06-25 07:32:52 +00:00
commit 66e137582e
1 changed files with 6 additions and 4 deletions

View File

@ -1076,10 +1076,12 @@ class Client {
/// The compare function how the rooms should be sorted internally. By default
/// rooms are sorted by timestamp of the last m.room.message event or the last
/// event if there is no known message.
RoomSorter sortRoomsBy = (a, b) => (a.isFavourite != b.isFavourite)
? (a.isFavourite ? -1 : 1)
: b.timeCreated.millisecondsSinceEpoch
.compareTo(a.timeCreated.millisecondsSinceEpoch);
RoomSorter sortRoomsBy = (a, b) => (a.membership != b.membership)
? (a.membership == Membership.invite ? -1 : 1)
: (a.isFavourite != b.isFavourite)
? (a.isFavourite ? -1 : 1)
: b.timeCreated.millisecondsSinceEpoch
.compareTo(a.timeCreated.millisecondsSinceEpoch);
void _sortRooms() {
if (prevBatch == null || _sortLock || rooms.length < 2) return;