Merge upstream/dev (8 commits) [upstream-sync]

This commit is contained in:
upstream-sync-bot committed 2026-10-25 18:41:24 +00:00
commit 65097d053d
76 files changed
+2533 -1050

No files matched your search

+65 -5
View File
@@ -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,
);