forked from cwtch.im/cwtch-ui
contact list sort more often and float unauthed contacts to top
This commit is contained in:
parent
aff7a5f4b2
commit
75acfe8dd0
|
@ -149,6 +149,7 @@ class ContactListState extends ChangeNotifier {
|
|||
servers?.addGroup(contact);
|
||||
}
|
||||
});
|
||||
resort();
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
|
@ -157,6 +158,7 @@ class ContactListState extends ChangeNotifier {
|
|||
if (newContact.isGroup) {
|
||||
servers?.addGroup(newContact);
|
||||
}
|
||||
resort();
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
|
@ -164,12 +166,18 @@ class ContactListState extends ChangeNotifier {
|
|||
_contacts.sort((ContactInfoState a, ContactInfoState b) {
|
||||
// return -1 = a first in list
|
||||
// return 1 = b first in list
|
||||
|
||||
// blocked contacts last
|
||||
if (a.isBlocked == true && b.isBlocked != true) return 1;
|
||||
if (a.isBlocked != true && b.isBlocked == true) return -1;
|
||||
// archive is next...
|
||||
if (!a.isArchived && b.isArchived) return -1;
|
||||
if (a.isArchived && !b.isArchived) return 1;
|
||||
|
||||
// unapproved top
|
||||
if (a.isInvitation && !b.isInvitation) return -1;
|
||||
if (!a.isInvitation && b.isInvitation) return 1;
|
||||
|
||||
// special sorting for contacts with no messages in either history
|
||||
if (a.lastMessageTime.millisecondsSinceEpoch == 0 && b.lastMessageTime.millisecondsSinceEpoch == 0) {
|
||||
// online contacts first
|
||||
|
|
Loading…
Reference in New Issue