Fix manual path search ranking, hash matching, and layout

Rank name prefixes ahead of other substring matches, match hop hashes
in the path builder and contact search, and keep the hop list and hex
field on screen while the keyboard is open.

Co-authored-by: zjs81 <zjs81@users.noreply.github.com>
This commit is contained in:
Cursor Agentandzjs81 committed 2026-11-20 21:43:49 +00:00
1 parent 34ea0cb7ca
commit a1604af4d4
51 files changed
+882 -327

No files matched your search

+30 -26
View File
@@ -2292,13 +2292,14 @@ class _MapScreenState extends State<MapScreen> with WidgetsBindingObserver {
) {
final query = _searchQuery.trim().toLowerCase();
final matches =
allContacts.where((c) => matchesContactQuery(c, query)).toList()
..sort((a, b) {
allContacts.where((c) => matchesContactQuery(c, query)).toList()..sort(
(a, b) => compareContactQueryRank(a, b, query, (a, b) {
if (a.hasLocation != b.hasLocation) {
return a.hasLocation ? -1 : 1;
}
return b.lastHeard.compareTo(a.lastHeard);
});
}),
);
final results = matches.take(8).toList();
return Container(
margin: const EdgeInsets.only(top: 6),
@@ -3464,6 +3465,15 @@ class _MapScreenState extends State<MapScreen> with WidgetsBindingObserver {
contact.type != advTypeRoom,
)
.toList();
final people = allContacts
.where(
(contact) =>
query.isEmpty || matchesContactQuery(contact, query),
)
.toList();
if (query.isNotEmpty) {
people.sort((a, b) => compareContactQueryRank(a, b, query));
}
return SafeArea(
child: SingleChildScrollView(
child: Column(
@@ -3499,29 +3509,23 @@ class _MapScreenState extends State<MapScreen> with WidgetsBindingObserver {
},
),
),
...allContacts
.where(
(contact) =>
query.isEmpty ||
matchesContactQuery(contact, query),
)
.map((contact) {
return ListTile(
leading: const Icon(Icons.person),
title: Text(contact.name),
onTap: () {
Navigator.pop(sheetContext);
if (!_markerFits(
context,
markerText,
maxContactMessageBytes(),
)) {
return;
}
liveConnector.sendMessage(contact, markerText);
},
);
}),
...people.map((contact) {
return ListTile(
leading: const Icon(Icons.person),
title: Text(contact.name),
onTap: () {
Navigator.pop(sheetContext);
if (!_markerFits(
context,
markerText,
maxContactMessageBytes(),
)) {
return;
}
liveConnector.sendMessage(contact, markerText);
},
);
}),
Padding(
padding: const EdgeInsets.fromLTRB(16, 12, 16, 4),
child: Text(