mirror of
https://github.com/zjs81/meshcore-open.git
synced 2026-06-14 22:55:12 +10:00
"Users first" instead of "People first" everywhere
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -99,17 +99,17 @@ const int _actionFilterRepeaters = 6;
|
||||
const int _actionFilterRooms = 7;
|
||||
const int _actionToggleUnreadOnly = 8;
|
||||
const int _actionNewGroup = 9;
|
||||
const int _actionTogglePrioritizePeople = 10;
|
||||
const int _actionTogglePrioritizeUsers = 10;
|
||||
|
||||
class ContactsFilterMenu extends StatelessWidget {
|
||||
final ContactSortOption sortOption;
|
||||
final ContactTypeFilter typeFilter;
|
||||
final bool showUnreadOnly;
|
||||
final bool prioritizePeople;
|
||||
final bool prioritizeUsers;
|
||||
final ValueChanged<ContactSortOption> onSortChanged;
|
||||
final ValueChanged<ContactTypeFilter> onTypeFilterChanged;
|
||||
final ValueChanged<bool> onUnreadOnlyChanged;
|
||||
final ValueChanged<bool> onPrioritizePeopleChanged;
|
||||
final ValueChanged<bool> onPrioritizeUsersChanged;
|
||||
final VoidCallback onNewGroup;
|
||||
|
||||
const ContactsFilterMenu({
|
||||
@@ -117,11 +117,11 @@ class ContactsFilterMenu extends StatelessWidget {
|
||||
required this.sortOption,
|
||||
required this.typeFilter,
|
||||
required this.showUnreadOnly,
|
||||
required this.prioritizePeople,
|
||||
required this.prioritizeUsers,
|
||||
required this.onSortChanged,
|
||||
required this.onTypeFilterChanged,
|
||||
required this.onUnreadOnlyChanged,
|
||||
required this.onPrioritizePeopleChanged,
|
||||
required this.onPrioritizeUsersChanged,
|
||||
required this.onNewGroup,
|
||||
});
|
||||
|
||||
@@ -150,9 +150,9 @@ class ContactsFilterMenu extends StatelessWidget {
|
||||
checked: sortOption == ContactSortOption.name,
|
||||
),
|
||||
SortFilterMenuOption(
|
||||
value: _actionTogglePrioritizePeople,
|
||||
value: _actionTogglePrioritizeUsers,
|
||||
label: l10n.listFilter_usersFirst,
|
||||
checked: prioritizePeople,
|
||||
checked: prioritizeUsers,
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -202,8 +202,8 @@ class ContactsFilterMenu extends StatelessWidget {
|
||||
case _actionSortLastSeen:
|
||||
onSortChanged(ContactSortOption.lastSeen);
|
||||
break;
|
||||
case _actionTogglePrioritizePeople:
|
||||
onPrioritizePeopleChanged(!prioritizePeople);
|
||||
case _actionTogglePrioritizeUsers:
|
||||
onPrioritizeUsersChanged(!prioritizeUsers);
|
||||
break;
|
||||
case _actionFilterAll:
|
||||
onTypeFilterChanged(ContactTypeFilter.all);
|
||||
|
||||
Reference in New Issue
Block a user