From 75acfe8dd092b15332996d45d4f300fe924c9c0a Mon Sep 17 00:00:00 2001 From: Dan Ballard Date: Fri, 17 Dec 2021 17:34:56 -0500 Subject: [PATCH] contact list sort more often and float unauthed contacts to top --- lib/model.dart | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/model.dart b/lib/model.dart index 2106895b..083b63e4 100644 --- a/lib/model.dart +++ b/lib/model.dart @@ -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