mirror of
https://github.com/zjs81/meshcore-open.git
synced 2026-04-20 22:13:48 +00:00
Refactor contact handling and other improvments (#317)
* Refactor contact filtering and improve localization strings; enhance path trace handling * Add localization for new CLI commands and update existing strings * Enhance contact handling and UI updates across multiple screens add unfiltered contact access and improve last seen resolution * Add polling interval configuration and improve contact handling * Reorder command constants for better organization and clarity * Refactor contact handling by removing unnecessary mapping and improving clarity across multiple screens * Moved RadioStatsIconButton in chat screen for improved UI consistency * Added indicators to AppBar for channels * Ignore contacts with self public key in contact handling * Simplify path removal logic and clean up unused imports in path management dialog * Enhance path hop resolution by adding distance checks to improve candidate selection accuracy * Remove unnecessary reset of radio stats poll reference count in polling interval setter
This commit is contained in:
parent
411cd3f8d2
commit
d0e3767db6
51 changed files with 440 additions and 105 deletions
|
|
@ -14,12 +14,13 @@ class ContactExport {
|
|||
final double lon;
|
||||
final String desc;
|
||||
final double? ele;
|
||||
|
||||
final String url;
|
||||
ContactExport({
|
||||
required this.name,
|
||||
required this.lat,
|
||||
required this.lon,
|
||||
required this.desc,
|
||||
required this.url,
|
||||
this.ele,
|
||||
});
|
||||
}
|
||||
|
|
@ -40,6 +41,7 @@ class GpxExport {
|
|||
String name,
|
||||
double lat,
|
||||
double lon,
|
||||
String url,
|
||||
String desc, [
|
||||
double? ele,
|
||||
]) {
|
||||
|
|
@ -50,55 +52,66 @@ class GpxExport {
|
|||
lon: lon,
|
||||
desc: desc.trim(),
|
||||
ele: ele,
|
||||
url: url,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void addRepeaters() {
|
||||
final contacts = _connector.contacts
|
||||
.where((c) => c.type == advTypeRepeater || c.type == advTypeRoom)
|
||||
.toList();
|
||||
final contacts = _connector.allContacts.where(
|
||||
(c) => c.type == advTypeRepeater || c.type == advTypeRoom,
|
||||
);
|
||||
for (var contact in contacts) {
|
||||
if (contact.latitude == null || contact.longitude == null) {
|
||||
continue;
|
||||
}
|
||||
final url = contact.rawPacket != null
|
||||
? "meshcore://${pubKeyToHex(contact.rawPacket!)}"
|
||||
: "";
|
||||
_addContact(
|
||||
contact.name,
|
||||
contact.latitude!,
|
||||
contact.longitude!,
|
||||
"Type: ${contact.typeLabel}\nPublic Key: ${contact.publicKeyHex}",
|
||||
url,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
void addContacts() {
|
||||
final contacts = _connector.contacts
|
||||
.where((c) => c.type == advTypeChat)
|
||||
.toList();
|
||||
final contacts = _connector.allContacts.where((c) => c.type == advTypeChat);
|
||||
for (var contact in contacts) {
|
||||
if (contact.latitude == null || contact.longitude == null) {
|
||||
continue;
|
||||
}
|
||||
final url = contact.rawPacket != null
|
||||
? "meshcore://${pubKeyToHex(contact.rawPacket!)}"
|
||||
: "";
|
||||
_addContact(
|
||||
contact.name,
|
||||
contact.latitude!,
|
||||
contact.longitude!,
|
||||
"Type: ${contact.typeLabel}\nPublic Key: ${contact.publicKeyHex}",
|
||||
url,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
void addAll() {
|
||||
final contacts = _connector.contacts;
|
||||
for (var contact in contacts.toList()) {
|
||||
final contacts = _connector.allContacts;
|
||||
for (var contact in contacts) {
|
||||
if (contact.latitude == null || contact.longitude == null) {
|
||||
continue;
|
||||
}
|
||||
final url = contact.rawPacket != null
|
||||
? "meshcore://${pubKeyToHex(contact.rawPacket!)}"
|
||||
: "";
|
||||
_addContact(
|
||||
contact.name,
|
||||
contact.latitude ?? 0.0,
|
||||
contact.longitude ?? 0.0,
|
||||
"Type: ${contact.typeLabel}\nPublic Key: ${contact.publicKeyHex}",
|
||||
url,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -138,6 +151,9 @@ class GpxExport {
|
|||
ele: c.ele,
|
||||
name: c.name,
|
||||
desc: c.desc,
|
||||
extensions: {
|
||||
"meshcore": {"url": c.url},
|
||||
},
|
||||
),
|
||||
)
|
||||
.toList();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue