"Users first" instead of "People first" everywhere

This commit is contained in:
Serge Tarkovski
2026-02-09 17:34:18 +02:00
parent c4f5c7b171
commit 68bb031bb6
2 changed files with 21 additions and 20 deletions
+12 -11
View File
@@ -48,7 +48,7 @@ class _ContactsScreenState extends State<ContactsScreen>
String _searchQuery = '';
ContactSortOption _sortOption = ContactSortOption.lastSeen;
bool _showUnreadOnly = false;
bool _prioritizePeople = true;
bool _prioritizeUsers = true;
ContactTypeFilter _typeFilter = ContactTypeFilter.all;
final ContactGroupStore _groupStore = ContactGroupStore();
List<ContactGroup> _groups = [];
@@ -353,7 +353,7 @@ class _ContactsScreenState extends State<ContactsScreen>
sortOption: _sortOption,
typeFilter: _typeFilter,
showUnreadOnly: _showUnreadOnly,
prioritizePeople: _prioritizePeople,
prioritizeUsers: _prioritizeUsers,
onSortChanged: (value) {
setState(() {
_sortOption = value;
@@ -369,9 +369,9 @@ class _ContactsScreenState extends State<ContactsScreen>
_showUnreadOnly = value;
});
},
onPrioritizePeopleChanged: (value) {
onPrioritizeUsersChanged: (value) {
setState(() {
_prioritizePeople = value;
_prioritizeUsers = value;
});
},
onNewGroup: () => _showGroupEditor(context, connector.contacts),
@@ -554,18 +554,19 @@ class _ContactsScreenState extends State<ContactsScreen>
}).toList();
}
// Apply sorting within groups if prioritizing people
if (_prioritizePeople) {
// Separate people (advTypeChat) from others
final people = filtered.where((c) => c.type == advTypeChat).toList();
// Apply "users first" partitioning: separate users from other node types,
// sort each partition, then combine with users on top
if (_prioritizeUsers) {
// Separate users (advTypeChat) from others
final users = filtered.where((c) => c.type == advTypeChat).toList();
final others = filtered.where((c) => c.type != advTypeChat).toList();
// Sort each group separately
_applySorting(people, connector);
_applySorting(users, connector);
_applySorting(others, connector);
// Combine: people first, then others
filtered = [...people, ...others];
// Combine: users first, then others
filtered = [...users, ...others];
} else {
_applySorting(filtered, connector);
}