Merge upstream/dev (8 commits) [upstream-sync]
This commit is contained in:
commit
65097d053d
76 files changed
+2533
-1050
No files matched your search
@@ -334,12 +334,6 @@ class MeshCoreConnector extends ChangeNotifier {
|
||||
ReceivedImageStore? _receivedImageStore;
|
||||
void Function(ImageChunkOutcome outcome)? _onImageChunk;
|
||||
void Function(int senderPrefix)? _onImageSenderPrefix;
|
||||
// Intentionally global (not per-contact): tracks overall network activity.
|
||||
// Frequent RX from any source indicates a busy network with more collisions.
|
||||
DateTime _lastRxTime = DateTime.now();
|
||||
// Snapshot of _lastRxTime taken before the ACK frame updates it, so that
|
||||
// onDeliveryObserved records the pre-ACK elapsed time (matching prediction).
|
||||
DateTime _lastRxBeforeFrame = DateTime.fromMillisecondsSinceEpoch(0);
|
||||
DateTime _lastRadioRxTime = DateTime.fromMillisecondsSinceEpoch(0);
|
||||
DateTime _lastContactMsgRxTime = DateTime.fromMillisecondsSinceEpoch(0);
|
||||
DateTime _lastChannelMsgRxTime = DateTime.fromMillisecondsSinceEpoch(0);
|
||||
@@ -810,6 +804,82 @@ class MeshCoreConnector extends ChangeNotifier {
|
||||
}
|
||||
}
|
||||
|
||||
/// Applies a GPS fix from a telemetry reply to the contact so the map and
|
||||
/// lists show where the node is now, not where its last advert put it.
|
||||
/// [lastSeen] is left alone: it is the node's advert timestamp, which path
|
||||
/// and flag writes send back to the radio.
|
||||
void updateContactLocationFromTelemetry(
|
||||
String contactKeyHex,
|
||||
double latitude,
|
||||
double longitude,
|
||||
) {
|
||||
final index = _contacts.indexWhere((c) => c.publicKeyHex == contactKeyHex);
|
||||
if (index < 0) return;
|
||||
final updated = _contacts[index].copyWith(
|
||||
latitude: latitude,
|
||||
longitude: longitude,
|
||||
telemetryFixAt: DateTime.now(),
|
||||
);
|
||||
if (!updated.hasLocation) return;
|
||||
_contacts[index] = updated;
|
||||
notifyListeners();
|
||||
unawaited(_persistContacts());
|
||||
}
|
||||
|
||||
/// Carries [previous]'s telemetry fix onto [incoming], a record the radio
|
||||
/// just returned, while it still holds the advert that fix superseded. A
|
||||
/// newer advert (by the node's own clock) wins.
|
||||
Contact? _withTelemetryFix(Contact previous, Contact incoming) {
|
||||
final fixAt = previous.telemetryFixAt;
|
||||
if (fixAt == null || incoming.lastSeen.isAfter(previous.lastSeen)) {
|
||||
return null;
|
||||
}
|
||||
return incoming.copyWith(
|
||||
latitude: previous.latitude,
|
||||
longitude: previous.longitude,
|
||||
telemetryFixAt: fixAt,
|
||||
);
|
||||
}
|
||||
|
||||
/// Merges a contact record from the radio (contact list or advert) into the
|
||||
/// one we already hold, keeping the user's path choice and any telemetry
|
||||
/// fix still newer than the radio's advert.
|
||||
Contact _mergeRefreshedContact(
|
||||
Contact existing,
|
||||
Contact incoming, {
|
||||
bool keepLocationWhenMissing = false,
|
||||
}) {
|
||||
final mergedLastMessageAt =
|
||||
existing.lastMessageAt.isAfter(incoming.lastMessageAt)
|
||||
? existing.lastMessageAt
|
||||
: incoming.lastMessageAt;
|
||||
final base = incoming.copyWith(
|
||||
lastMessageAt: mergedLastMessageAt,
|
||||
pathOverride: existing.pathOverride, // Preserve user's path choice
|
||||
pathOverrideBytes: existing.pathOverrideBytes,
|
||||
latitude: keepLocationWhenMissing
|
||||
? incoming.latitude ?? existing.latitude
|
||||
: incoming.latitude,
|
||||
longitude: keepLocationWhenMissing
|
||||
? incoming.longitude ?? existing.longitude
|
||||
: incoming.longitude,
|
||||
clearTelemetryFix: true,
|
||||
);
|
||||
return _withTelemetryFix(existing, base) ?? base;
|
||||
}
|
||||
|
||||
/// Telemetry fixes held across a full contact sync, which clears the list
|
||||
/// before the radio resends it.
|
||||
final Map<String, Contact> _telemetryFixesDuringSync = {};
|
||||
|
||||
void _stashTelemetryFixes() {
|
||||
for (final c in _contacts) {
|
||||
if (c.telemetryFixAt != null) {
|
||||
_telemetryFixesDuringSync[c.publicKeyHex] = c;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
String _batteryChemistryForDevice() {
|
||||
final deviceId = batteryDeviceKey;
|
||||
if (deviceId == null || _appSettingsService == null) return 'nmc';
|
||||
@@ -1734,15 +1804,11 @@ class MeshCoreConnector extends ChangeNotifier {
|
||||
recentSelections: recentSelections,
|
||||
),
|
||||
onDeliveryObserved: (contactKey, pathLength, messageBytes, tripTimeMs) {
|
||||
final secSinceRx = DateTime.now()
|
||||
.difference(_lastRxBeforeFrame)
|
||||
.inSeconds;
|
||||
_timeoutPredictionService?.recordObservation(
|
||||
contactKey: contactKey,
|
||||
pathLength: pathLength,
|
||||
messageBytes: messageBytes,
|
||||
tripTimeMs: tripTimeMs,
|
||||
secondsSinceLastRx: secSinceRx,
|
||||
);
|
||||
},
|
||||
),
|
||||
@@ -4226,6 +4292,7 @@ class MeshCoreConnector extends ChangeNotifier {
|
||||
_contactSyncUsesSinceFilter = since != null;
|
||||
if (!preserveExisting) {
|
||||
_hasLoadedContacts = false;
|
||||
_stashTelemetryFixes();
|
||||
_contacts.clear();
|
||||
}
|
||||
_armContactSyncWatchdog();
|
||||
@@ -5996,8 +6063,6 @@ class MeshCoreConnector extends ChangeNotifier {
|
||||
|
||||
void _handleFrame(List<int> data) {
|
||||
if (data.isEmpty) return;
|
||||
_lastRxBeforeFrame = _lastRxTime;
|
||||
_lastRxTime = DateTime.now();
|
||||
|
||||
final frame = Uint8List.fromList(data);
|
||||
_receivedFramesController.add(frame);
|
||||
@@ -6021,6 +6086,7 @@ class MeshCoreConnector extends ChangeNotifier {
|
||||
case respCodeContactsStart:
|
||||
debugPrint('Got CONTACTS_START');
|
||||
if (!_preserveContactsOnRefresh) {
|
||||
_stashTelemetryFixes();
|
||||
_contacts.clear();
|
||||
}
|
||||
_isLoadingContacts = true;
|
||||
@@ -6096,6 +6162,7 @@ class MeshCoreConnector extends ChangeNotifier {
|
||||
}
|
||||
_hasLoadedContacts = true;
|
||||
_preserveContactsOnRefresh = false;
|
||||
_telemetryFixesDuringSync.clear();
|
||||
_contactSyncUsesSinceFilter = false;
|
||||
unawaited(updateKnownDiscovered());
|
||||
notifyListeners();
|
||||
@@ -6755,12 +6822,10 @@ class MeshCoreConnector extends ChangeNotifier {
|
||||
final physicsMax = _physicsMaxTimeout(pathLength, airtime);
|
||||
|
||||
// Try ML-based prediction
|
||||
final secSinceRx = DateTime.now().difference(_lastRxTime).inSeconds;
|
||||
final mlTimeout = _timeoutPredictionService?.predictTimeout(
|
||||
contactKey: contactKey,
|
||||
pathLength: pathLength,
|
||||
messageBytes: messageBytes,
|
||||
secondsSinceLastRx: secSinceRx,
|
||||
);
|
||||
if (mlTimeout != null) {
|
||||
// Use device est_timeout as a baseline floor when available —
|
||||
@@ -6861,10 +6926,6 @@ class MeshCoreConnector extends ChangeNotifier {
|
||||
|
||||
if (existingIndex >= 0) {
|
||||
final existing = _contacts[existingIndex];
|
||||
final mergedLastMessageAt =
|
||||
existing.lastMessageAt.isAfter(contact.lastMessageAt)
|
||||
? existing.lastMessageAt
|
||||
: contact.lastMessageAt;
|
||||
|
||||
appLogger.info(
|
||||
'Refreshing contact ${contact.name}: devicePath=${contact.pathLength}, existingOverride=${existing.pathOverride}',
|
||||
@@ -6873,12 +6934,10 @@ class MeshCoreConnector extends ChangeNotifier {
|
||||
|
||||
// Preserve user-selected path settings and previously known GPS when
|
||||
// refreshed frames omit coordinates (lat/lon encoded as 0,0).
|
||||
_contacts[existingIndex] = contact.copyWith(
|
||||
lastMessageAt: mergedLastMessageAt,
|
||||
pathOverride: existing.pathOverride, // Preserve user's path choice
|
||||
pathOverrideBytes: existing.pathOverrideBytes,
|
||||
latitude: contact.latitude ?? existing.latitude,
|
||||
longitude: contact.longitude ?? existing.longitude,
|
||||
_contacts[existingIndex] = _mergeRefreshedContact(
|
||||
existing,
|
||||
contact,
|
||||
keepLocationWhenMissing: true,
|
||||
);
|
||||
|
||||
appLogger.info(
|
||||
@@ -6886,7 +6945,12 @@ class MeshCoreConnector extends ChangeNotifier {
|
||||
tag: 'Connector',
|
||||
);
|
||||
} else {
|
||||
_contacts.add(contact);
|
||||
// A full sync cleared the list; restore a telemetry fix it held.
|
||||
final stashed = _telemetryFixesDuringSync.remove(contact.publicKeyHex);
|
||||
_contacts.add(
|
||||
(stashed == null ? null : _withTelemetryFix(stashed, contact)) ??
|
||||
contact,
|
||||
);
|
||||
appLogger.info(
|
||||
'Added new contact ${contact.name}: pathLen=${contact.pathLength}',
|
||||
tag: 'Connector',
|
||||
@@ -6945,10 +7009,6 @@ class MeshCoreConnector extends ChangeNotifier {
|
||||
|
||||
if (existingIndex >= 0) {
|
||||
final existing = _contacts[existingIndex];
|
||||
final mergedLastMessageAt =
|
||||
existing.lastMessageAt.isAfter(contact.lastMessageAt)
|
||||
? existing.lastMessageAt
|
||||
: contact.lastMessageAt;
|
||||
|
||||
appLogger.info(
|
||||
'Refreshing contact ${contact.name}: devicePath=${contact.pathLength}, existingOverride=${existing.pathOverride}',
|
||||
@@ -6956,11 +7016,7 @@ class MeshCoreConnector extends ChangeNotifier {
|
||||
);
|
||||
|
||||
// CRITICAL: Preserve user's path override when contact is refreshed from device
|
||||
_contacts[existingIndex] = contact.copyWith(
|
||||
lastMessageAt: mergedLastMessageAt,
|
||||
pathOverride: existing.pathOverride, // Preserve user's path choice
|
||||
pathOverrideBytes: existing.pathOverrideBytes,
|
||||
);
|
||||
_contacts[existingIndex] = _mergeRefreshedContact(existing, contact);
|
||||
|
||||
appLogger.info(
|
||||
'After merge: pathOverride=${_contacts[existingIndex].pathOverride}, devicePath=${_contacts[existingIndex].pathLength}',
|
||||
|
||||
@@ -77,6 +77,7 @@ class LinkHandler {
|
||||
final shouldOpen = await showDialog<bool>(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
scrollable: true,
|
||||
title: Text(context.l10n.chat_openLink),
|
||||
content: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
|
||||
@@ -3301,6 +3301,10 @@
|
||||
"map_youWithMarkers": "Вие и {count} маркера",
|
||||
"map_sharedMarkerSemantics": "Споделен маркер: {label}",
|
||||
"map_nodeMarkerSemantics": "{name}, {type}, {status}",
|
||||
"map_requestLocation": "Обнови местоположението",
|
||||
"map_locationUpdated": "Местоположението е обновено",
|
||||
"map_locationNotShared": "{name} отговори без местоположение",
|
||||
"map_locationRequestFailed": "Няма отговор от {name}",
|
||||
"mapCache_zoomLevel": "Мащаб {zoom}",
|
||||
"mapCache_sizeBytes": "{size} B",
|
||||
"mapCache_sizeKilobytes": "{size} KB",
|
||||
|
||||
@@ -3436,6 +3436,10 @@
|
||||
"map_youWithMarkers": "Du und {count} Marker",
|
||||
"map_sharedMarkerSemantics": "Geteilter Marker: {label}",
|
||||
"map_nodeMarkerSemantics": "{name}, {type}, {status}",
|
||||
"map_requestLocation": "Standort aktualisieren",
|
||||
"map_locationUpdated": "Standort aktualisiert",
|
||||
"map_locationNotShared": "{name} hat ohne Standort geantwortet",
|
||||
"map_locationRequestFailed": "Keine Antwort von {name}",
|
||||
"mapCache_zoomLevel": "Zoom {zoom}",
|
||||
"mapCache_sizeBytes": "{size} B",
|
||||
"mapCache_sizeKilobytes": "{size} KB",
|
||||
|
||||
@@ -3455,6 +3455,12 @@
|
||||
"@map_sharedMarkerSemantics": {"placeholders": {"label": {"type": "String"}}},
|
||||
"map_nodeMarkerSemantics": "{name}, {type}, {status}",
|
||||
"@map_nodeMarkerSemantics": {"placeholders": {"name": {"type": "String"}, "type": {"type": "String"}, "status": {"type": "String"}}},
|
||||
"map_requestLocation": "Update location",
|
||||
"map_locationUpdated": "Location updated",
|
||||
"map_locationNotShared": "{name} replied without a location",
|
||||
"@map_locationNotShared": {"placeholders": {"name": {"type": "String"}}},
|
||||
"map_locationRequestFailed": "No reply from {name}",
|
||||
"@map_locationRequestFailed": {"placeholders": {"name": {"type": "String"}}},
|
||||
"mapCache_zoomLevel": "Zoom {zoom}",
|
||||
"@mapCache_zoomLevel": {"placeholders": {"zoom": {"type": "int"}}},
|
||||
"mapCache_sizeBytes": "{size} B",
|
||||
|
||||
@@ -3318,6 +3318,10 @@
|
||||
"map_youWithMarkers": "Tú y {count} marcadores",
|
||||
"map_sharedMarkerSemantics": "Marcador compartido: {label}",
|
||||
"map_nodeMarkerSemantics": "{name}, {type}, {status}",
|
||||
"map_requestLocation": "Actualizar ubicación",
|
||||
"map_locationUpdated": "Ubicación actualizada",
|
||||
"map_locationNotShared": "{name} respondió sin ubicación",
|
||||
"map_locationRequestFailed": "Sin respuesta de {name}",
|
||||
"mapCache_zoomLevel": "Zoom {zoom}",
|
||||
"mapCache_sizeBytes": "{size} B",
|
||||
"mapCache_sizeKilobytes": "{size} KB",
|
||||
|
||||
@@ -3318,6 +3318,10 @@
|
||||
"map_youWithMarkers": "Vous et {count} marqueurs",
|
||||
"map_sharedMarkerSemantics": "Marqueur partagé : {label}",
|
||||
"map_nodeMarkerSemantics": "{name}, {type}, {status}",
|
||||
"map_requestLocation": "Actualiser la position",
|
||||
"map_locationUpdated": "Position actualisée",
|
||||
"map_locationNotShared": "{name} a répondu sans position",
|
||||
"map_locationRequestFailed": "Aucune réponse de {name}",
|
||||
"mapCache_zoomLevel": "Zoom {zoom}",
|
||||
"mapCache_sizeBytes": "{size} o",
|
||||
"mapCache_sizeKilobytes": "{size} Ko",
|
||||
|
||||
@@ -3340,6 +3340,10 @@
|
||||
"map_youWithMarkers": "Ön és {count} jelölő",
|
||||
"map_sharedMarkerSemantics": "Megosztott jelölő: {label}",
|
||||
"map_nodeMarkerSemantics": "{name}, {type}, {status}",
|
||||
"map_requestLocation": "Hely frissítése",
|
||||
"map_locationUpdated": "Hely frissítve",
|
||||
"map_locationNotShared": "{name} helyadat nélkül válaszolt",
|
||||
"map_locationRequestFailed": "Nincs válasz tőle: {name}",
|
||||
"mapCache_zoomLevel": "Nagyítás: {zoom}",
|
||||
"mapCache_sizeBytes": "{size} B",
|
||||
"mapCache_sizeKilobytes": "{size} KB",
|
||||
|
||||
@@ -3318,6 +3318,10 @@
|
||||
"map_youWithMarkers": "Tu e {count} segnaposti",
|
||||
"map_sharedMarkerSemantics": "Segnaposto condiviso: {label}",
|
||||
"map_nodeMarkerSemantics": "{name}, {type}, {status}",
|
||||
"map_requestLocation": "Aggiorna posizione",
|
||||
"map_locationUpdated": "Posizione aggiornata",
|
||||
"map_locationNotShared": "{name} ha risposto senza posizione",
|
||||
"map_locationRequestFailed": "Nessuna risposta da {name}",
|
||||
"mapCache_zoomLevel": "Zoom {zoom}",
|
||||
"mapCache_sizeBytes": "{size} B",
|
||||
"mapCache_sizeKilobytes": "{size} KB",
|
||||
|
||||
@@ -3318,6 +3318,10 @@
|
||||
"map_youWithMarkers": "自分と{count}件のマーカー",
|
||||
"map_sharedMarkerSemantics": "共有マーカー: {label}",
|
||||
"map_nodeMarkerSemantics": "{name}、{type}、{status}",
|
||||
"map_requestLocation": "位置情報を更新",
|
||||
"map_locationUpdated": "位置情報を更新しました",
|
||||
"map_locationNotShared": "{name} は位置情報なしで応答しました",
|
||||
"map_locationRequestFailed": "{name} から応答がありません",
|
||||
"mapCache_zoomLevel": "ズーム {zoom}",
|
||||
"mapCache_sizeBytes": "{size} B",
|
||||
"mapCache_sizeKilobytes": "{size} KB",
|
||||
|
||||
@@ -3318,6 +3318,10 @@
|
||||
"map_youWithMarkers": "나와 마커 {count}개",
|
||||
"map_sharedMarkerSemantics": "공유 마커: {label}",
|
||||
"map_nodeMarkerSemantics": "{name}, {type}, {status}",
|
||||
"map_requestLocation": "위치 업데이트",
|
||||
"map_locationUpdated": "위치가 업데이트되었습니다",
|
||||
"map_locationNotShared": "{name}이(가) 위치 없이 응답했습니다",
|
||||
"map_locationRequestFailed": "{name}의 응답이 없습니다",
|
||||
"mapCache_zoomLevel": "줌 {zoom}",
|
||||
"mapCache_sizeBytes": "{size} B",
|
||||
"mapCache_sizeKilobytes": "{size} KB",
|
||||
|
||||
@@ -10238,6 +10238,30 @@ abstract class AppLocalizations {
|
||||
/// **'{name}, {type}, {status}'**
|
||||
String map_nodeMarkerSemantics(String name, String type, String status);
|
||||
|
||||
/// No description provided for @map_requestLocation.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Update location'**
|
||||
String get map_requestLocation;
|
||||
|
||||
/// No description provided for @map_locationUpdated.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Location updated'**
|
||||
String get map_locationUpdated;
|
||||
|
||||
/// No description provided for @map_locationNotShared.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'{name} replied without a location'**
|
||||
String map_locationNotShared(String name);
|
||||
|
||||
/// No description provided for @map_locationRequestFailed.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'No reply from {name}'**
|
||||
String map_locationRequestFailed(String name);
|
||||
|
||||
/// No description provided for @mapCache_zoomLevel.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
|
||||
@@ -6083,6 +6083,22 @@ class AppLocalizationsBg extends AppLocalizations {
|
||||
return '$name, $type, $status';
|
||||
}
|
||||
|
||||
@override
|
||||
String get map_requestLocation => 'Обнови местоположението';
|
||||
|
||||
@override
|
||||
String get map_locationUpdated => 'Местоположението е обновено';
|
||||
|
||||
@override
|
||||
String map_locationNotShared(String name) {
|
||||
return '$name отговори без местоположение';
|
||||
}
|
||||
|
||||
@override
|
||||
String map_locationRequestFailed(String name) {
|
||||
return 'Няма отговор от $name';
|
||||
}
|
||||
|
||||
@override
|
||||
String mapCache_zoomLevel(int zoom) {
|
||||
return 'Мащаб $zoom';
|
||||
|
||||
@@ -6097,6 +6097,22 @@ class AppLocalizationsDe extends AppLocalizations {
|
||||
return '$name, $type, $status';
|
||||
}
|
||||
|
||||
@override
|
||||
String get map_requestLocation => 'Standort aktualisieren';
|
||||
|
||||
@override
|
||||
String get map_locationUpdated => 'Standort aktualisiert';
|
||||
|
||||
@override
|
||||
String map_locationNotShared(String name) {
|
||||
return '$name hat ohne Standort geantwortet';
|
||||
}
|
||||
|
||||
@override
|
||||
String map_locationRequestFailed(String name) {
|
||||
return 'Keine Antwort von $name';
|
||||
}
|
||||
|
||||
@override
|
||||
String mapCache_zoomLevel(int zoom) {
|
||||
return 'Zoom $zoom';
|
||||
|
||||
@@ -5998,6 +5998,22 @@ class AppLocalizationsEn extends AppLocalizations {
|
||||
return '$name, $type, $status';
|
||||
}
|
||||
|
||||
@override
|
||||
String get map_requestLocation => 'Update location';
|
||||
|
||||
@override
|
||||
String get map_locationUpdated => 'Location updated';
|
||||
|
||||
@override
|
||||
String map_locationNotShared(String name) {
|
||||
return '$name replied without a location';
|
||||
}
|
||||
|
||||
@override
|
||||
String map_locationRequestFailed(String name) {
|
||||
return 'No reply from $name';
|
||||
}
|
||||
|
||||
@override
|
||||
String mapCache_zoomLevel(int zoom) {
|
||||
return 'Zoom $zoom';
|
||||
|
||||
@@ -6087,6 +6087,22 @@ class AppLocalizationsEs extends AppLocalizations {
|
||||
return '$name, $type, $status';
|
||||
}
|
||||
|
||||
@override
|
||||
String get map_requestLocation => 'Actualizar ubicación';
|
||||
|
||||
@override
|
||||
String get map_locationUpdated => 'Ubicación actualizada';
|
||||
|
||||
@override
|
||||
String map_locationNotShared(String name) {
|
||||
return '$name respondió sin ubicación';
|
||||
}
|
||||
|
||||
@override
|
||||
String map_locationRequestFailed(String name) {
|
||||
return 'Sin respuesta de $name';
|
||||
}
|
||||
|
||||
@override
|
||||
String mapCache_zoomLevel(int zoom) {
|
||||
return 'Zoom $zoom';
|
||||
|
||||
@@ -6110,6 +6110,22 @@ class AppLocalizationsFr extends AppLocalizations {
|
||||
return '$name, $type, $status';
|
||||
}
|
||||
|
||||
@override
|
||||
String get map_requestLocation => 'Actualiser la position';
|
||||
|
||||
@override
|
||||
String get map_locationUpdated => 'Position actualisée';
|
||||
|
||||
@override
|
||||
String map_locationNotShared(String name) {
|
||||
return '$name a répondu sans position';
|
||||
}
|
||||
|
||||
@override
|
||||
String map_locationRequestFailed(String name) {
|
||||
return 'Aucune réponse de $name';
|
||||
}
|
||||
|
||||
@override
|
||||
String mapCache_zoomLevel(int zoom) {
|
||||
return 'Zoom $zoom';
|
||||
|
||||
@@ -6075,6 +6075,22 @@ class AppLocalizationsHu extends AppLocalizations {
|
||||
return '$name, $type, $status';
|
||||
}
|
||||
|
||||
@override
|
||||
String get map_requestLocation => 'Hely frissítése';
|
||||
|
||||
@override
|
||||
String get map_locationUpdated => 'Hely frissítve';
|
||||
|
||||
@override
|
||||
String map_locationNotShared(String name) {
|
||||
return '$name helyadat nélkül válaszolt';
|
||||
}
|
||||
|
||||
@override
|
||||
String map_locationRequestFailed(String name) {
|
||||
return 'Nincs válasz tőle: $name';
|
||||
}
|
||||
|
||||
@override
|
||||
String mapCache_zoomLevel(int zoom) {
|
||||
return 'Nagyítás: $zoom';
|
||||
|
||||
@@ -6093,6 +6093,22 @@ class AppLocalizationsIt extends AppLocalizations {
|
||||
return '$name, $type, $status';
|
||||
}
|
||||
|
||||
@override
|
||||
String get map_requestLocation => 'Aggiorna posizione';
|
||||
|
||||
@override
|
||||
String get map_locationUpdated => 'Posizione aggiornata';
|
||||
|
||||
@override
|
||||
String map_locationNotShared(String name) {
|
||||
return '$name ha risposto senza posizione';
|
||||
}
|
||||
|
||||
@override
|
||||
String map_locationRequestFailed(String name) {
|
||||
return 'Nessuna risposta da $name';
|
||||
}
|
||||
|
||||
@override
|
||||
String mapCache_zoomLevel(int zoom) {
|
||||
return 'Zoom $zoom';
|
||||
|
||||
@@ -5799,6 +5799,22 @@ class AppLocalizationsJa extends AppLocalizations {
|
||||
return '$name、$type、$status';
|
||||
}
|
||||
|
||||
@override
|
||||
String get map_requestLocation => '位置情報を更新';
|
||||
|
||||
@override
|
||||
String get map_locationUpdated => '位置情報を更新しました';
|
||||
|
||||
@override
|
||||
String map_locationNotShared(String name) {
|
||||
return '$name は位置情報なしで応答しました';
|
||||
}
|
||||
|
||||
@override
|
||||
String map_locationRequestFailed(String name) {
|
||||
return '$name から応答がありません';
|
||||
}
|
||||
|
||||
@override
|
||||
String mapCache_zoomLevel(int zoom) {
|
||||
return 'ズーム $zoom';
|
||||
|
||||
@@ -5806,6 +5806,22 @@ class AppLocalizationsKo extends AppLocalizations {
|
||||
return '$name, $type, $status';
|
||||
}
|
||||
|
||||
@override
|
||||
String get map_requestLocation => '위치 업데이트';
|
||||
|
||||
@override
|
||||
String get map_locationUpdated => '위치가 업데이트되었습니다';
|
||||
|
||||
@override
|
||||
String map_locationNotShared(String name) {
|
||||
return '$name이(가) 위치 없이 응답했습니다';
|
||||
}
|
||||
|
||||
@override
|
||||
String map_locationRequestFailed(String name) {
|
||||
return '$name의 응답이 없습니다';
|
||||
}
|
||||
|
||||
@override
|
||||
String mapCache_zoomLevel(int zoom) {
|
||||
return '줌 $zoom';
|
||||
|
||||
@@ -6053,6 +6053,22 @@ class AppLocalizationsNl extends AppLocalizations {
|
||||
return '$name, $type, $status';
|
||||
}
|
||||
|
||||
@override
|
||||
String get map_requestLocation => 'Locatie bijwerken';
|
||||
|
||||
@override
|
||||
String get map_locationUpdated => 'Locatie bijgewerkt';
|
||||
|
||||
@override
|
||||
String map_locationNotShared(String name) {
|
||||
return '$name antwoordde zonder locatie';
|
||||
}
|
||||
|
||||
@override
|
||||
String map_locationRequestFailed(String name) {
|
||||
return 'Geen antwoord van $name';
|
||||
}
|
||||
|
||||
@override
|
||||
String mapCache_zoomLevel(int zoom) {
|
||||
return 'Zoom $zoom';
|
||||
|
||||
@@ -6117,6 +6117,22 @@ class AppLocalizationsPl extends AppLocalizations {
|
||||
return '$name, $type, $status';
|
||||
}
|
||||
|
||||
@override
|
||||
String get map_requestLocation => 'Zaktualizuj lokalizację';
|
||||
|
||||
@override
|
||||
String get map_locationUpdated => 'Lokalizacja zaktualizowana';
|
||||
|
||||
@override
|
||||
String map_locationNotShared(String name) {
|
||||
return '$name odpowiedział bez lokalizacji';
|
||||
}
|
||||
|
||||
@override
|
||||
String map_locationRequestFailed(String name) {
|
||||
return 'Brak odpowiedzi od $name';
|
||||
}
|
||||
|
||||
@override
|
||||
String mapCache_zoomLevel(int zoom) {
|
||||
return 'Zoom $zoom';
|
||||
|
||||
@@ -6082,6 +6082,22 @@ class AppLocalizationsPt extends AppLocalizations {
|
||||
return '$name, $type, $status';
|
||||
}
|
||||
|
||||
@override
|
||||
String get map_requestLocation => 'Atualizar localização';
|
||||
|
||||
@override
|
||||
String get map_locationUpdated => 'Localização atualizada';
|
||||
|
||||
@override
|
||||
String map_locationNotShared(String name) {
|
||||
return '$name respondeu sem localização';
|
||||
}
|
||||
|
||||
@override
|
||||
String map_locationRequestFailed(String name) {
|
||||
return 'Sem resposta de $name';
|
||||
}
|
||||
|
||||
@override
|
||||
String mapCache_zoomLevel(int zoom) {
|
||||
return 'Zoom $zoom';
|
||||
|
||||
@@ -6104,6 +6104,22 @@ class AppLocalizationsRu extends AppLocalizations {
|
||||
return '$name, $type, $status';
|
||||
}
|
||||
|
||||
@override
|
||||
String get map_requestLocation => 'Обновить местоположение';
|
||||
|
||||
@override
|
||||
String get map_locationUpdated => 'Местоположение обновлено';
|
||||
|
||||
@override
|
||||
String map_locationNotShared(String name) {
|
||||
return '$name ответил без местоположения';
|
||||
}
|
||||
|
||||
@override
|
||||
String map_locationRequestFailed(String name) {
|
||||
return 'Нет ответа от $name';
|
||||
}
|
||||
|
||||
@override
|
||||
String mapCache_zoomLevel(int zoom) {
|
||||
return 'Масштаб $zoom';
|
||||
|
||||
@@ -6066,6 +6066,22 @@ class AppLocalizationsSk extends AppLocalizations {
|
||||
return '$name, $type, $status';
|
||||
}
|
||||
|
||||
@override
|
||||
String get map_requestLocation => 'Aktualizovať polohu';
|
||||
|
||||
@override
|
||||
String get map_locationUpdated => 'Poloha aktualizovaná';
|
||||
|
||||
@override
|
||||
String map_locationNotShared(String name) {
|
||||
return '$name odpovedal bez polohy';
|
||||
}
|
||||
|
||||
@override
|
||||
String map_locationRequestFailed(String name) {
|
||||
return 'Žiadna odpoveď od $name';
|
||||
}
|
||||
|
||||
@override
|
||||
String mapCache_zoomLevel(int zoom) {
|
||||
return 'Priblíženie $zoom';
|
||||
|
||||
@@ -6069,6 +6069,22 @@ class AppLocalizationsSl extends AppLocalizations {
|
||||
return '$name, $type, $status';
|
||||
}
|
||||
|
||||
@override
|
||||
String get map_requestLocation => 'Posodobi lokacijo';
|
||||
|
||||
@override
|
||||
String get map_locationUpdated => 'Lokacija posodobljena';
|
||||
|
||||
@override
|
||||
String map_locationNotShared(String name) {
|
||||
return '$name je odgovoril brez lokacije';
|
||||
}
|
||||
|
||||
@override
|
||||
String map_locationRequestFailed(String name) {
|
||||
return 'Ni odgovora od $name';
|
||||
}
|
||||
|
||||
@override
|
||||
String mapCache_zoomLevel(int zoom) {
|
||||
return 'Povečava $zoom';
|
||||
|
||||
@@ -6033,6 +6033,22 @@ class AppLocalizationsSv extends AppLocalizations {
|
||||
return '$name, $type, $status';
|
||||
}
|
||||
|
||||
@override
|
||||
String get map_requestLocation => 'Uppdatera plats';
|
||||
|
||||
@override
|
||||
String get map_locationUpdated => 'Platsen uppdaterad';
|
||||
|
||||
@override
|
||||
String map_locationNotShared(String name) {
|
||||
return '$name svarade utan plats';
|
||||
}
|
||||
|
||||
@override
|
||||
String map_locationRequestFailed(String name) {
|
||||
return 'Inget svar från $name';
|
||||
}
|
||||
|
||||
@override
|
||||
String mapCache_zoomLevel(int zoom) {
|
||||
return 'Zoom $zoom';
|
||||
|
||||
@@ -6107,6 +6107,22 @@ class AppLocalizationsUk extends AppLocalizations {
|
||||
return '$name, $type, $status';
|
||||
}
|
||||
|
||||
@override
|
||||
String get map_requestLocation => 'Оновити геопозицію';
|
||||
|
||||
@override
|
||||
String get map_locationUpdated => 'Геопозицію оновлено';
|
||||
|
||||
@override
|
||||
String map_locationNotShared(String name) {
|
||||
return '$name відповів без геопозиції';
|
||||
}
|
||||
|
||||
@override
|
||||
String map_locationRequestFailed(String name) {
|
||||
return 'Немає відповіді від $name';
|
||||
}
|
||||
|
||||
@override
|
||||
String mapCache_zoomLevel(int zoom) {
|
||||
return 'Масштаб $zoom';
|
||||
|
||||
@@ -5658,6 +5658,22 @@ class AppLocalizationsZh extends AppLocalizations {
|
||||
return '$name,$type,$status';
|
||||
}
|
||||
|
||||
@override
|
||||
String get map_requestLocation => '更新位置';
|
||||
|
||||
@override
|
||||
String get map_locationUpdated => '位置已更新';
|
||||
|
||||
@override
|
||||
String map_locationNotShared(String name) {
|
||||
return '$name 回复中未包含位置';
|
||||
}
|
||||
|
||||
@override
|
||||
String map_locationRequestFailed(String name) {
|
||||
return '$name 没有回复';
|
||||
}
|
||||
|
||||
@override
|
||||
String mapCache_zoomLevel(int zoom) {
|
||||
return '缩放 $zoom';
|
||||
|
||||
@@ -3202,6 +3202,10 @@
|
||||
"map_youWithMarkers": "Jij en {count} markeringen",
|
||||
"map_sharedMarkerSemantics": "Gedeelde markering: {label}",
|
||||
"map_nodeMarkerSemantics": "{name}, {type}, {status}",
|
||||
"map_requestLocation": "Locatie bijwerken",
|
||||
"map_locationUpdated": "Locatie bijgewerkt",
|
||||
"map_locationNotShared": "{name} antwoordde zonder locatie",
|
||||
"map_locationRequestFailed": "Geen antwoord van {name}",
|
||||
"mapCache_zoomLevel": "Zoom {zoom}",
|
||||
"mapCache_sizeBytes": "{size} B",
|
||||
"mapCache_sizeKilobytes": "{size} KB",
|
||||
|
||||
@@ -3334,6 +3334,10 @@
|
||||
"map_youWithMarkers": "Ty i znaczniki: {count}",
|
||||
"map_sharedMarkerSemantics": "Udostępniony znacznik: {label}",
|
||||
"map_nodeMarkerSemantics": "{name}, {type}, {status}",
|
||||
"map_requestLocation": "Zaktualizuj lokalizację",
|
||||
"map_locationUpdated": "Lokalizacja zaktualizowana",
|
||||
"map_locationNotShared": "{name} odpowiedział bez lokalizacji",
|
||||
"map_locationRequestFailed": "Brak odpowiedzi od {name}",
|
||||
"mapCache_zoomLevel": "Zoom {zoom}",
|
||||
"mapCache_sizeBytes": "{size} B",
|
||||
"mapCache_sizeKilobytes": "{size} KB",
|
||||
|
||||
@@ -3184,6 +3184,10 @@
|
||||
"map_youWithMarkers": "Você e {count} marcadores",
|
||||
"map_sharedMarkerSemantics": "Marcador compartilhado: {label}",
|
||||
"map_nodeMarkerSemantics": "{name}, {type}, {status}",
|
||||
"map_requestLocation": "Atualizar localização",
|
||||
"map_locationUpdated": "Localização atualizada",
|
||||
"map_locationNotShared": "{name} respondeu sem localização",
|
||||
"map_locationRequestFailed": "Sem resposta de {name}",
|
||||
"mapCache_zoomLevel": "Zoom {zoom}",
|
||||
"mapCache_sizeBytes": "{size} B",
|
||||
"mapCache_sizeKilobytes": "{size} KB",
|
||||
|
||||
@@ -2598,6 +2598,10 @@
|
||||
"map_youWithMarkers": "Вы и маркеров: {count}",
|
||||
"map_sharedMarkerSemantics": "Общий маркер: {label}",
|
||||
"map_nodeMarkerSemantics": "{name}, {type}, {status}",
|
||||
"map_requestLocation": "Обновить местоположение",
|
||||
"map_locationUpdated": "Местоположение обновлено",
|
||||
"map_locationNotShared": "{name} ответил без местоположения",
|
||||
"map_locationRequestFailed": "Нет ответа от {name}",
|
||||
"mapCache_zoomLevel": "Масштаб {zoom}",
|
||||
"mapCache_sizeBytes": "{size} Б",
|
||||
"mapCache_sizeKilobytes": "{size} КБ",
|
||||
|
||||
@@ -3302,6 +3302,10 @@
|
||||
"map_youWithMarkers": "Vy a značky: {count}",
|
||||
"map_sharedMarkerSemantics": "Zdieľaná značka: {label}",
|
||||
"map_nodeMarkerSemantics": "{name}, {type}, {status}",
|
||||
"map_requestLocation": "Aktualizovať polohu",
|
||||
"map_locationUpdated": "Poloha aktualizovaná",
|
||||
"map_locationNotShared": "{name} odpovedal bez polohy",
|
||||
"map_locationRequestFailed": "Žiadna odpoveď od {name}",
|
||||
"mapCache_zoomLevel": "Priblíženie {zoom}",
|
||||
"mapCache_sizeBytes": "{size} B",
|
||||
"mapCache_sizeKilobytes": "{size} KB",
|
||||
|
||||
@@ -3185,6 +3185,10 @@
|
||||
"map_youWithMarkers": "Vi in oznak: {count}",
|
||||
"map_sharedMarkerSemantics": "Deljena oznaka: {label}",
|
||||
"map_nodeMarkerSemantics": "{name}, {type}, {status}",
|
||||
"map_requestLocation": "Posodobi lokacijo",
|
||||
"map_locationUpdated": "Lokacija posodobljena",
|
||||
"map_locationNotShared": "{name} je odgovoril brez lokacije",
|
||||
"map_locationRequestFailed": "Ni odgovora od {name}",
|
||||
"mapCache_zoomLevel": "Povečava {zoom}",
|
||||
"mapCache_sizeBytes": "{size} B",
|
||||
"mapCache_sizeKilobytes": "{size} KB",
|
||||
|
||||
@@ -3179,6 +3179,10 @@
|
||||
"map_youWithMarkers": "Du och {count} markörer",
|
||||
"map_sharedMarkerSemantics": "Delad markör: {label}",
|
||||
"map_nodeMarkerSemantics": "{name}, {type}, {status}",
|
||||
"map_requestLocation": "Uppdatera plats",
|
||||
"map_locationUpdated": "Platsen uppdaterad",
|
||||
"map_locationNotShared": "{name} svarade utan plats",
|
||||
"map_locationRequestFailed": "Inget svar från {name}",
|
||||
"mapCache_zoomLevel": "Zoom {zoom}",
|
||||
"mapCache_sizeBytes": "{size} B",
|
||||
"mapCache_sizeKilobytes": "{size} KB",
|
||||
|
||||
@@ -3281,6 +3281,10 @@
|
||||
"map_youWithMarkers": "Ви та маркерів: {count}",
|
||||
"map_sharedMarkerSemantics": "Спільний маркер: {label}",
|
||||
"map_nodeMarkerSemantics": "{name}, {type}, {status}",
|
||||
"map_requestLocation": "Оновити геопозицію",
|
||||
"map_locationUpdated": "Геопозицію оновлено",
|
||||
"map_locationNotShared": "{name} відповів без геопозиції",
|
||||
"map_locationRequestFailed": "Немає відповіді від {name}",
|
||||
"mapCache_zoomLevel": "Масштаб {zoom}",
|
||||
"mapCache_sizeBytes": "{size} Б",
|
||||
"mapCache_sizeKilobytes": "{size} КБ",
|
||||
|
||||
@@ -3189,6 +3189,10 @@
|
||||
"map_youWithMarkers": "你和 {count} 个标记",
|
||||
"map_sharedMarkerSemantics": "共享标记:{label}",
|
||||
"map_nodeMarkerSemantics": "{name},{type},{status}",
|
||||
"map_requestLocation": "更新位置",
|
||||
"map_locationUpdated": "位置已更新",
|
||||
"map_locationNotShared": "{name} 回复中未包含位置",
|
||||
"map_locationRequestFailed": "{name} 没有回复",
|
||||
"mapCache_zoomLevel": "缩放 {zoom}",
|
||||
"mapCache_sizeBytes": "{size} B",
|
||||
"mapCache_sizeKilobytes": "{size} KB",
|
||||
|
||||
@@ -22,6 +22,12 @@ class Contact {
|
||||
final bool isActive;
|
||||
final Uint8List? rawPacket;
|
||||
|
||||
/// When [latitude]/[longitude] came from a telemetry reply rather than the
|
||||
/// advert, the phone time of that reply. [lastSeen] stays the node's advert
|
||||
/// timestamp (it is written back to the radio), so a radio refresh carrying
|
||||
/// the same advert keeps the fix and a newer advert replaces it.
|
||||
final DateTime? telemetryFixAt;
|
||||
|
||||
Contact({
|
||||
required this.publicKey,
|
||||
required this.name,
|
||||
@@ -39,6 +45,7 @@ class Contact {
|
||||
DateTime? lastMessageAt,
|
||||
this.isActive = true,
|
||||
this.rawPacket,
|
||||
this.telemetryFixAt,
|
||||
}) : lastMessageAt = lastMessageAt ?? lastSeen;
|
||||
|
||||
/// Cached: it backs ==, hashCode and the per-frame contact lookups, and
|
||||
@@ -85,6 +92,12 @@ class Contact {
|
||||
lon <= 180.0;
|
||||
}
|
||||
|
||||
/// The latest time we heard from the node: its advert or a telemetry fix.
|
||||
DateTime get lastHeard {
|
||||
final fixAt = telemetryFixAt;
|
||||
return fixAt != null && fixAt.isAfter(lastSeen) ? fixAt : lastSeen;
|
||||
}
|
||||
|
||||
bool get isFavorite => (flags & contactFlagFavorite) != 0;
|
||||
|
||||
Contact copyWith({
|
||||
@@ -105,6 +118,8 @@ class Contact {
|
||||
DateTime? lastModified,
|
||||
bool? isActive,
|
||||
Uint8List? rawPacket,
|
||||
DateTime? telemetryFixAt,
|
||||
bool clearTelemetryFix = false,
|
||||
}) {
|
||||
return Contact(
|
||||
publicKey: publicKey ?? this.publicKey,
|
||||
@@ -127,6 +142,9 @@ class Contact {
|
||||
lastModified: lastModified ?? this.lastModified,
|
||||
isActive: isActive ?? this.isActive,
|
||||
rawPacket: rawPacket ?? this.rawPacket,
|
||||
telemetryFixAt: clearTelemetryFix
|
||||
? null
|
||||
: (telemetryFixAt ?? this.telemetryFixAt),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@ class DeliveryObservation {
|
||||
final String contactKey;
|
||||
final int pathLength;
|
||||
final int messageBytes;
|
||||
final int secondsSinceLastRx;
|
||||
final bool isFlood;
|
||||
final int deliveryMs;
|
||||
final DateTime timestamp;
|
||||
@@ -11,7 +10,6 @@ class DeliveryObservation {
|
||||
required this.contactKey,
|
||||
required this.pathLength,
|
||||
required this.messageBytes,
|
||||
required this.secondsSinceLastRx,
|
||||
required this.isFlood,
|
||||
required this.deliveryMs,
|
||||
required this.timestamp,
|
||||
@@ -22,7 +20,6 @@ class DeliveryObservation {
|
||||
'contact_key': contactKey,
|
||||
'path_length': pathLength,
|
||||
'message_bytes': messageBytes,
|
||||
'seconds_since_last_rx': secondsSinceLastRx,
|
||||
'is_flood': isFlood,
|
||||
'delivery_ms': deliveryMs,
|
||||
'timestamp': timestamp.toIso8601String(),
|
||||
@@ -34,7 +31,6 @@ class DeliveryObservation {
|
||||
contactKey: json['contact_key'] as String,
|
||||
pathLength: json['path_length'] as int,
|
||||
messageBytes: json['message_bytes'] as int,
|
||||
secondsSinceLastRx: json['seconds_since_last_rx'] as int? ?? 0,
|
||||
isFlood: json['is_flood'] as bool? ?? false,
|
||||
deliveryMs: json['delivery_ms'] as int,
|
||||
timestamp: DateTime.parse(json['timestamp'] as String),
|
||||
|
||||
@@ -26,46 +26,51 @@ class ReviewModeBanner extends StatelessWidget {
|
||||
minimumSize: const Size(48, 48),
|
||||
);
|
||||
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
|
||||
decoration: const BoxDecoration(
|
||||
color: MeshPalette.bg3,
|
||||
border: Border(bottom: BorderSide(color: MeshPalette.warnLine)),
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
const Icon(Icons.science, color: MeshPalette.warn, size: 24),
|
||||
const SizedBox(width: 8),
|
||||
Expanded(child: Text(l10n.reviewMode_banner, style: textStyle)),
|
||||
],
|
||||
),
|
||||
Wrap(
|
||||
spacing: 8,
|
||||
children: [
|
||||
TextButton(
|
||||
style: buttonStyle,
|
||||
onPressed: () {
|
||||
connector.sendReviewTestMessage();
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(content: Text(l10n.reviewMode_testSent)),
|
||||
);
|
||||
},
|
||||
child: Text(l10n.reviewMode_sendTest),
|
||||
),
|
||||
TextButton(
|
||||
style: buttonStyle,
|
||||
// The screens hosting the banner return to the Connect screen
|
||||
// themselves once disconnected.
|
||||
onPressed: () => connector.disconnect(manual: true),
|
||||
child: Text(l10n.reviewMode_exit),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
// A status strip on every main screen: capped so that at the largest
|
||||
// text sizes it can't take over a small phone's screen.
|
||||
return MediaQuery.withClampedTextScaling(
|
||||
maxScaleFactor: 1.3,
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
|
||||
decoration: const BoxDecoration(
|
||||
color: MeshPalette.bg3,
|
||||
border: Border(bottom: BorderSide(color: MeshPalette.warnLine)),
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
const Icon(Icons.science, color: MeshPalette.warn, size: 24),
|
||||
const SizedBox(width: 8),
|
||||
Expanded(child: Text(l10n.reviewMode_banner, style: textStyle)),
|
||||
],
|
||||
),
|
||||
Wrap(
|
||||
spacing: 8,
|
||||
children: [
|
||||
TextButton(
|
||||
style: buttonStyle,
|
||||
onPressed: () {
|
||||
connector.sendReviewTestMessage();
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(content: Text(l10n.reviewMode_testSent)),
|
||||
);
|
||||
},
|
||||
child: Text(l10n.reviewMode_sendTest),
|
||||
),
|
||||
TextButton(
|
||||
style: buttonStyle,
|
||||
// The screens hosting the banner return to the Connect screen
|
||||
// themselves once disconnected.
|
||||
onPressed: () => connector.disconnect(manual: true),
|
||||
child: Text(l10n.reviewMode_exit),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1423,56 +1423,58 @@ class AppSettingsScreen extends StatelessWidget {
|
||||
) {
|
||||
showMeshSheet(
|
||||
context,
|
||||
builder: (ctx) => Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
BottomSheetHeader(title: context.l10n.appSettings_mapTimeFilter),
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(16, 4, 16, 8),
|
||||
child: Text(context.l10n.appSettings_showNodesDiscoveredWithin),
|
||||
),
|
||||
MeshSheetOption(
|
||||
label: context.l10n.appSettings_allTime,
|
||||
selected: settingsService.settings.mapTimeFilterHours == 0,
|
||||
onTap: () {
|
||||
settingsService.setMapTimeFilterHours(0);
|
||||
Navigator.pop(ctx);
|
||||
},
|
||||
),
|
||||
MeshSheetOption(
|
||||
label: context.l10n.appSettings_lastHour,
|
||||
selected: settingsService.settings.mapTimeFilterHours == 1,
|
||||
onTap: () {
|
||||
settingsService.setMapTimeFilterHours(1);
|
||||
Navigator.pop(ctx);
|
||||
},
|
||||
),
|
||||
MeshSheetOption(
|
||||
label: context.l10n.appSettings_last6Hours,
|
||||
selected: settingsService.settings.mapTimeFilterHours == 6,
|
||||
onTap: () {
|
||||
settingsService.setMapTimeFilterHours(6);
|
||||
Navigator.pop(ctx);
|
||||
},
|
||||
),
|
||||
MeshSheetOption(
|
||||
label: context.l10n.appSettings_last24Hours,
|
||||
selected: settingsService.settings.mapTimeFilterHours == 24,
|
||||
onTap: () {
|
||||
settingsService.setMapTimeFilterHours(24);
|
||||
Navigator.pop(ctx);
|
||||
},
|
||||
),
|
||||
MeshSheetOption(
|
||||
label: context.l10n.appSettings_lastWeek,
|
||||
selected: settingsService.settings.mapTimeFilterHours == 168,
|
||||
onTap: () {
|
||||
settingsService.setMapTimeFilterHours(168);
|
||||
Navigator.pop(ctx);
|
||||
},
|
||||
),
|
||||
SizedBox(height: MediaQuery.paddingOf(ctx).bottom + 8),
|
||||
],
|
||||
builder: (ctx) => SingleChildScrollView(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
BottomSheetHeader(title: context.l10n.appSettings_mapTimeFilter),
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(16, 4, 16, 8),
|
||||
child: Text(context.l10n.appSettings_showNodesDiscoveredWithin),
|
||||
),
|
||||
MeshSheetOption(
|
||||
label: context.l10n.appSettings_allTime,
|
||||
selected: settingsService.settings.mapTimeFilterHours == 0,
|
||||
onTap: () {
|
||||
settingsService.setMapTimeFilterHours(0);
|
||||
Navigator.pop(ctx);
|
||||
},
|
||||
),
|
||||
MeshSheetOption(
|
||||
label: context.l10n.appSettings_lastHour,
|
||||
selected: settingsService.settings.mapTimeFilterHours == 1,
|
||||
onTap: () {
|
||||
settingsService.setMapTimeFilterHours(1);
|
||||
Navigator.pop(ctx);
|
||||
},
|
||||
),
|
||||
MeshSheetOption(
|
||||
label: context.l10n.appSettings_last6Hours,
|
||||
selected: settingsService.settings.mapTimeFilterHours == 6,
|
||||
onTap: () {
|
||||
settingsService.setMapTimeFilterHours(6);
|
||||
Navigator.pop(ctx);
|
||||
},
|
||||
),
|
||||
MeshSheetOption(
|
||||
label: context.l10n.appSettings_last24Hours,
|
||||
selected: settingsService.settings.mapTimeFilterHours == 24,
|
||||
onTap: () {
|
||||
settingsService.setMapTimeFilterHours(24);
|
||||
Navigator.pop(ctx);
|
||||
},
|
||||
),
|
||||
MeshSheetOption(
|
||||
label: context.l10n.appSettings_lastWeek,
|
||||
selected: settingsService.settings.mapTimeFilterHours == 168,
|
||||
onTap: () {
|
||||
settingsService.setMapTimeFilterHours(168);
|
||||
Navigator.pop(ctx);
|
||||
},
|
||||
),
|
||||
SizedBox(height: MediaQuery.paddingOf(ctx).bottom + 8),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -1483,29 +1485,32 @@ class AppSettingsScreen extends StatelessWidget {
|
||||
) {
|
||||
showMeshSheet(
|
||||
context,
|
||||
builder: (ctx) => Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
BottomSheetHeader(title: context.l10n.appSettings_unitsTitle),
|
||||
MeshSheetOption(
|
||||
label: context.l10n.appSettings_unitsMetric,
|
||||
selected: settingsService.settings.unitSystem == UnitSystem.metric,
|
||||
onTap: () {
|
||||
settingsService.setUnitSystem(UnitSystem.metric);
|
||||
Navigator.pop(ctx);
|
||||
},
|
||||
),
|
||||
MeshSheetOption(
|
||||
label: context.l10n.appSettings_unitsImperial,
|
||||
selected:
|
||||
settingsService.settings.unitSystem == UnitSystem.imperial,
|
||||
onTap: () {
|
||||
settingsService.setUnitSystem(UnitSystem.imperial);
|
||||
Navigator.pop(ctx);
|
||||
},
|
||||
),
|
||||
SizedBox(height: MediaQuery.paddingOf(ctx).bottom + 8),
|
||||
],
|
||||
builder: (ctx) => SingleChildScrollView(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
BottomSheetHeader(title: context.l10n.appSettings_unitsTitle),
|
||||
MeshSheetOption(
|
||||
label: context.l10n.appSettings_unitsMetric,
|
||||
selected:
|
||||
settingsService.settings.unitSystem == UnitSystem.metric,
|
||||
onTap: () {
|
||||
settingsService.setUnitSystem(UnitSystem.metric);
|
||||
Navigator.pop(ctx);
|
||||
},
|
||||
),
|
||||
MeshSheetOption(
|
||||
label: context.l10n.appSettings_unitsImperial,
|
||||
selected:
|
||||
settingsService.settings.unitSystem == UnitSystem.imperial,
|
||||
onTap: () {
|
||||
settingsService.setUnitSystem(UnitSystem.imperial);
|
||||
Navigator.pop(ctx);
|
||||
},
|
||||
),
|
||||
SizedBox(height: MediaQuery.paddingOf(ctx).bottom + 8),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -1922,6 +1927,7 @@ class _MapApiKeyDialogState extends State<_MapApiKeyDialog> {
|
||||
Widget build(BuildContext context) {
|
||||
final l10n = context.l10n;
|
||||
return AlertDialog(
|
||||
scrollable: true,
|
||||
title: Text(l10n.appSettings_stadiaApiKey),
|
||||
content: SizedBox(
|
||||
width: 420,
|
||||
|
||||
@@ -1786,57 +1786,59 @@ class _ChannelChatScreenState extends State<ChannelChatScreen> {
|
||||
showMeshSheet(
|
||||
context,
|
||||
builder: (sheetContext) => SafeArea(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
BottomSheetHeader(
|
||||
title: l10n.receivedImage_awaiting(
|
||||
entry.bitstreamByteCount,
|
||||
entry.totalChunks,
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
BottomSheetHeader(
|
||||
title: l10n.receivedImage_awaiting(
|
||||
entry.bitstreamByteCount,
|
||||
entry.totalChunks,
|
||||
),
|
||||
subtitle: _imageSenderLabel(entry),
|
||||
),
|
||||
subtitle: _imageSenderLabel(entry),
|
||||
),
|
||||
if (canSave)
|
||||
if (canSave)
|
||||
ListTile(
|
||||
leading: const Icon(Icons.save_alt),
|
||||
title: Text(l10n.receivedImage_save),
|
||||
onTap: () {
|
||||
Navigator.pop(sheetContext);
|
||||
_saveImage(entry);
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.save_alt),
|
||||
title: Text(l10n.receivedImage_save),
|
||||
leading: const Icon(Icons.info_outline),
|
||||
title: Text(l10n.receivedImage_packetInfo),
|
||||
onTap: () {
|
||||
Navigator.pop(sheetContext);
|
||||
_saveImage(entry);
|
||||
_showImagePacketInfo(entry);
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.info_outline),
|
||||
title: Text(l10n.receivedImage_packetInfo),
|
||||
onTap: () {
|
||||
Navigator.pop(sheetContext);
|
||||
_showImagePacketInfo(entry);
|
||||
},
|
||||
),
|
||||
const Divider(height: 1),
|
||||
ListTile(
|
||||
leading: Icon(
|
||||
Icons.delete_outline,
|
||||
color: Theme.of(context).colorScheme.error,
|
||||
const Divider(height: 1),
|
||||
ListTile(
|
||||
leading: Icon(
|
||||
Icons.delete_outline,
|
||||
color: Theme.of(context).colorScheme.error,
|
||||
),
|
||||
title: Text(
|
||||
l10n.common_delete,
|
||||
style: TextStyle(color: Theme.of(context).colorScheme.error),
|
||||
),
|
||||
onTap: () async {
|
||||
Navigator.pop(sheetContext);
|
||||
await context.read<ReceivedImageStore>().deleteImage(
|
||||
entry.streamId,
|
||||
);
|
||||
if (!mounted) return;
|
||||
showDismissibleSnackBar(
|
||||
context,
|
||||
content: Text(l10n.chat_messageDeleted),
|
||||
);
|
||||
},
|
||||
),
|
||||
title: Text(
|
||||
l10n.common_delete,
|
||||
style: TextStyle(color: Theme.of(context).colorScheme.error),
|
||||
),
|
||||
onTap: () async {
|
||||
Navigator.pop(sheetContext);
|
||||
await context.read<ReceivedImageStore>().deleteImage(
|
||||
entry.streamId,
|
||||
);
|
||||
if (!mounted) return;
|
||||
showDismissibleSnackBar(
|
||||
context,
|
||||
content: Text(l10n.chat_messageDeleted),
|
||||
);
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
],
|
||||
const SizedBox(height: 8),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
@@ -1871,6 +1873,7 @@ class _ChannelChatScreenState extends State<ChannelChatScreen> {
|
||||
showDialog<void>(
|
||||
context: context,
|
||||
builder: (dialogContext) => AlertDialog(
|
||||
scrollable: true,
|
||||
title: Text(l10n.receivedImage_packetInfo),
|
||||
content: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
@@ -2247,109 +2250,111 @@ class _ChannelChatScreenState extends State<ChannelChatScreen> {
|
||||
showMeshSheet(
|
||||
context,
|
||||
builder: (sheetContext) => SafeArea(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
BottomSheetHeader(
|
||||
title: message.text.characters.length > 40
|
||||
? '${message.text.characters.take(40)}…'
|
||||
: message.text,
|
||||
subtitle: message.senderName.isNotEmpty
|
||||
? message.senderName
|
||||
: null,
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.reply),
|
||||
title: Text(context.l10n.chat_reply),
|
||||
onTap: () {
|
||||
Navigator.pop(sheetContext);
|
||||
_setReplyingTo(message);
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.route),
|
||||
title: Text(context.l10n.chat_path),
|
||||
onTap: () {
|
||||
Navigator.pop(sheetContext);
|
||||
_showMessagePathInfo(message);
|
||||
},
|
||||
),
|
||||
if (message.pathBytes.isNotEmpty)
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
BottomSheetHeader(
|
||||
title: message.text.characters.length > 40
|
||||
? '${message.text.characters.take(40)}…'
|
||||
: message.text,
|
||||
subtitle: message.senderName.isNotEmpty
|
||||
? message.senderName
|
||||
: null,
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.map_outlined),
|
||||
title: Text(context.l10n.chat_viewPathOnMap),
|
||||
leading: const Icon(Icons.reply),
|
||||
title: Text(context.l10n.chat_reply),
|
||||
onTap: () {
|
||||
Navigator.pop(sheetContext);
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => ChannelMessagePathMapScreen(
|
||||
message: message,
|
||||
channelMessage: true,
|
||||
_setReplyingTo(message);
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.route),
|
||||
title: Text(context.l10n.chat_path),
|
||||
onTap: () {
|
||||
Navigator.pop(sheetContext);
|
||||
_showMessagePathInfo(message);
|
||||
},
|
||||
),
|
||||
if (message.pathBytes.isNotEmpty)
|
||||
ListTile(
|
||||
leading: const Icon(Icons.map_outlined),
|
||||
title: Text(context.l10n.chat_viewPathOnMap),
|
||||
onTap: () {
|
||||
Navigator.pop(sheetContext);
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => ChannelMessagePathMapScreen(
|
||||
message: message,
|
||||
channelMessage: true,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
// Can't react to your own messages
|
||||
if (!message.isOutgoing)
|
||||
);
|
||||
},
|
||||
),
|
||||
// Can't react to your own messages
|
||||
if (!message.isOutgoing)
|
||||
ListTile(
|
||||
leading: const Icon(Icons.add_reaction_outlined),
|
||||
title: Text(context.l10n.chat_addReaction),
|
||||
onTap: () {
|
||||
Navigator.pop(sheetContext);
|
||||
_showEmojiPicker(message);
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.add_reaction_outlined),
|
||||
title: Text(context.l10n.chat_addReaction),
|
||||
leading: const Icon(Icons.copy),
|
||||
title: Text(context.l10n.common_copy),
|
||||
onTap: () {
|
||||
Navigator.pop(sheetContext);
|
||||
_showEmojiPicker(message);
|
||||
copyChatMessageText(context, message.text);
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.copy),
|
||||
title: Text(context.l10n.common_copy),
|
||||
onTap: () {
|
||||
Navigator.pop(sheetContext);
|
||||
copyChatMessageText(context, message.text);
|
||||
},
|
||||
),
|
||||
if (canTranslateMessage)
|
||||
if (canTranslateMessage)
|
||||
ListTile(
|
||||
leading: const Icon(Icons.translate),
|
||||
title: Text(context.l10n.translation_translateMessage),
|
||||
onTap: () {
|
||||
Navigator.pop(sheetContext);
|
||||
unawaited(
|
||||
context.read<MeshCoreConnector>().translateChannelMessage(
|
||||
widget.channel.index,
|
||||
message,
|
||||
manualTranslation: true,
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
if (!message.isOutgoing)
|
||||
ListTile(
|
||||
leading: const Icon(Icons.mark_chat_unread_outlined),
|
||||
title: Text(context.l10n.chat_markAsUnread),
|
||||
onTap: () {
|
||||
Navigator.pop(sheetContext);
|
||||
_markAsUnread(message);
|
||||
},
|
||||
),
|
||||
const Divider(height: 1),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.translate),
|
||||
title: Text(context.l10n.translation_translateMessage),
|
||||
onTap: () {
|
||||
leading: Icon(
|
||||
Icons.delete_outline,
|
||||
color: Theme.of(context).colorScheme.error,
|
||||
),
|
||||
title: Text(
|
||||
context.l10n.common_delete,
|
||||
style: TextStyle(color: Theme.of(context).colorScheme.error),
|
||||
),
|
||||
onTap: () async {
|
||||
Navigator.pop(sheetContext);
|
||||
unawaited(
|
||||
context.read<MeshCoreConnector>().translateChannelMessage(
|
||||
widget.channel.index,
|
||||
message,
|
||||
manualTranslation: true,
|
||||
),
|
||||
);
|
||||
await _deleteMessage(message);
|
||||
},
|
||||
),
|
||||
if (!message.isOutgoing)
|
||||
ListTile(
|
||||
leading: const Icon(Icons.mark_chat_unread_outlined),
|
||||
title: Text(context.l10n.chat_markAsUnread),
|
||||
onTap: () {
|
||||
Navigator.pop(sheetContext);
|
||||
_markAsUnread(message);
|
||||
},
|
||||
),
|
||||
const Divider(height: 1),
|
||||
ListTile(
|
||||
leading: Icon(
|
||||
Icons.delete_outline,
|
||||
color: Theme.of(context).colorScheme.error,
|
||||
),
|
||||
title: Text(
|
||||
context.l10n.common_delete,
|
||||
style: TextStyle(color: Theme.of(context).colorScheme.error),
|
||||
),
|
||||
onTap: () async {
|
||||
Navigator.pop(sheetContext);
|
||||
await _deleteMessage(message);
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
],
|
||||
const SizedBox(height: 8),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -631,56 +631,58 @@ class _ChannelsScreenState extends State<ChannelsScreen>
|
||||
showMeshSheet(
|
||||
parentContext,
|
||||
builder: (sheetContext) => SafeArea(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
ListTile(
|
||||
leading: const Icon(Icons.edit_outlined),
|
||||
title: Text(sheetContext.l10n.channels_editChannel),
|
||||
onTap: () async {
|
||||
Navigator.pop(sheetContext);
|
||||
await Future.delayed(const Duration(milliseconds: 100));
|
||||
if (parentContext.mounted) {
|
||||
_showEditChannelDialog(parentContext, connector, channel);
|
||||
}
|
||||
},
|
||||
),
|
||||
// Notification mode selection
|
||||
ListTile(
|
||||
leading: const Icon(Icons.notifications_outlined),
|
||||
title: Text(sheetContext.l10n.channels_notificationSettings),
|
||||
trailing: const Icon(Icons.chevron_right),
|
||||
onTap: () async {
|
||||
Navigator.pop(sheetContext);
|
||||
await Future.delayed(const Duration(milliseconds: 100));
|
||||
if (parentContext.mounted) {
|
||||
showChannelNotificationModeSheet(
|
||||
parentContext,
|
||||
channel.muteKey,
|
||||
);
|
||||
}
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
leading: Icon(
|
||||
Icons.delete_outline,
|
||||
color: Theme.of(sheetContext).colorScheme.error,
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
ListTile(
|
||||
leading: const Icon(Icons.edit_outlined),
|
||||
title: Text(sheetContext.l10n.channels_editChannel),
|
||||
onTap: () async {
|
||||
Navigator.pop(sheetContext);
|
||||
await Future.delayed(const Duration(milliseconds: 100));
|
||||
if (parentContext.mounted) {
|
||||
_showEditChannelDialog(parentContext, connector, channel);
|
||||
}
|
||||
},
|
||||
),
|
||||
title: Text(
|
||||
sheetContext.l10n.channels_deleteChannel,
|
||||
style: TextStyle(
|
||||
// Notification mode selection
|
||||
ListTile(
|
||||
leading: const Icon(Icons.notifications_outlined),
|
||||
title: Text(sheetContext.l10n.channels_notificationSettings),
|
||||
trailing: const Icon(Icons.chevron_right),
|
||||
onTap: () async {
|
||||
Navigator.pop(sheetContext);
|
||||
await Future.delayed(const Duration(milliseconds: 100));
|
||||
if (parentContext.mounted) {
|
||||
showChannelNotificationModeSheet(
|
||||
parentContext,
|
||||
channel.muteKey,
|
||||
);
|
||||
}
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
leading: Icon(
|
||||
Icons.delete_outline,
|
||||
color: Theme.of(sheetContext).colorScheme.error,
|
||||
),
|
||||
title: Text(
|
||||
sheetContext.l10n.channels_deleteChannel,
|
||||
style: TextStyle(
|
||||
color: Theme.of(sheetContext).colorScheme.error,
|
||||
),
|
||||
),
|
||||
onTap: () async {
|
||||
Navigator.pop(sheetContext);
|
||||
await Future.delayed(const Duration(milliseconds: 100));
|
||||
if (parentContext.mounted) {
|
||||
_confirmDeleteChannel(parentContext, connector, channel);
|
||||
}
|
||||
},
|
||||
),
|
||||
onTap: () async {
|
||||
Navigator.pop(sheetContext);
|
||||
await Future.delayed(const Duration(milliseconds: 100));
|
||||
if (parentContext.mounted) {
|
||||
_confirmDeleteChannel(parentContext, connector, channel);
|
||||
}
|
||||
},
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
@@ -1191,12 +1193,16 @@ class _ChannelsScreenState extends State<ChannelsScreen>
|
||||
vertical: 8,
|
||||
),
|
||||
child: DropdownButtonFormField<Community>(
|
||||
isExpanded: true,
|
||||
initialValue: selectedCommunity,
|
||||
items: _communities
|
||||
.map(
|
||||
(c) => DropdownMenuItem(
|
||||
value: c,
|
||||
child: Text(c.name),
|
||||
child: Text(
|
||||
c.name,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
@@ -1751,6 +1757,7 @@ class _ChannelsScreenState extends State<ChannelsScreen>
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(0, 8, 0, 8),
|
||||
child: DropdownButtonFormField<String>(
|
||||
isExpanded: true,
|
||||
initialValue: selectedCyr2LatProfileId,
|
||||
decoration: InputDecoration(
|
||||
labelText: sheetContext
|
||||
@@ -1762,7 +1769,10 @@ class _ChannelsScreenState extends State<ChannelsScreen>
|
||||
.map((profile) {
|
||||
return DropdownMenuItem(
|
||||
value: profile.id,
|
||||
child: Text(profile.name),
|
||||
child: Text(
|
||||
profile.name,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
);
|
||||
})
|
||||
.toList(),
|
||||
|
||||
@@ -874,6 +874,7 @@ class _ChatScreenState extends State<ChatScreen> {
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(0, 8, 0, 8),
|
||||
child: DropdownButtonFormField<String>(
|
||||
isExpanded: true,
|
||||
initialValue: selectedCyr2LatProfileId,
|
||||
decoration: InputDecoration(
|
||||
labelText:
|
||||
@@ -885,7 +886,10 @@ class _ChatScreenState extends State<ChatScreen> {
|
||||
) {
|
||||
return DropdownMenuItem(
|
||||
value: profile.id,
|
||||
child: Text(profile.name),
|
||||
child: Text(
|
||||
profile.name,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
);
|
||||
}).toList(),
|
||||
onChanged: (value) {
|
||||
@@ -1075,109 +1079,111 @@ class _ChatScreenState extends State<ChatScreen> {
|
||||
showMeshSheet(
|
||||
context,
|
||||
builder: (sheetContext) => SafeArea(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
BottomSheetHeader(
|
||||
title: message.text.characters.length > 40
|
||||
? '${message.text.characters.take(40)}…'
|
||||
: message.text,
|
||||
),
|
||||
// Can't react to your own messages
|
||||
if (!message.isOutgoing)
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
BottomSheetHeader(
|
||||
title: message.text.characters.length > 40
|
||||
? '${message.text.characters.take(40)}…'
|
||||
: message.text,
|
||||
),
|
||||
// Can't react to your own messages
|
||||
if (!message.isOutgoing)
|
||||
ListTile(
|
||||
leading: const Icon(Icons.add_reaction_outlined),
|
||||
title: Text(context.l10n.chat_addReaction),
|
||||
onTap: () {
|
||||
Navigator.pop(sheetContext);
|
||||
_showEmojiPicker(message, contact);
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.add_reaction_outlined),
|
||||
title: Text(context.l10n.chat_addReaction),
|
||||
leading: const Icon(Icons.route),
|
||||
title: Text(context.l10n.chat_path),
|
||||
onTap: () {
|
||||
Navigator.pop(sheetContext);
|
||||
_showEmojiPicker(message, contact);
|
||||
_openMessagePath(message, contact);
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.route),
|
||||
title: Text(context.l10n.chat_path),
|
||||
onTap: () {
|
||||
Navigator.pop(sheetContext);
|
||||
_openMessagePath(message, contact);
|
||||
},
|
||||
),
|
||||
if (message.pathBytes.isNotEmpty)
|
||||
if (message.pathBytes.isNotEmpty)
|
||||
ListTile(
|
||||
leading: const Icon(Icons.map_outlined),
|
||||
title: Text(context.l10n.chat_viewPathOnMap),
|
||||
onTap: () {
|
||||
Navigator.pop(sheetContext);
|
||||
_openMessagePath(message, contact, openMap: true);
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.map_outlined),
|
||||
title: Text(context.l10n.chat_viewPathOnMap),
|
||||
leading: const Icon(Icons.copy),
|
||||
title: Text(context.l10n.common_copy),
|
||||
onTap: () {
|
||||
Navigator.pop(sheetContext);
|
||||
_openMessagePath(message, contact, openMap: true);
|
||||
copyChatMessageText(context, message.text);
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.copy),
|
||||
title: Text(context.l10n.common_copy),
|
||||
onTap: () {
|
||||
Navigator.pop(sheetContext);
|
||||
copyChatMessageText(context, message.text);
|
||||
},
|
||||
),
|
||||
if (canTranslateMessage)
|
||||
if (canTranslateMessage)
|
||||
ListTile(
|
||||
leading: const Icon(Icons.translate),
|
||||
title: Text(context.l10n.translation_translateMessage),
|
||||
onTap: () {
|
||||
Navigator.pop(sheetContext);
|
||||
unawaited(
|
||||
context.read<MeshCoreConnector>().translateContactMessage(
|
||||
widget.contact.publicKeyHex,
|
||||
message,
|
||||
manualTranslation: true,
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
if (!message.isOutgoing)
|
||||
ListTile(
|
||||
leading: const Icon(Icons.mark_chat_unread_outlined),
|
||||
title: Text(context.l10n.chat_markAsUnread),
|
||||
onTap: () {
|
||||
Navigator.pop(sheetContext);
|
||||
_markAsUnread(message);
|
||||
},
|
||||
),
|
||||
if (message.isOutgoing && message.status == MessageStatus.failed)
|
||||
ListTile(
|
||||
leading: const Icon(Icons.refresh),
|
||||
title: Text(context.l10n.common_retry),
|
||||
onTap: () {
|
||||
Navigator.pop(sheetContext);
|
||||
_retryMessage(message);
|
||||
},
|
||||
),
|
||||
if (_resolveContact(context.read<MeshCoreConnector>()).type ==
|
||||
advTypeRoom)
|
||||
ListTile(
|
||||
leading: const Icon(Icons.chat),
|
||||
title: Text(context.l10n.contacts_openChat),
|
||||
onTap: () {
|
||||
Navigator.pop(sheetContext);
|
||||
_openChat(context, contact);
|
||||
},
|
||||
),
|
||||
const Divider(height: 1),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.translate),
|
||||
title: Text(context.l10n.translation_translateMessage),
|
||||
onTap: () {
|
||||
leading: Icon(
|
||||
Icons.delete_outline,
|
||||
color: Theme.of(context).colorScheme.error,
|
||||
),
|
||||
title: Text(
|
||||
context.l10n.common_delete,
|
||||
style: TextStyle(color: Theme.of(context).colorScheme.error),
|
||||
),
|
||||
onTap: () async {
|
||||
Navigator.pop(sheetContext);
|
||||
unawaited(
|
||||
context.read<MeshCoreConnector>().translateContactMessage(
|
||||
widget.contact.publicKeyHex,
|
||||
message,
|
||||
manualTranslation: true,
|
||||
),
|
||||
);
|
||||
await _deleteMessage(message);
|
||||
},
|
||||
),
|
||||
if (!message.isOutgoing)
|
||||
ListTile(
|
||||
leading: const Icon(Icons.mark_chat_unread_outlined),
|
||||
title: Text(context.l10n.chat_markAsUnread),
|
||||
onTap: () {
|
||||
Navigator.pop(sheetContext);
|
||||
_markAsUnread(message);
|
||||
},
|
||||
),
|
||||
if (message.isOutgoing && message.status == MessageStatus.failed)
|
||||
ListTile(
|
||||
leading: const Icon(Icons.refresh),
|
||||
title: Text(context.l10n.common_retry),
|
||||
onTap: () {
|
||||
Navigator.pop(sheetContext);
|
||||
_retryMessage(message);
|
||||
},
|
||||
),
|
||||
if (_resolveContact(context.read<MeshCoreConnector>()).type ==
|
||||
advTypeRoom)
|
||||
ListTile(
|
||||
leading: const Icon(Icons.chat),
|
||||
title: Text(context.l10n.contacts_openChat),
|
||||
onTap: () {
|
||||
Navigator.pop(sheetContext);
|
||||
_openChat(context, contact);
|
||||
},
|
||||
),
|
||||
const Divider(height: 1),
|
||||
ListTile(
|
||||
leading: Icon(
|
||||
Icons.delete_outline,
|
||||
color: Theme.of(context).colorScheme.error,
|
||||
),
|
||||
title: Text(
|
||||
context.l10n.common_delete,
|
||||
style: TextStyle(color: Theme.of(context).colorScheme.error),
|
||||
),
|
||||
onTap: () async {
|
||||
Navigator.pop(sheetContext);
|
||||
await _deleteMessage(message);
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
],
|
||||
const SizedBox(height: 8),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -168,61 +168,63 @@ class _CommunityQrScannerScreenState extends State<CommunityQrScannerScreen> {
|
||||
context,
|
||||
builder: (sheetContext) {
|
||||
final sheetScheme = Theme.of(sheetContext).colorScheme;
|
||||
return Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
BottomSheetHeader(title: context.l10n.channels_joinChannelTitle),
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(20, 0, 20, 4),
|
||||
child: Text(
|
||||
context.l10n.channels_joinChannelConfirm(name),
|
||||
style: TextStyle(color: sheetScheme.onSurfaceVariant),
|
||||
return SingleChildScrollView(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
BottomSheetHeader(title: context.l10n.channels_joinChannelTitle),
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(20, 0, 20, 4),
|
||||
child: Text(
|
||||
context.l10n.channels_joinChannelConfirm(name),
|
||||
style: TextStyle(color: sheetScheme.onSurfaceVariant),
|
||||
),
|
||||
),
|
||||
),
|
||||
MeshCard(
|
||||
child: Row(
|
||||
children: [
|
||||
AvatarCircle(
|
||||
name: name,
|
||||
icon: Icons.lock,
|
||||
color: MeshPalette.blue,
|
||||
size: 44,
|
||||
),
|
||||
const SizedBox(width: 14),
|
||||
Expanded(
|
||||
child: Text(
|
||||
name,
|
||||
style: const TextStyle(
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 15,
|
||||
MeshCard(
|
||||
child: Row(
|
||||
children: [
|
||||
AvatarCircle(
|
||||
name: name,
|
||||
icon: Icons.lock,
|
||||
color: MeshPalette.blue,
|
||||
size: 44,
|
||||
),
|
||||
const SizedBox(width: 14),
|
||||
Expanded(
|
||||
child: Text(
|
||||
name,
|
||||
style: const TextStyle(
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 15,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(16, 8, 16, 16),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: OutlinedButton(
|
||||
onPressed: () => Navigator.pop(sheetContext, false),
|
||||
child: Text(context.l10n.common_cancel),
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(16, 8, 16, 16),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: OutlinedButton(
|
||||
onPressed: () => Navigator.pop(sheetContext, false),
|
||||
child: Text(context.l10n.common_cancel),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: FilledButton(
|
||||
onPressed: () => Navigator.pop(sheetContext, true),
|
||||
child: Text(context.l10n.common_add),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: FilledButton(
|
||||
onPressed: () => Navigator.pop(sheetContext, true),
|
||||
child: Text(context.l10n.common_add),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
@@ -271,61 +273,63 @@ class _CommunityQrScannerScreenState extends State<CommunityQrScannerScreen> {
|
||||
context,
|
||||
builder: (sheetContext) {
|
||||
final sheetScheme = Theme.of(sheetContext).colorScheme;
|
||||
return Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
BottomSheetHeader(title: context.l10n.community_alreadyMember),
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(20, 0, 20, 4),
|
||||
child: Text(
|
||||
context.l10n.community_alreadyMemberMessage(community.name),
|
||||
style: TextStyle(color: sheetScheme.onSurfaceVariant),
|
||||
return SingleChildScrollView(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
BottomSheetHeader(title: context.l10n.community_alreadyMember),
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(20, 0, 20, 4),
|
||||
child: Text(
|
||||
context.l10n.community_alreadyMemberMessage(community.name),
|
||||
style: TextStyle(color: sheetScheme.onSurfaceVariant),
|
||||
),
|
||||
),
|
||||
),
|
||||
MeshCard(
|
||||
child: Row(
|
||||
children: [
|
||||
const Icon(
|
||||
Icons.groups,
|
||||
color: MeshPalette.magenta,
|
||||
size: 32,
|
||||
),
|
||||
const SizedBox(width: 14),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
community.name,
|
||||
style: const TextStyle(
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 15,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
context.l10n.community_shortId(
|
||||
community.shortCommunityId,
|
||||
),
|
||||
style: MeshTheme.mono(
|
||||
fontSize: 13,
|
||||
color: sheetScheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
],
|
||||
MeshCard(
|
||||
child: Row(
|
||||
children: [
|
||||
const Icon(
|
||||
Icons.groups,
|
||||
color: MeshPalette.magenta,
|
||||
size: 32,
|
||||
),
|
||||
),
|
||||
],
|
||||
const SizedBox(width: 14),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
community.name,
|
||||
style: const TextStyle(
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 15,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
context.l10n.community_shortId(
|
||||
community.shortCommunityId,
|
||||
),
|
||||
style: MeshTheme.mono(
|
||||
fontSize: 13,
|
||||
color: sheetScheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(16, 8, 16, 16),
|
||||
child: FilledButton(
|
||||
onPressed: () => Navigator.pop(sheetContext, true),
|
||||
child: Text(context.l10n.common_ok),
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(16, 8, 16, 16),
|
||||
child: FilledButton(
|
||||
onPressed: () => Navigator.pop(sheetContext, true),
|
||||
child: Text(context.l10n.common_ok),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
@@ -348,93 +352,95 @@ class _CommunityQrScannerScreenState extends State<CommunityQrScannerScreen> {
|
||||
builder: (sheetContext) => StatefulBuilder(
|
||||
builder: (sheetContext, setSheetState) {
|
||||
final joinScheme = Theme.of(sheetContext).colorScheme;
|
||||
return Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
BottomSheetHeader(title: context.l10n.community_joinTitle),
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(20, 0, 20, 4),
|
||||
child: Text(
|
||||
context.l10n.community_joinConfirmation(community.name),
|
||||
style: TextStyle(color: joinScheme.onSurfaceVariant),
|
||||
return SingleChildScrollView(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
BottomSheetHeader(title: context.l10n.community_joinTitle),
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(20, 0, 20, 4),
|
||||
child: Text(
|
||||
context.l10n.community_joinConfirmation(community.name),
|
||||
style: TextStyle(color: joinScheme.onSurfaceVariant),
|
||||
),
|
||||
),
|
||||
),
|
||||
MeshCard(
|
||||
child: Row(
|
||||
children: [
|
||||
AvatarCircle(
|
||||
name: community.name,
|
||||
icon: Icons.groups,
|
||||
color: MeshPalette.magenta,
|
||||
size: 44,
|
||||
),
|
||||
const SizedBox(width: 14),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
community.name,
|
||||
style: const TextStyle(
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 15,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
context.l10n.community_shortId(
|
||||
community.shortCommunityId,
|
||||
),
|
||||
style: MeshTheme.mono(
|
||||
fontSize: 13,
|
||||
color: joinScheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
],
|
||||
MeshCard(
|
||||
child: Row(
|
||||
children: [
|
||||
AvatarCircle(
|
||||
name: community.name,
|
||||
icon: Icons.groups,
|
||||
color: MeshPalette.magenta,
|
||||
size: 44,
|
||||
),
|
||||
),
|
||||
],
|
||||
const SizedBox(width: 14),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
community.name,
|
||||
style: const TextStyle(
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 15,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
context.l10n.community_shortId(
|
||||
community.shortCommunityId,
|
||||
),
|
||||
style: MeshTheme.mono(
|
||||
fontSize: 13,
|
||||
color: joinScheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
CheckboxListTile(
|
||||
value: addPublicChannel,
|
||||
onChanged: (value) {
|
||||
setSheetState(() {
|
||||
addPublicChannel = value ?? true;
|
||||
});
|
||||
},
|
||||
title: Text(context.l10n.community_addPublicChannel),
|
||||
subtitle: Text(context.l10n.community_addPublicChannelHint),
|
||||
controlAffinity: ListTileControlAffinity.leading,
|
||||
contentPadding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(16, 8, 16, 16),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: OutlinedButton(
|
||||
onPressed: () {
|
||||
completer.complete(false);
|
||||
Navigator.pop(sheetContext);
|
||||
},
|
||||
child: Text(context.l10n.common_cancel),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: FilledButton(
|
||||
onPressed: () {
|
||||
completer.complete(true);
|
||||
Navigator.pop(sheetContext);
|
||||
},
|
||||
child: Text(context.l10n.community_join),
|
||||
),
|
||||
),
|
||||
],
|
||||
CheckboxListTile(
|
||||
value: addPublicChannel,
|
||||
onChanged: (value) {
|
||||
setSheetState(() {
|
||||
addPublicChannel = value ?? true;
|
||||
});
|
||||
},
|
||||
title: Text(context.l10n.community_addPublicChannel),
|
||||
subtitle: Text(context.l10n.community_addPublicChannelHint),
|
||||
controlAffinity: ListTileControlAffinity.leading,
|
||||
contentPadding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
),
|
||||
),
|
||||
],
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(16, 8, 16, 16),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: OutlinedButton(
|
||||
onPressed: () {
|
||||
completer.complete(false);
|
||||
Navigator.pop(sheetContext);
|
||||
},
|
||||
child: Text(context.l10n.common_cancel),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: FilledButton(
|
||||
onPressed: () {
|
||||
completer.complete(true);
|
||||
Navigator.pop(sheetContext);
|
||||
},
|
||||
child: Text(context.l10n.community_join),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
|
||||
+287
-261
@@ -1,4 +1,5 @@
|
||||
import 'dart:async';
|
||||
import 'dart:math' as math;
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
@@ -545,46 +546,48 @@ class _ContactsScreenState extends State<ContactsScreen>
|
||||
showMeshSheet(
|
||||
context,
|
||||
builder: (sheetContext) => SafeArea(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
BottomSheetHeader(title: context.l10n.contacts_title),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.paste),
|
||||
title: Text(context.l10n.contacts_addContactFromClipboard),
|
||||
onTap: () {
|
||||
Navigator.pop(sheetContext);
|
||||
_contactImport();
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.qr_code_scanner),
|
||||
title: Text(context.l10n.contacts_scanQrCode),
|
||||
onTap: () {
|
||||
Navigator.pop(sheetContext);
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => const ContactQrScannerScreen(),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.person_add_rounded),
|
||||
title: Text(context.l10n.discoveredContacts_Title),
|
||||
onTap: () {
|
||||
Navigator.pop(sheetContext);
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => const DiscoveryScreen(),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
],
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
BottomSheetHeader(title: context.l10n.contacts_title),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.paste),
|
||||
title: Text(context.l10n.contacts_addContactFromClipboard),
|
||||
onTap: () {
|
||||
Navigator.pop(sheetContext);
|
||||
_contactImport();
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.qr_code_scanner),
|
||||
title: Text(context.l10n.contacts_scanQrCode),
|
||||
onTap: () {
|
||||
Navigator.pop(sheetContext);
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => const ContactQrScannerScreen(),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.person_add_rounded),
|
||||
title: Text(context.l10n.discoveredContacts_Title),
|
||||
onTap: () {
|
||||
Navigator.pop(sheetContext);
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => const DiscoveryScreen(),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
@@ -916,6 +919,23 @@ class _ContactsScreenState extends State<ContactsScreen>
|
||||
120.0,
|
||||
); //two 48px icon buttons + 1px divider
|
||||
|
||||
// Scrolls with the list rather than staying pinned above it, so large
|
||||
// text or an open keyboard on a short screen can't squeeze the list out.
|
||||
final discoveredTile = ListTile(
|
||||
dense: true,
|
||||
leading: const Icon(Icons.person_add_rounded),
|
||||
title: Text(
|
||||
context.l10n.contacts_discoveredNearby(
|
||||
connector.discoveredContacts.where((c) => !c.isActive).length,
|
||||
),
|
||||
),
|
||||
trailing: const Icon(Icons.chevron_right),
|
||||
onTap: () => Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(builder: (context) => const DiscoveryScreen()),
|
||||
),
|
||||
);
|
||||
|
||||
return Column(
|
||||
children: [
|
||||
Padding(
|
||||
@@ -1039,20 +1059,6 @@ class _ContactsScreenState extends State<ContactsScreen>
|
||||
],
|
||||
),
|
||||
),
|
||||
ListTile(
|
||||
dense: true,
|
||||
leading: const Icon(Icons.person_add_rounded),
|
||||
title: Text(
|
||||
context.l10n.contacts_discoveredNearby(
|
||||
connector.discoveredContacts.where((c) => !c.isActive).length,
|
||||
),
|
||||
),
|
||||
trailing: const Icon(Icons.chevron_right),
|
||||
onTap: () => Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(builder: (context) => const DiscoveryScreen()),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: RefreshIndicator(
|
||||
onRefresh: () => connector.getContacts(),
|
||||
@@ -1061,9 +1067,13 @@ class _ContactsScreenState extends State<ContactsScreen>
|
||||
builder: (context, constraints) => ListView(
|
||||
physics: const AlwaysScrollableScrollPhysics(),
|
||||
children: [
|
||||
discoveredTile,
|
||||
ConstrainedBox(
|
||||
constraints: BoxConstraints(
|
||||
minHeight: constraints.maxHeight,
|
||||
minHeight: math.max(
|
||||
0,
|
||||
constraints.maxHeight - kMinInteractiveDimension,
|
||||
),
|
||||
),
|
||||
child: EmptyState(
|
||||
icon: Icons.search_off,
|
||||
@@ -1077,8 +1087,10 @@ class _ContactsScreenState extends State<ContactsScreen>
|
||||
)
|
||||
: ListView.builder(
|
||||
padding: const EdgeInsets.only(bottom: 88),
|
||||
itemCount: filteredAndSorted.length,
|
||||
itemBuilder: (context, index) {
|
||||
itemCount: filteredAndSorted.length + 1,
|
||||
itemBuilder: (context, row) {
|
||||
if (row == 0) return discoveredTile;
|
||||
final index = row - 1;
|
||||
final contact = filteredAndSorted[index];
|
||||
final unreadCount = connector.getUnreadCountForContact(
|
||||
contact,
|
||||
@@ -1562,98 +1574,18 @@ class _ContactsScreenState extends State<ContactsScreen>
|
||||
showMeshSheet(
|
||||
context,
|
||||
builder: (sheetContext) => SafeArea(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
BottomSheetHeader(
|
||||
title: contact.name,
|
||||
subtitle: contact.typeLabel(context.l10n),
|
||||
),
|
||||
if (isRepeater) ...[
|
||||
ListTile(
|
||||
leading: Icon(Icons.radar, color: MeshPalette.signal),
|
||||
title: Text(context.l10n.contacts_ping),
|
||||
onTap: () {
|
||||
Navigator.pop(sheetContext);
|
||||
final hw = context
|
||||
.read<MeshCoreConnector>()
|
||||
.pathHashByteWidth;
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => PathTraceMapScreen(
|
||||
title: context.l10n.contacts_repeaterPing,
|
||||
path: contact.pathBytesForDisplay.isNotEmpty
|
||||
? contact.pathBytesForDisplay
|
||||
: _contactPathPrefix(contact, hw),
|
||||
flipPathAround: true,
|
||||
targetContact: contact,
|
||||
pathHashByteWidth: hw,
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
BottomSheetHeader(
|
||||
title: contact.name,
|
||||
subtitle: contact.typeLabel(context.l10n),
|
||||
),
|
||||
ListTile(
|
||||
leading: Icon(Icons.cell_tower, color: MeshPalette.warn),
|
||||
title: Text(context.l10n.contacts_manageRepeater),
|
||||
onTap: () {
|
||||
Navigator.pop(sheetContext);
|
||||
_showRepeaterLogin(context, contact);
|
||||
},
|
||||
),
|
||||
] else if (isRoom) ...[
|
||||
ListTile(
|
||||
leading: Icon(Icons.radar, color: MeshPalette.signal),
|
||||
title: Text(context.l10n.contacts_pathTrace),
|
||||
onTap: () {
|
||||
Navigator.pop(sheetContext);
|
||||
final hw = context
|
||||
.read<MeshCoreConnector>()
|
||||
.pathHashByteWidth;
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => PathTraceMapScreen(
|
||||
title: contact.pathBytesForDisplay.isNotEmpty
|
||||
? context.l10n.contacts_roomPathTrace
|
||||
: context.l10n.contacts_roomPing,
|
||||
path: contact.pathBytesForDisplay.isNotEmpty
|
||||
? contact.pathBytesForDisplay
|
||||
: _contactPathPrefix(contact, hw),
|
||||
flipPathAround: true,
|
||||
targetContact: contact,
|
||||
pathHashByteWidth: hw,
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
leading: Icon(Icons.meeting_room, color: MeshPalette.blue),
|
||||
title: Text(context.l10n.contacts_roomLogin),
|
||||
onTap: () {
|
||||
Navigator.pop(sheetContext);
|
||||
_showRoomLogin(context, contact, RoomLoginDestination.chat);
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
leading: Icon(Icons.room_preferences, color: MeshPalette.warn),
|
||||
title: Text(context.l10n.room_management),
|
||||
onTap: () {
|
||||
Navigator.pop(sheetContext);
|
||||
_showRoomLogin(
|
||||
context,
|
||||
contact,
|
||||
RoomLoginDestination.management,
|
||||
);
|
||||
},
|
||||
),
|
||||
] else ...[
|
||||
if (contact.pathLength > 0)
|
||||
if (isRepeater) ...[
|
||||
ListTile(
|
||||
leading: Icon(Icons.radar, color: MeshPalette.signal),
|
||||
title: Text(context.l10n.contacts_chatTraceRoute),
|
||||
title: Text(context.l10n.contacts_ping),
|
||||
onTap: () {
|
||||
Navigator.pop(sheetContext);
|
||||
final hw = context
|
||||
@@ -1663,10 +1595,10 @@ class _ContactsScreenState extends State<ContactsScreen>
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => PathTraceMapScreen(
|
||||
title: context.l10n.contacts_pathTraceTo(
|
||||
contact.name,
|
||||
),
|
||||
path: contact.pathBytesForDisplay,
|
||||
title: context.l10n.contacts_repeaterPing,
|
||||
path: contact.pathBytesForDisplay.isNotEmpty
|
||||
? contact.pathBytesForDisplay
|
||||
: _contactPathPrefix(contact, hw),
|
||||
flipPathAround: true,
|
||||
targetContact: contact,
|
||||
pathHashByteWidth: hw,
|
||||
@@ -1675,57 +1607,142 @@ class _ContactsScreenState extends State<ContactsScreen>
|
||||
);
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
leading: Icon(Icons.cell_tower, color: MeshPalette.warn),
|
||||
title: Text(context.l10n.contacts_manageRepeater),
|
||||
onTap: () {
|
||||
Navigator.pop(sheetContext);
|
||||
_showRepeaterLogin(context, contact);
|
||||
},
|
||||
),
|
||||
] else if (isRoom) ...[
|
||||
ListTile(
|
||||
leading: Icon(Icons.radar, color: MeshPalette.signal),
|
||||
title: Text(context.l10n.contacts_pathTrace),
|
||||
onTap: () {
|
||||
Navigator.pop(sheetContext);
|
||||
final hw = context
|
||||
.read<MeshCoreConnector>()
|
||||
.pathHashByteWidth;
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => PathTraceMapScreen(
|
||||
title: contact.pathBytesForDisplay.isNotEmpty
|
||||
? context.l10n.contacts_roomPathTrace
|
||||
: context.l10n.contacts_roomPing,
|
||||
path: contact.pathBytesForDisplay.isNotEmpty
|
||||
? contact.pathBytesForDisplay
|
||||
: _contactPathPrefix(contact, hw),
|
||||
flipPathAround: true,
|
||||
targetContact: contact,
|
||||
pathHashByteWidth: hw,
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
leading: Icon(Icons.meeting_room, color: MeshPalette.blue),
|
||||
title: Text(context.l10n.contacts_roomLogin),
|
||||
onTap: () {
|
||||
Navigator.pop(sheetContext);
|
||||
_showRoomLogin(context, contact, RoomLoginDestination.chat);
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
leading: Icon(
|
||||
Icons.room_preferences,
|
||||
color: MeshPalette.warn,
|
||||
),
|
||||
title: Text(context.l10n.room_management),
|
||||
onTap: () {
|
||||
Navigator.pop(sheetContext);
|
||||
_showRoomLogin(
|
||||
context,
|
||||
contact,
|
||||
RoomLoginDestination.management,
|
||||
);
|
||||
},
|
||||
),
|
||||
] else ...[
|
||||
if (contact.pathLength > 0)
|
||||
ListTile(
|
||||
leading: Icon(Icons.radar, color: MeshPalette.signal),
|
||||
title: Text(context.l10n.contacts_chatTraceRoute),
|
||||
onTap: () {
|
||||
Navigator.pop(sheetContext);
|
||||
final hw = context
|
||||
.read<MeshCoreConnector>()
|
||||
.pathHashByteWidth;
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => PathTraceMapScreen(
|
||||
title: context.l10n.contacts_pathTraceTo(
|
||||
contact.name,
|
||||
),
|
||||
path: contact.pathBytesForDisplay,
|
||||
flipPathAround: true,
|
||||
targetContact: contact,
|
||||
pathHashByteWidth: hw,
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
ListTile(
|
||||
leading: Icon(
|
||||
isFavorite ? Icons.star : Icons.star_border,
|
||||
color: MeshPalette.warn,
|
||||
),
|
||||
title: Text(
|
||||
isFavorite
|
||||
? context.l10n.listFilter_removeFromFavorites
|
||||
: context.l10n.listFilter_addToFavorites,
|
||||
),
|
||||
onTap: () async {
|
||||
Navigator.pop(sheetContext);
|
||||
await connector.setContactFlags(
|
||||
contact,
|
||||
isFavorite: !isFavorite,
|
||||
);
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.copy),
|
||||
title: Text(context.l10n.contacts_ShareContact),
|
||||
onTap: () {
|
||||
Navigator.pop(sheetContext);
|
||||
_contactExport(contact.publicKey);
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.connect_without_contact),
|
||||
title: Text(context.l10n.contacts_ShareContactZeroHop),
|
||||
onTap: () {
|
||||
Navigator.pop(sheetContext);
|
||||
_contactZeroHop(contact.publicKey);
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
leading: Icon(
|
||||
Icons.delete,
|
||||
color: Theme.of(context).colorScheme.error,
|
||||
),
|
||||
title: Text(
|
||||
context.l10n.contacts_removeFromContacts,
|
||||
style: TextStyle(color: Theme.of(context).colorScheme.error),
|
||||
),
|
||||
onTap: () {
|
||||
Navigator.pop(sheetContext);
|
||||
_confirmDelete(context, connector, contact);
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
],
|
||||
ListTile(
|
||||
leading: Icon(
|
||||
isFavorite ? Icons.star : Icons.star_border,
|
||||
color: MeshPalette.warn,
|
||||
),
|
||||
title: Text(
|
||||
isFavorite
|
||||
? context.l10n.listFilter_removeFromFavorites
|
||||
: context.l10n.listFilter_addToFavorites,
|
||||
),
|
||||
onTap: () async {
|
||||
Navigator.pop(sheetContext);
|
||||
await connector.setContactFlags(
|
||||
contact,
|
||||
isFavorite: !isFavorite,
|
||||
);
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.copy),
|
||||
title: Text(context.l10n.contacts_ShareContact),
|
||||
onTap: () {
|
||||
Navigator.pop(sheetContext);
|
||||
_contactExport(contact.publicKey);
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.connect_without_contact),
|
||||
title: Text(context.l10n.contacts_ShareContactZeroHop),
|
||||
onTap: () {
|
||||
Navigator.pop(sheetContext);
|
||||
_contactZeroHop(contact.publicKey);
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
leading: Icon(
|
||||
Icons.delete,
|
||||
color: Theme.of(context).colorScheme.error,
|
||||
),
|
||||
title: Text(
|
||||
context.l10n.contacts_removeFromContacts,
|
||||
style: TextStyle(color: Theme.of(context).colorScheme.error),
|
||||
),
|
||||
onTap: () {
|
||||
Navigator.pop(sheetContext);
|
||||
_confirmDelete(context, connector, contact);
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
@@ -1751,6 +1768,7 @@ class _ContactsScreenState extends State<ContactsScreen>
|
||||
context: context,
|
||||
builder: (dialogContext) => StatefulBuilder(
|
||||
builder: (dialogContext, setDialogState) => AlertDialog(
|
||||
scrollable: true,
|
||||
title: Text(context.l10n.contacts_removeFromContacts),
|
||||
content: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
@@ -1877,45 +1895,61 @@ class _ContactTile extends StatelessWidget {
|
||||
icon: contactTypeIcon(contact.type),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
// Main content
|
||||
// Main content. The name owns the whole first row (wrapping to
|
||||
// a second line if needed); last-seen and the route share the row
|
||||
// below so long names stay readable on narrow screens and large
|
||||
// text scales.
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
// Name row + route chip
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
contact.name,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(
|
||||
fontWeight: unreadCount > 0
|
||||
? FontWeight.w700
|
||||
: FontWeight.w500,
|
||||
fontSize: 15,
|
||||
color: scheme.onSurface,
|
||||
Text.rich(
|
||||
TextSpan(
|
||||
text: contact.name,
|
||||
children: [
|
||||
if (isFavorite)
|
||||
WidgetSpan(
|
||||
alignment: PlaceholderAlignment.middle,
|
||||
child: Padding(
|
||||
padding: const EdgeInsetsDirectional.only(
|
||||
start: 4,
|
||||
),
|
||||
child: Icon(
|
||||
Icons.star,
|
||||
size: 16,
|
||||
color: MeshPalette.warn,
|
||||
),
|
||||
),
|
||||
),
|
||||
if (contact.hasLocation)
|
||||
WidgetSpan(
|
||||
alignment: PlaceholderAlignment.middle,
|
||||
child: Padding(
|
||||
padding: const EdgeInsetsDirectional.only(
|
||||
start: 4,
|
||||
),
|
||||
child: Icon(
|
||||
Icons.location_on,
|
||||
size: 16,
|
||||
color: scheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
if (isFavorite) ...[
|
||||
const SizedBox(width: 4),
|
||||
Icon(Icons.star, size: 16, color: MeshPalette.warn),
|
||||
],
|
||||
if (contact.hasLocation) ...[
|
||||
const SizedBox(width: 4),
|
||||
Icon(
|
||||
Icons.location_on,
|
||||
size: 16,
|
||||
color: scheme.onSurfaceVariant,
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(
|
||||
fontWeight: unreadCount > 0
|
||||
? FontWeight.w700
|
||||
: FontWeight.w500,
|
||||
fontSize: 15,
|
||||
color: scheme.onSurface,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 3),
|
||||
// Key prefix + path / subtitle row
|
||||
// Key prefix + path + last seen
|
||||
Row(
|
||||
children: [
|
||||
_KeyPrefixBadge(
|
||||
@@ -1923,6 +1957,7 @@ class _ContactTile extends StatelessWidget {
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Expanded(
|
||||
flex: 3,
|
||||
child: Text(
|
||||
contact.pathLabel(
|
||||
context.l10n,
|
||||
@@ -1936,42 +1971,33 @@ class _ContactTile extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
// Fills its share and right-aligns, so the time sits at
|
||||
// the row's end on wide screens too.
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Text(
|
||||
formatContactLastSeen(context.l10n, lastSeen),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
textAlign: TextAlign.end,
|
||||
style: MeshTheme.mono(
|
||||
fontSize: 12.5,
|
||||
color: unreadCount > 0
|
||||
? MeshPalette.blue
|
||||
: scheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
// Trailing: time + unread badge. A width cap + wrapping keeps
|
||||
// large text scales from overflowing without clamping them.
|
||||
ConstrainedBox(
|
||||
constraints: BoxConstraints(
|
||||
maxWidth: MediaQuery.sizeOf(context).width * 0.25,
|
||||
),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
if (unreadCount > 0) ...[
|
||||
UnreadBadge(count: unreadCount),
|
||||
const SizedBox(height: 4),
|
||||
],
|
||||
Text(
|
||||
formatContactLastSeen(context.l10n, lastSeen),
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
textAlign: TextAlign.right,
|
||||
style: MeshTheme.mono(
|
||||
fontSize: 12.5,
|
||||
color: unreadCount > 0
|
||||
? MeshPalette.blue
|
||||
: scheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
if (unreadCount > 0) ...[
|
||||
const SizedBox(width: 10),
|
||||
UnreadBadge(count: unreadCount),
|
||||
],
|
||||
if (onManage != null)
|
||||
IconButton(
|
||||
icon: const Icon(Icons.admin_panel_settings_outlined),
|
||||
|
||||
@@ -345,25 +345,27 @@ class _DiscoveryScreenState extends State<DiscoveryScreen> {
|
||||
builder: (sheetContext) {
|
||||
final l10n = context.l10n;
|
||||
return SafeArea(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
BottomSheetHeader(
|
||||
title: contact.name,
|
||||
subtitle: contact.typeLabel(l10n),
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.copy),
|
||||
title: Text(l10n.discoveredContacts_copyContact),
|
||||
onTap: () => Navigator.of(sheetContext).pop('copy_contact'),
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.delete),
|
||||
title: Text(l10n.discoveredContacts_deleteContact),
|
||||
onTap: () => Navigator.of(sheetContext).pop('delete_contact'),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
],
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
BottomSheetHeader(
|
||||
title: contact.name,
|
||||
subtitle: contact.typeLabel(l10n),
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.copy),
|
||||
title: Text(l10n.discoveredContacts_copyContact),
|
||||
onTap: () => Navigator.of(sheetContext).pop('copy_contact'),
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.delete),
|
||||
title: Text(l10n.discoveredContacts_deleteContact),
|
||||
onTap: () => Navigator.of(sheetContext).pop('delete_contact'),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
|
||||
@@ -735,15 +735,22 @@ class _MapCacheScreenState extends State<MapCacheScreen> {
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
OutlinedButton(
|
||||
style: OutlinedButton.styleFrom(
|
||||
foregroundColor: MeshPalette.alert,
|
||||
side: const BorderSide(
|
||||
color: MeshPalette.alertLine,
|
||||
// Flexible lets the label wrap instead of pushing
|
||||
// the row past the screen edge at large text sizes.
|
||||
Flexible(
|
||||
child: OutlinedButton(
|
||||
style: OutlinedButton.styleFrom(
|
||||
foregroundColor: MeshPalette.alert,
|
||||
side: const BorderSide(
|
||||
color: MeshPalette.alertLine,
|
||||
),
|
||||
),
|
||||
onPressed: _isDownloading ? null : _clearCache,
|
||||
child: Text(
|
||||
l10n.mapCache_clearCacheButton,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
onPressed: _isDownloading ? null : _clearCache,
|
||||
child: Text(l10n.mapCache_clearCacheButton),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -24,6 +24,7 @@ import '../services/app_settings_service.dart';
|
||||
import '../services/path_history_service.dart';
|
||||
import '../services/map_marker_service.dart';
|
||||
import '../services/map_tile_cache_service.dart';
|
||||
import '../services/telemetry_location_request.dart';
|
||||
import '../services/network_map/network_map_api_client.dart';
|
||||
import '../services/ui_view_state_service.dart';
|
||||
import '../storage/prefs_manager.dart';
|
||||
@@ -105,6 +106,7 @@ class _MapScreenState extends State<MapScreen> with DisconnectNavigationMixin {
|
||||
bool _showNodeLabels = true;
|
||||
double _zoom = 10.0;
|
||||
String? _selectedKey;
|
||||
String? _locatingKey;
|
||||
LatLng? _selectedGuessPos;
|
||||
_Freshness _freshness = _Freshness.all;
|
||||
final TextEditingController _searchController = TextEditingController();
|
||||
@@ -209,7 +211,7 @@ class _MapScreenState extends State<MapScreen> with DisconnectNavigationMixin {
|
||||
: MapPalette.markerShadow.withValues(alpha: 0.18);
|
||||
|
||||
_NodeAge _ageOf(Contact contact) {
|
||||
final d = DateTime.now().difference(contact.lastSeen);
|
||||
final d = DateTime.now().difference(contact.lastHeard);
|
||||
if (d.inMinutes <= 60) return _NodeAge.online;
|
||||
if (d.inHours <= 24) return _NodeAge.recent;
|
||||
return _NodeAge.stale;
|
||||
@@ -554,7 +556,7 @@ class _MapScreenState extends State<MapScreen> with DisconnectNavigationMixin {
|
||||
final filteredByTime = settings.mapTimeFilterHours == 0
|
||||
? contacts
|
||||
: contacts.where((c) {
|
||||
final hoursSinceLastSeen = now.difference(c.lastSeen).inHours;
|
||||
final hoursSinceLastSeen = now.difference(c.lastHeard).inHours;
|
||||
return hoursSinceLastSeen <= settings.mapTimeFilterHours;
|
||||
}).toList();
|
||||
|
||||
@@ -2132,7 +2134,7 @@ class _MapScreenState extends State<MapScreen> with DisconnectNavigationMixin {
|
||||
if (a.hasLocation != b.hasLocation) {
|
||||
return a.hasLocation ? -1 : 1;
|
||||
}
|
||||
return b.lastSeen.compareTo(a.lastSeen);
|
||||
return b.lastHeard.compareTo(a.lastHeard);
|
||||
});
|
||||
final results = matches.take(8).toList();
|
||||
return Container(
|
||||
@@ -2480,7 +2482,7 @@ class _MapScreenState extends State<MapScreen> with DisconnectNavigationMixin {
|
||||
children: [
|
||||
_miniMeta(
|
||||
context.l10n.map_lastSeen,
|
||||
formatNodeLastSeen(context.l10n, contact.lastSeen),
|
||||
formatNodeLastSeen(context.l10n, contact.lastHeard),
|
||||
),
|
||||
_miniMeta(
|
||||
context.l10n.map_path,
|
||||
@@ -2507,6 +2509,33 @@ class _MapScreenState extends State<MapScreen> with DisconnectNavigationMixin {
|
||||
crossAxisAlignment: WrapCrossAlignment.center,
|
||||
children: [
|
||||
..._selectedNodeActions(context, contact, connector),
|
||||
// Repeaters and rooms only send GPS to logged-in admins.
|
||||
if (contact.isActive &&
|
||||
(contact.type == advTypeChat ||
|
||||
contact.type == advTypeSensor))
|
||||
OutlinedButton.icon(
|
||||
style: OutlinedButton.styleFrom(
|
||||
foregroundColor: _overlayPrimaryTextColor,
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 14,
|
||||
vertical: 8,
|
||||
),
|
||||
minimumSize: const Size(0, 44),
|
||||
),
|
||||
onPressed: _locatingKey == null
|
||||
? () => _requestNodeLocation(contact, connector)
|
||||
: null,
|
||||
icon: _locatingKey == contact.publicKeyHex
|
||||
? const SizedBox.square(
|
||||
dimension: 18,
|
||||
child: CircularProgressIndicator(strokeWidth: 2),
|
||||
)
|
||||
: const Icon(Icons.my_location, size: 18),
|
||||
label: Text(
|
||||
context.l10n.map_requestLocation,
|
||||
style: const TextStyle(fontSize: 14),
|
||||
),
|
||||
),
|
||||
TextButton(
|
||||
style: TextButton.styleFrom(
|
||||
foregroundColor: MapPalette.selected,
|
||||
@@ -2532,6 +2561,36 @@ class _MapScreenState extends State<MapScreen> with DisconnectNavigationMixin {
|
||||
);
|
||||
}
|
||||
|
||||
/// Asks the node for telemetry; a GPS fix in the reply moves its marker.
|
||||
Future<void> _requestNodeLocation(
|
||||
Contact contact,
|
||||
MeshCoreConnector connector,
|
||||
) async {
|
||||
setState(() => _locatingKey = contact.publicKeyHex);
|
||||
final result = await requestTelemetryLocation(connector, contact);
|
||||
if (!mounted) return;
|
||||
setState(() => _locatingKey = null);
|
||||
final l10n = context.l10n;
|
||||
final message = switch (result) {
|
||||
TelemetryLocationResult.located => l10n.map_locationUpdated,
|
||||
TelemetryLocationResult.noLocation => l10n.map_locationNotShared(
|
||||
contact.name,
|
||||
),
|
||||
TelemetryLocationResult.failed => l10n.map_locationRequestFailed(
|
||||
contact.name,
|
||||
),
|
||||
};
|
||||
showDismissibleSnackBar(context, content: Text(message));
|
||||
final updated = connector.contacts
|
||||
.where((c) => c.publicKeyHex == contact.publicKeyHex)
|
||||
.firstOrNull;
|
||||
if (result == TelemetryLocationResult.located &&
|
||||
updated != null &&
|
||||
updated.hasLocation) {
|
||||
_mapController.move(LatLng(updated.latitude!, updated.longitude!), _zoom);
|
||||
}
|
||||
}
|
||||
|
||||
Widget _miniMeta(String label, String value) {
|
||||
return Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
@@ -3012,6 +3071,7 @@ class _MapScreenState extends State<MapScreen> with DisconnectNavigationMixin {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (dialogContext) => AlertDialog(
|
||||
scrollable: true,
|
||||
title: Text(
|
||||
marker.label.isEmpty ? context.l10n.map_sharedPin : marker.label,
|
||||
),
|
||||
@@ -4007,7 +4067,7 @@ int _mapContactSignature(Contact contact) {
|
||||
_bytesSignature(contact.pathOverrideBytes),
|
||||
contact.latitude,
|
||||
contact.longitude,
|
||||
contact.lastSeen.millisecondsSinceEpoch,
|
||||
contact.lastHeard.millisecondsSinceEpoch,
|
||||
contact.lastMessageAt.millisecondsSinceEpoch,
|
||||
contact.isActive,
|
||||
);
|
||||
|
||||
@@ -180,9 +180,11 @@ class _RegionManagementScreenState extends State<RegionManagementScreen> {
|
||||
child: DropdownButtonFormField<Region>(
|
||||
key: ValueKey(current),
|
||||
initialValue: current,
|
||||
isExpanded: true,
|
||||
decoration: InputDecoration(
|
||||
labelText: l10n.settings_regionDefault,
|
||||
helperText: l10n.settings_regionDefaultSubtitle,
|
||||
helperMaxLines: 3,
|
||||
border: const OutlineInputBorder(),
|
||||
),
|
||||
items: [
|
||||
@@ -192,15 +194,22 @@ class _RegionManagementScreenState extends State<RegionManagementScreen> {
|
||||
radioDefault == null
|
||||
? l10n.settings_regionDefaultNone
|
||||
: l10n.settings_regionUseRadioDefault(radioDefault),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
if (canForceUnscoped)
|
||||
DropdownMenuItem(
|
||||
value: kUnscopedRegion,
|
||||
child: Text(l10n.settings_regionNoRegion),
|
||||
child: Text(
|
||||
l10n.settings_regionNoRegion,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
for (final region in _regions)
|
||||
DropdownMenuItem(value: region, child: Text(region)),
|
||||
DropdownMenuItem(
|
||||
value: region,
|
||||
child: Text(region, overflow: TextOverflow.ellipsis),
|
||||
),
|
||||
],
|
||||
onChanged: (value) => connector.setDefaultRegion(value ?? ''),
|
||||
),
|
||||
@@ -222,6 +231,7 @@ class _RegionManagementScreenState extends State<RegionManagementScreen> {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(top: 8, bottom: 8),
|
||||
child: DropdownButtonFormField<Region>(
|
||||
isExpanded: true,
|
||||
key: ValueKey('radio-default-$radioDefault'),
|
||||
initialValue: radioDefault,
|
||||
decoration: InputDecoration(
|
||||
@@ -233,10 +243,16 @@ class _RegionManagementScreenState extends State<RegionManagementScreen> {
|
||||
items: [
|
||||
DropdownMenuItem(
|
||||
value: '',
|
||||
child: Text(l10n.settings_regionDefaultNone),
|
||||
child: Text(
|
||||
l10n.settings_regionDefaultNone,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
for (final region in options)
|
||||
DropdownMenuItem(value: region, child: Text(region)),
|
||||
DropdownMenuItem(
|
||||
value: region,
|
||||
child: Text(region, overflow: TextOverflow.ellipsis),
|
||||
),
|
||||
],
|
||||
onChanged: (value) => _setRadioDefaultRegion(connector, value ?? ''),
|
||||
),
|
||||
|
||||
@@ -471,7 +471,6 @@ class _RepeaterCliScreenState extends State<RepeaterCliScreen> {
|
||||
),
|
||||
body: Column(
|
||||
children: [
|
||||
const RadioDisconnectedBanner(),
|
||||
// Quick commands bar
|
||||
Container(
|
||||
color: scheme.surfaceContainer,
|
||||
@@ -506,10 +505,29 @@ class _RepeaterCliScreenState extends State<RepeaterCliScreen> {
|
||||
Divider(height: 1, color: scheme.outlineVariant),
|
||||
|
||||
// Output area
|
||||
// The disconnected banner lives in the output area and is capped at
|
||||
// half of it, so large text or an open keyboard can't push the
|
||||
// command input off screen.
|
||||
Expanded(
|
||||
child: _commandHistory.isEmpty
|
||||
? _buildEmptyState()
|
||||
: _buildCommandHistory(),
|
||||
child: LayoutBuilder(
|
||||
builder: (context, constraints) => Column(
|
||||
children: [
|
||||
ConstrainedBox(
|
||||
constraints: BoxConstraints(
|
||||
maxHeight: constraints.maxHeight / 2,
|
||||
),
|
||||
child: const SingleChildScrollView(
|
||||
child: RadioDisconnectedBanner(),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: _commandHistory.isEmpty
|
||||
? _buildEmptyState()
|
||||
: _buildCommandHistory(),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
Divider(height: 1, color: scheme.outlineVariant),
|
||||
@@ -616,10 +634,10 @@ class _RepeaterCliScreenState extends State<RepeaterCliScreen> {
|
||||
final scheme = Theme.of(context).colorScheme;
|
||||
final textTheme = Theme.of(context).textTheme;
|
||||
return Center(
|
||||
child: Padding(
|
||||
child: SingleChildScrollView(
|
||||
padding: const EdgeInsets.all(24),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Icon(Icons.terminal, size: 48, color: scheme.onSurfaceVariant),
|
||||
const SizedBox(height: 12),
|
||||
|
||||
@@ -1412,14 +1412,21 @@ class _RepeaterSettingsScreenState extends State<RepeaterSettingsScreen> {
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 16),
|
||||
child: MeshCard(
|
||||
child: Row(
|
||||
// The button sits under the message so neither is
|
||||
// squeezed on narrow screens or large text.
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
const Icon(Icons.info_outline, size: 20),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: Text(
|
||||
context.l10n.repeater_settingsNotLoaded,
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
const Icon(Icons.info_outline, size: 20),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: Text(
|
||||
context.l10n.repeater_settingsNotLoaded,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
TextButton(
|
||||
onPressed: _isLoading || !connected
|
||||
@@ -1627,12 +1634,16 @@ class _RepeaterSettingsScreenState extends State<RepeaterSettingsScreen> {
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
DropdownButtonFormField<int>(
|
||||
isExpanded: true,
|
||||
initialValue: _bandwidth,
|
||||
decoration: InputDecoration(labelText: l10n.repeater_bandwidth),
|
||||
items: _bandwidthOptions.map((bw) {
|
||||
return DropdownMenuItem(
|
||||
value: bw,
|
||||
child: Text(_formatBandwidthLabel(bw)),
|
||||
child: Text(
|
||||
_formatBandwidthLabel(bw),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
);
|
||||
}).toList(),
|
||||
onChanged: !_loaded('radio')
|
||||
@@ -1648,12 +1659,16 @@ class _RepeaterSettingsScreenState extends State<RepeaterSettingsScreen> {
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
DropdownButtonFormField<int>(
|
||||
isExpanded: true,
|
||||
initialValue: _spreadingFactor,
|
||||
decoration: InputDecoration(
|
||||
labelText: l10n.repeater_spreadingFactor,
|
||||
),
|
||||
items: _spreadingFactorOptions.map((sf) {
|
||||
return DropdownMenuItem(value: sf, child: Text('SF$sf'));
|
||||
return DropdownMenuItem(
|
||||
value: sf,
|
||||
child: Text('SF$sf', overflow: TextOverflow.ellipsis),
|
||||
);
|
||||
}).toList(),
|
||||
onChanged: !_loaded('radio')
|
||||
? null
|
||||
@@ -1668,12 +1683,16 @@ class _RepeaterSettingsScreenState extends State<RepeaterSettingsScreen> {
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
DropdownButtonFormField<int>(
|
||||
isExpanded: true,
|
||||
initialValue: _codingRate,
|
||||
decoration: InputDecoration(
|
||||
labelText: l10n.repeater_codingRate,
|
||||
),
|
||||
items: _codingRateOptions.map((cr) {
|
||||
return DropdownMenuItem(value: cr, child: Text('4/$cr'));
|
||||
return DropdownMenuItem(
|
||||
value: cr,
|
||||
child: Text('4/$cr', overflow: TextOverflow.ellipsis),
|
||||
);
|
||||
}).toList(),
|
||||
onChanged: !_loaded('radio')
|
||||
? null
|
||||
@@ -2123,6 +2142,7 @@ class _RepeaterSettingsScreenState extends State<RepeaterSettingsScreen> {
|
||||
children: [
|
||||
Expanded(
|
||||
child: DropdownButtonFormField<String>(
|
||||
isExpanded: true,
|
||||
initialValue: _loaded('loop.detect') ? _loopDetect : null,
|
||||
decoration: InputDecoration(
|
||||
labelText: l10n.repeater_loopDetect,
|
||||
@@ -2132,19 +2152,31 @@ class _RepeaterSettingsScreenState extends State<RepeaterSettingsScreen> {
|
||||
items: [
|
||||
DropdownMenuItem(
|
||||
value: 'off',
|
||||
child: Text(l10n.repeater_loopDetectOff),
|
||||
child: Text(
|
||||
l10n.repeater_loopDetectOff,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
DropdownMenuItem(
|
||||
value: 'minimal',
|
||||
child: Text(l10n.repeater_loopDetectMinimal),
|
||||
child: Text(
|
||||
l10n.repeater_loopDetectMinimal,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
DropdownMenuItem(
|
||||
value: 'moderate',
|
||||
child: Text(l10n.repeater_loopDetectModerate),
|
||||
child: Text(
|
||||
l10n.repeater_loopDetectModerate,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
DropdownMenuItem(
|
||||
value: 'strict',
|
||||
child: Text(l10n.repeater_loopDetectStrict),
|
||||
child: Text(
|
||||
l10n.repeater_loopDetectStrict,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
],
|
||||
onChanged: !_loaded('loop.detect')
|
||||
@@ -2323,6 +2355,7 @@ class _RepeaterSettingsScreenState extends State<RepeaterSettingsScreen> {
|
||||
children: [
|
||||
Expanded(
|
||||
child: DropdownButtonFormField<int>(
|
||||
isExpanded: true,
|
||||
initialValue: _loaded('path.hash.mode')
|
||||
? _pathHashMode
|
||||
: null,
|
||||
@@ -2334,15 +2367,24 @@ class _RepeaterSettingsScreenState extends State<RepeaterSettingsScreen> {
|
||||
items: [
|
||||
DropdownMenuItem(
|
||||
value: 0,
|
||||
child: Text(l10n.repeater_pathHashModeOption0),
|
||||
child: Text(
|
||||
l10n.repeater_pathHashModeOption0,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
DropdownMenuItem(
|
||||
value: 1,
|
||||
child: Text(l10n.repeater_pathHashModeOption1),
|
||||
child: Text(
|
||||
l10n.repeater_pathHashModeOption1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
DropdownMenuItem(
|
||||
value: 2,
|
||||
child: Text(l10n.repeater_pathHashModeOption2),
|
||||
child: Text(
|
||||
l10n.repeater_pathHashModeOption2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
],
|
||||
onChanged: !_loaded('path.hash.mode')
|
||||
|
||||
@@ -706,25 +706,38 @@ class _RepeaterStatusScreenState extends State<RepeaterStatusScreen> {
|
||||
final columns = constraints.maxWidth / textScaler.scale(1) < 320
|
||||
? 1
|
||||
: 2;
|
||||
return GridView.builder(
|
||||
shrinkWrap: true,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
itemCount: items.length,
|
||||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
||||
crossAxisCount: columns,
|
||||
mainAxisSpacing: 8,
|
||||
crossAxisSpacing: 8,
|
||||
mainAxisExtent: textScaler.scale(52) + 28,
|
||||
),
|
||||
itemBuilder: (context, index) {
|
||||
final item = items[index];
|
||||
return StatTile(
|
||||
icon: item.icon,
|
||||
label: item.label,
|
||||
value: item.value,
|
||||
color: item.color,
|
||||
);
|
||||
},
|
||||
// Rows size to their tallest tile, so labels that wrap at large
|
||||
// text scales grow the row instead of overflowing a fixed extent.
|
||||
Widget tile(_StatItem item) => StatTile(
|
||||
icon: item.icon,
|
||||
label: item.label,
|
||||
value: item.value,
|
||||
color: item.color,
|
||||
);
|
||||
return Column(
|
||||
children: [
|
||||
for (var i = 0; i < items.length; i += columns)
|
||||
Padding(
|
||||
padding: EdgeInsets.only(
|
||||
bottom: i + columns < items.length ? 8 : 0,
|
||||
),
|
||||
child: IntrinsicHeight(
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
for (var j = 0; j < columns; j++) ...[
|
||||
if (j > 0) const SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: i + j < items.length
|
||||
? tile(items[i + j])
|
||||
: const SizedBox.shrink(),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
@@ -805,12 +805,14 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
||||
context: context,
|
||||
builder: (dialogContext) => StatefulBuilder(
|
||||
builder: (builderContext, setDialogState) => AlertDialog(
|
||||
scrollable: true,
|
||||
title: Text(l10n.repeater_pathHashMode),
|
||||
content: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
DropdownButtonFormField<int>(
|
||||
isExpanded: true,
|
||||
initialValue: selectedMode,
|
||||
decoration: InputDecoration(
|
||||
labelText: l10n.repeater_pathHashMode,
|
||||
@@ -819,15 +821,24 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
||||
items: [
|
||||
DropdownMenuItem(
|
||||
value: 0,
|
||||
child: Text(l10n.repeater_pathHashModeOption0),
|
||||
child: Text(
|
||||
l10n.repeater_pathHashModeOption0,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
DropdownMenuItem(
|
||||
value: 1,
|
||||
child: Text(l10n.repeater_pathHashModeOption1),
|
||||
child: Text(
|
||||
l10n.repeater_pathHashModeOption1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
DropdownMenuItem(
|
||||
value: 2,
|
||||
child: Text(l10n.repeater_pathHashModeOption2),
|
||||
child: Text(
|
||||
l10n.repeater_pathHashModeOption2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
],
|
||||
onChanged: (value) {
|
||||
|
||||
@@ -12,6 +12,7 @@ import '../connector/meshcore_connector.dart';
|
||||
import '../connector/meshcore_protocol.dart';
|
||||
import '../services/app_settings_service.dart';
|
||||
import '../services/repeater_command_service.dart';
|
||||
import '../services/telemetry_location_request.dart';
|
||||
import '../utils/app_logger.dart';
|
||||
import '../widgets/routing_sheet.dart';
|
||||
import '../helpers/cayenne_lpp.dart';
|
||||
@@ -210,6 +211,14 @@ class _TelemetryScreenState extends State<TelemetryScreen> {
|
||||
source: 'telemetry',
|
||||
);
|
||||
}
|
||||
final fix = telemetryGpsFix(parsedTelemetry);
|
||||
if (fix != null && !widget.isSelf) {
|
||||
context.read<MeshCoreConnector>().updateContactLocationFromTelemetry(
|
||||
widget.contact.publicKeyHex,
|
||||
fix.latitude,
|
||||
fix.longitude,
|
||||
);
|
||||
}
|
||||
if (!mounted) return;
|
||||
final isAutoRefreshRequest = _activeTelemetryRequestIsAutoRefresh;
|
||||
setState(() {
|
||||
|
||||
@@ -843,9 +843,12 @@ class MessageRetryService extends ChangeNotifier {
|
||||
tripTimeMs,
|
||||
);
|
||||
}
|
||||
// Learn from the attempt this ACK belongs to, not the latest one: a
|
||||
// late ACK for a direct attempt can land after a retry went flood.
|
||||
if (config?.onDeliveryObserved != null &&
|
||||
tripTimeMs > 0 &&
|
||||
message.pathLength != null) {
|
||||
selection != null &&
|
||||
!ambiguousPath) {
|
||||
final outboundTextForObserved =
|
||||
config!.prepareContactOutboundText?.call(contact, message.text) ??
|
||||
message.text;
|
||||
@@ -854,7 +857,7 @@ class MessageRetryService extends ChangeNotifier {
|
||||
.length;
|
||||
config.onDeliveryObserved!(
|
||||
contact.publicKeyHex,
|
||||
message.pathLength!,
|
||||
selection.useFlood ? -1 : selection.hopCount,
|
||||
messageBytesForObserved,
|
||||
tripTimeMs,
|
||||
);
|
||||
|
||||
@@ -357,8 +357,9 @@ class PathHistoryService extends ChangeNotifier {
|
||||
|
||||
updatedPaths.removeWhere((p) => _pathsEqual(p.pathBytes, pathBytes));
|
||||
|
||||
// Make room by dropping the weakest path so new discoveries still land.
|
||||
if (existing == null && updatedPaths.length >= _maxHistoryEntries) {
|
||||
return;
|
||||
updatedPaths.remove(_lowestScoredPath(updatedPaths));
|
||||
}
|
||||
|
||||
updatedPaths.insert(0, newRecord);
|
||||
@@ -540,6 +541,17 @@ class PathHistoryService extends ChangeNotifier {
|
||||
return ranked;
|
||||
}
|
||||
|
||||
PathRecord _lowestScoredPath(List<PathRecord> paths) {
|
||||
final fastestTripMs = _getFastestKnownTripMs(paths);
|
||||
final highestRouteWeight = _getHighestKnownRouteWeight(paths);
|
||||
double score(PathRecord p) => _scorePathRecord(
|
||||
p,
|
||||
fastestTripMs: fastestTripMs,
|
||||
highestRouteWeight: highestRouteWeight,
|
||||
);
|
||||
return paths.reduce((a, b) => score(b) < score(a) ? b : a);
|
||||
}
|
||||
|
||||
int? _getFastestKnownTripMs(List<PathRecord> paths) {
|
||||
final knownTrips = paths
|
||||
.where((path) => path.tripTimeMs > 0)
|
||||
|
||||
@@ -0,0 +1,130 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
|
||||
import '../connector/meshcore_connector.dart';
|
||||
import '../connector/meshcore_protocol.dart';
|
||||
import '../helpers/cayenne_lpp.dart';
|
||||
import '../models/contact.dart';
|
||||
import '../models/path_selection.dart';
|
||||
import '../utils/app_logger.dart';
|
||||
|
||||
enum TelemetryLocationResult { located, noLocation, failed }
|
||||
|
||||
/// Returns the first valid GPS fix in parsed Cayenne LPP telemetry, or null.
|
||||
({double latitude, double longitude})? telemetryGpsFix(
|
||||
List<Map<String, dynamic>> entries,
|
||||
) {
|
||||
for (final entry in entries) {
|
||||
final values = entry['values'];
|
||||
if (values is! Map) continue;
|
||||
final gps = values['gps'];
|
||||
if (gps is! Map) continue;
|
||||
final lat = gps['latitude'];
|
||||
final lon = gps['longitude'];
|
||||
if (lat is! num || lon is! num) continue;
|
||||
final latitude = lat.toDouble();
|
||||
final longitude = lon.toDouble();
|
||||
const double epsilon = 1e-6;
|
||||
final valid =
|
||||
(latitude.abs() > epsilon || longitude.abs() > epsilon) &&
|
||||
latitude >= -90.0 &&
|
||||
latitude <= 90.0 &&
|
||||
longitude >= -180.0 &&
|
||||
longitude <= 180.0;
|
||||
if (valid) return (latitude: latitude, longitude: longitude);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/// Asks [contact] for its telemetry and, when the reply carries a GPS fix,
|
||||
/// stores it on the contact so the map moves the node right away.
|
||||
Future<TelemetryLocationResult> requestTelemetryLocation(
|
||||
MeshCoreConnector connector,
|
||||
Contact contact,
|
||||
) async {
|
||||
final completer = Completer<List<Map<String, dynamic>>?>();
|
||||
// Armed just before our send: a background retry's RESP_CODE_SENT that
|
||||
// lands while the path is being prepared must not be taken for ours.
|
||||
var awaitingSent = false;
|
||||
int? tag;
|
||||
Timer? timeout;
|
||||
void finish(List<Map<String, dynamic>>? parsed) {
|
||||
if (completer.isCompleted) return;
|
||||
timeout?.cancel();
|
||||
completer.complete(parsed);
|
||||
}
|
||||
|
||||
final isChat = contact.type == advTypeChat;
|
||||
final subscription = connector.receivedFrames.listen((frame) {
|
||||
if (frame.isEmpty || completer.isCompleted) return;
|
||||
final reader = BufferReader(frame);
|
||||
try {
|
||||
final cmd = reader.readByte();
|
||||
if (cmd == respCodeSent && awaitingSent) {
|
||||
awaitingSent = false;
|
||||
reader.skipBytes(1); // reserved
|
||||
tag = reader.readUInt32LE();
|
||||
final tripTime = reader.readUInt32LE();
|
||||
timeout?.cancel();
|
||||
timeout = Timer(Duration(milliseconds: tripTime), () => finish(null));
|
||||
} else if (cmd == respCodeErr && awaitingSent) {
|
||||
awaitingSent = false;
|
||||
finish(null);
|
||||
} else if (cmd == pushCodeBinaryResponse) {
|
||||
// Binary requests always answer here. A chat telemetry reply also
|
||||
// lands here, tagged, when another request replaced it as the
|
||||
// radio's pending request.
|
||||
reader.skipBytes(1); // reserved
|
||||
if (tag == null || reader.readUInt32LE() != tag) return;
|
||||
finish(CayenneLpp.parseByChannel(reader.readRemainingBytes()));
|
||||
} else if (cmd == pushCodeTelemetryResponse && isChat) {
|
||||
reader.skipBytes(1); // reserved
|
||||
final prefix = reader.readBytes(6);
|
||||
if (!listEquals(contact.publicKey.sublist(0, 6), prefix)) return;
|
||||
finish(CayenneLpp.parseByChannel(reader.readRemainingBytes()));
|
||||
}
|
||||
} catch (e) {
|
||||
appLogger.error('Error parsing telemetry location frame: $e');
|
||||
}
|
||||
});
|
||||
|
||||
PathSelection? selection;
|
||||
try {
|
||||
selection = await connector.preparePathForContactSend(contact);
|
||||
awaitingSent = true;
|
||||
// Guards the wait for the radio's send ack; its trip time replaces this.
|
||||
timeout = Timer(const Duration(seconds: 10), () => finish(null));
|
||||
await connector.sendFrame(
|
||||
isChat
|
||||
? buildSendTelemetryReq(contact.publicKey)
|
||||
: buildSendBinaryReq(
|
||||
contact.publicKey,
|
||||
payload: buildTelemetryBinaryPayload(),
|
||||
),
|
||||
);
|
||||
} catch (e) {
|
||||
appLogger.error('Telemetry location request failed: $e');
|
||||
finish(null);
|
||||
}
|
||||
|
||||
final parsed = await completer.future;
|
||||
await subscription.cancel();
|
||||
if (selection != null) {
|
||||
connector.recordRepeaterPathResult(
|
||||
contact,
|
||||
selection,
|
||||
parsed != null,
|
||||
null,
|
||||
);
|
||||
}
|
||||
if (parsed == null) return TelemetryLocationResult.failed;
|
||||
final fix = telemetryGpsFix(parsed);
|
||||
if (fix == null) return TelemetryLocationResult.noLocation;
|
||||
connector.updateContactLocationFromTelemetry(
|
||||
contact.publicKeyHex,
|
||||
fix.latitude,
|
||||
fix.longitude,
|
||||
);
|
||||
return TelemetryLocationResult.located;
|
||||
}
|
||||
@@ -65,7 +65,6 @@ class TimeoutPredictionService extends ChangeNotifier {
|
||||
required int pathLength,
|
||||
required int messageBytes,
|
||||
required int tripTimeMs,
|
||||
int secondsSinceLastRx = 0,
|
||||
}) {
|
||||
if (recordingSuspended) return;
|
||||
final isFlood = pathLength < 0;
|
||||
@@ -75,7 +74,6 @@ class TimeoutPredictionService extends ChangeNotifier {
|
||||
// only; isFlood carries the flood signal as a separate feature.
|
||||
pathLength: isFlood ? 0 : pathLength,
|
||||
messageBytes: messageBytes,
|
||||
secondsSinceLastRx: secondsSinceLastRx,
|
||||
isFlood: isFlood,
|
||||
deliveryMs: tripTimeMs,
|
||||
timestamp: DateTime.now(),
|
||||
@@ -110,7 +108,6 @@ class TimeoutPredictionService extends ChangeNotifier {
|
||||
String? contactKey,
|
||||
required int pathLength,
|
||||
required int messageBytes,
|
||||
int secondsSinceLastRx = 0,
|
||||
}) {
|
||||
if (_model == null) return null;
|
||||
|
||||
@@ -123,7 +120,6 @@ class TimeoutPredictionService extends ChangeNotifier {
|
||||
// prediction see the same pathLength values; isFlood carries the signal.
|
||||
'pathLength': flood ? 0.0 : pathLength.toDouble(),
|
||||
'messageBytes': messageBytes.toDouble(),
|
||||
'secSinceRx': secondsSinceLastRx.toDouble(),
|
||||
'isFlood': flood ? 1.0 : 0.0,
|
||||
};
|
||||
final row = _activeFeatures.map((f) => allFeatures[f]!).toList();
|
||||
@@ -174,13 +170,12 @@ class TimeoutPredictionService extends ChangeNotifier {
|
||||
try {
|
||||
// Build feature columns, then exclude any with zero variance
|
||||
// (ml_algo's OLS produces all-zero coefficients for singular matrices)
|
||||
final allNames = ['pathLength', 'messageBytes', 'secSinceRx', 'isFlood'];
|
||||
final allNames = ['pathLength', 'messageBytes', 'isFlood'];
|
||||
final allExtractors = <double Function(DeliveryObservation)>[
|
||||
// pathLength is already clamped to >=0 in recordObservation, but guard
|
||||
// here as well for any observations loaded from older persisted data.
|
||||
(o) => o.pathLength < 0 ? 0.0 : o.pathLength.toDouble(),
|
||||
(o) => o.messageBytes.toDouble(),
|
||||
(o) => o.secondsSinceLastRx.toDouble(),
|
||||
(o) => o.isFlood ? 1.0 : 0.0,
|
||||
];
|
||||
|
||||
|
||||
@@ -92,6 +92,7 @@ class ContactStore {
|
||||
'rawPacket': contact.rawPacket != null
|
||||
? base64Encode(contact.rawPacket!)
|
||||
: null,
|
||||
'telemetryFixAt': contact.telemetryFixAt?.millisecondsSinceEpoch,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -99,6 +100,7 @@ class ContactStore {
|
||||
final lastSeenMs = json['lastSeen'] as int? ?? 0;
|
||||
final lastMessageMs = json['lastMessageAt'] as int?;
|
||||
final lastModifiedMs = json['lastModified'] as int?;
|
||||
final telemetryFixMs = json['telemetryFixAt'] as int?;
|
||||
|
||||
final rawPathLength = json['pathLength'] as int? ?? -1;
|
||||
final rawPath = json['path'] != null
|
||||
@@ -157,6 +159,9 @@ class ContactStore {
|
||||
rawPacket: json['rawPacket'] != null
|
||||
? Uint8List.fromList(base64Decode(json['rawPacket'] as String))
|
||||
: null,
|
||||
telemetryFixAt: telemetryFixMs == null
|
||||
? null
|
||||
: DateTime.fromMillisecondsSinceEpoch(telemetryFixMs),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -36,28 +36,32 @@ void showChannelNotificationModeSheet(BuildContext context, String muteKey) {
|
||||
builder: (sheetContext) {
|
||||
final scheme = Theme.of(sheetContext).colorScheme;
|
||||
return SafeArea(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
for (final mode in ChannelNotificationMode.values)
|
||||
ListTile(
|
||||
leading: Icon(
|
||||
channelNotificationModeIcon(mode),
|
||||
color: mode == currentMode
|
||||
? scheme.primary
|
||||
: scheme.onSurfaceVariant,
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
for (final mode in ChannelNotificationMode.values)
|
||||
ListTile(
|
||||
leading: Icon(
|
||||
channelNotificationModeIcon(mode),
|
||||
color: mode == currentMode
|
||||
? scheme.primary
|
||||
: scheme.onSurfaceVariant,
|
||||
),
|
||||
title: Text(channelNotificationModeLabel(sheetContext, mode)),
|
||||
trailing: mode == currentMode
|
||||
? const Icon(Icons.check)
|
||||
: null,
|
||||
onTap: () async {
|
||||
Navigator.pop(sheetContext);
|
||||
await settingsService.setChannelNotificationMode(
|
||||
muteKey,
|
||||
mode,
|
||||
);
|
||||
},
|
||||
),
|
||||
title: Text(channelNotificationModeLabel(sheetContext, mode)),
|
||||
trailing: mode == currentMode ? const Icon(Icons.check) : null,
|
||||
onTap: () async {
|
||||
Navigator.pop(sheetContext);
|
||||
await settingsService.setChannelNotificationMode(
|
||||
muteKey,
|
||||
mode,
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
|
||||
@@ -41,12 +41,11 @@ IconData? contactTypeIcon(int type) {
|
||||
}
|
||||
|
||||
/// The most recent activity for [contact]: for chat nodes this includes the
|
||||
/// last message, for other node types only the last advert.
|
||||
/// last message, for other node types only the last advert or telemetry fix.
|
||||
DateTime resolveContactLastSeen(Contact contact) {
|
||||
if (contact.type != advTypeChat) return contact.lastSeen;
|
||||
return contact.lastMessageAt.isAfter(contact.lastSeen)
|
||||
? contact.lastMessageAt
|
||||
: contact.lastSeen;
|
||||
final heard = contact.lastHeard;
|
||||
if (contact.type != advTypeChat) return heard;
|
||||
return contact.lastMessageAt.isAfter(heard) ? contact.lastMessageAt : heard;
|
||||
}
|
||||
|
||||
/// Short relative "last seen" label ("now", "5 mins ago", "2 days ago").
|
||||
|
||||
@@ -55,56 +55,70 @@ class _EmptyStateState extends State<EmptyState>
|
||||
begin: const Offset(0, 0.06),
|
||||
end: Offset.zero,
|
||||
).animate(_curve),
|
||||
child: Center(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 40),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Container(
|
||||
width: 80,
|
||||
height: 80,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: scheme.primary.withValues(alpha: 0.08),
|
||||
border: Border.all(
|
||||
color: scheme.primary.withValues(alpha: 0.18),
|
||||
width: 1.5,
|
||||
),
|
||||
),
|
||||
child: Icon(
|
||||
widget.icon,
|
||||
size: 36,
|
||||
color: scheme.onSurfaceVariant,
|
||||
// Scrolls instead of overflowing when a short screen or a large text
|
||||
// scale makes the content taller than the space it gets.
|
||||
child: LayoutBuilder(
|
||||
builder: (context, constraints) => SingleChildScrollView(
|
||||
child: ConstrainedBox(
|
||||
constraints: BoxConstraints(
|
||||
minHeight: constraints.hasBoundedHeight
|
||||
? constraints.maxHeight
|
||||
: 0,
|
||||
),
|
||||
child: Center(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 40),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Container(
|
||||
width: 80,
|
||||
height: 80,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: scheme.primary.withValues(alpha: 0.08),
|
||||
border: Border.all(
|
||||
color: scheme.primary.withValues(alpha: 0.18),
|
||||
width: 1.5,
|
||||
),
|
||||
),
|
||||
child: Icon(
|
||||
widget.icon,
|
||||
size: 36,
|
||||
color: scheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
Text(
|
||||
widget.title,
|
||||
style: Theme.of(context).textTheme.titleMedium
|
||||
?.copyWith(
|
||||
fontWeight: FontWeight.w600,
|
||||
color: scheme.onSurface,
|
||||
letterSpacing: -0.1,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
if (widget.subtitle != null) ...[
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
widget.subtitle!,
|
||||
style: TextStyle(
|
||||
fontSize: 13.5,
|
||||
color: scheme.onSurfaceVariant,
|
||||
height: 1.45,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
],
|
||||
if (widget.action != null) ...[
|
||||
const SizedBox(height: 28),
|
||||
widget.action!,
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
Text(
|
||||
widget.title,
|
||||
style: Theme.of(context).textTheme.titleMedium?.copyWith(
|
||||
fontWeight: FontWeight.w600,
|
||||
color: scheme.onSurface,
|
||||
letterSpacing: -0.1,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
if (widget.subtitle != null) ...[
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
widget.subtitle!,
|
||||
style: TextStyle(
|
||||
fontSize: 13.5,
|
||||
color: scheme.onSurfaceVariant,
|
||||
height: 1.45,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
],
|
||||
if (widget.action != null) ...[
|
||||
const SizedBox(height: 28),
|
||||
widget.action!,
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import 'dart:math' as math;
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../l10n/app_localizations.dart';
|
||||
@@ -55,7 +57,8 @@ void showLanguagePickerSheet(
|
||||
children: [
|
||||
BottomSheetHeader(title: l10n.appSettings_language),
|
||||
SizedBox(
|
||||
height: 400,
|
||||
// Capped so the sheet still fits short screens and landscape.
|
||||
height: math.min(400, MediaQuery.sizeOf(ctx).height * 0.6),
|
||||
child: ListView(
|
||||
children: [
|
||||
for (final (code, label) in appLanguageOptions)
|
||||
|
||||
@@ -262,7 +262,7 @@ void showNodeInfoSheet(
|
||||
),
|
||||
NodeInfoRow(
|
||||
label: l10n.map_lastSeen,
|
||||
value: formatNodeLastSeen(l10n, contact.lastSeen),
|
||||
value: formatNodeLastSeen(l10n, contact.lastHeard),
|
||||
),
|
||||
NodeInfoRow(
|
||||
label: l10n.map_publicKey,
|
||||
|
||||
@@ -645,6 +645,7 @@ class _RadioSettingsDialogState extends State<RadioSettingsDialog> {
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
DropdownButtonFormField<LoRaBandwidth>(
|
||||
isExpanded: true,
|
||||
initialValue: _bandwidth,
|
||||
decoration: InputDecoration(
|
||||
labelText: l10n.settings_bandwidth,
|
||||
@@ -652,7 +653,10 @@ class _RadioSettingsDialogState extends State<RadioSettingsDialog> {
|
||||
),
|
||||
items: LoRaBandwidth.values
|
||||
.map(
|
||||
(bw) => DropdownMenuItem(value: bw, child: Text(bw.label)),
|
||||
(bw) => DropdownMenuItem(
|
||||
value: bw,
|
||||
child: Text(bw.label, overflow: TextOverflow.ellipsis),
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
onChanged: (value) {
|
||||
@@ -667,6 +671,7 @@ class _RadioSettingsDialogState extends State<RadioSettingsDialog> {
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
DropdownButtonFormField<LoRaSpreadingFactor>(
|
||||
isExpanded: true,
|
||||
initialValue: _spreadingFactor,
|
||||
decoration: InputDecoration(
|
||||
labelText: l10n.settings_spreadingFactor,
|
||||
@@ -674,7 +679,10 @@ class _RadioSettingsDialogState extends State<RadioSettingsDialog> {
|
||||
),
|
||||
items: LoRaSpreadingFactor.values
|
||||
.map(
|
||||
(sf) => DropdownMenuItem(value: sf, child: Text(sf.label)),
|
||||
(sf) => DropdownMenuItem(
|
||||
value: sf,
|
||||
child: Text(sf.label, overflow: TextOverflow.ellipsis),
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
onChanged: (value) {
|
||||
@@ -691,6 +699,7 @@ class _RadioSettingsDialogState extends State<RadioSettingsDialog> {
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
DropdownButtonFormField<LoRaCodingRate>(
|
||||
isExpanded: true,
|
||||
initialValue: _codingRate,
|
||||
decoration: InputDecoration(
|
||||
labelText: l10n.settings_codingRate,
|
||||
@@ -698,7 +707,10 @@ class _RadioSettingsDialogState extends State<RadioSettingsDialog> {
|
||||
),
|
||||
items: LoRaCodingRate.values
|
||||
.map(
|
||||
(cr) => DropdownMenuItem(value: cr, child: Text(cr.label)),
|
||||
(cr) => DropdownMenuItem(
|
||||
value: cr,
|
||||
child: Text(cr.label, overflow: TextOverflow.ellipsis),
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
onChanged: (value) {
|
||||
@@ -716,6 +728,7 @@ class _RadioSettingsDialogState extends State<RadioSettingsDialog> {
|
||||
// Values are path hash modes (0-2, byte width - 1), matching
|
||||
// the selectors in settings_screen and repeater_settings_screen.
|
||||
DropdownButtonFormField<int>(
|
||||
isExpanded: true,
|
||||
initialValue: (_pathHashByteWidth - 1).clamp(0, 2).toInt(),
|
||||
decoration: InputDecoration(
|
||||
labelText: l10n.repeater_pathHashMode,
|
||||
@@ -726,15 +739,24 @@ class _RadioSettingsDialogState extends State<RadioSettingsDialog> {
|
||||
items: [
|
||||
DropdownMenuItem(
|
||||
value: 0,
|
||||
child: Text(l10n.repeater_pathHashModeOption0),
|
||||
child: Text(
|
||||
l10n.repeater_pathHashModeOption0,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
DropdownMenuItem(
|
||||
value: 1,
|
||||
child: Text(l10n.repeater_pathHashModeOption1),
|
||||
child: Text(
|
||||
l10n.repeater_pathHashModeOption1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
DropdownMenuItem(
|
||||
value: 2,
|
||||
child: Text(l10n.repeater_pathHashModeOption2),
|
||||
child: Text(
|
||||
l10n.repeater_pathHashModeOption2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
],
|
||||
onChanged: (value) {
|
||||
|
||||
@@ -313,6 +313,7 @@ class _RoutingSheetBodyState extends State<_RoutingSheetBody> {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (dialogContext) => AlertDialog(
|
||||
scrollable: true,
|
||||
title: Text(l10n.chat_fullPath),
|
||||
content: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
|
||||
Reference in new issue
Block a user