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

This commit is contained in:
upstream-sync-bot committed 2026-11-04 04:51:26 +00:00
commit 596e7f9dcd
44 files changed
+1444 -38

No files matched your search

+9
View File
@@ -1135,6 +1135,15 @@ class AppSettingsScreen extends StatelessWidget {
onChanged: (value) => settingsService.setMapShowOtherNodes(value),
),
const Divider(height: 1, indent: 16),
SwitchListTile(
contentPadding: tilePadding,
secondary: const Icon(Icons.polyline_outlined, size: 24),
title: Text(context.l10n.appSettings_showOnlineLinks),
subtitle: Text(context.l10n.appSettings_showOnlineLinksSubtitle),
value: settings.mapShowOnlineLinks,
onChanged: (value) => settingsService.setMapShowOnlineLinks(value),
),
const Divider(height: 1, indent: 16),
MeshNavTile(
icon: Icons.timer_outlined,
title: context.l10n.appSettings_timeFilter,
+62 -1
View File
@@ -250,7 +250,13 @@ class _MapScreenState extends State<MapScreen> with DisconnectNavigationMixin {
void _requestOnlineData() {
try {
_online.requestBounds(_mapController.camera.visibleBounds);
_online.requestBounds(
_mapController.camera.visibleBounds,
fetchLinks: context
.read<AppSettingsService>()
.settings
.mapShowOnlineLinks,
);
} catch (_) {
// Camera not ready yet; onMapReady requests once it is.
}
@@ -727,6 +733,11 @@ class _MapScreenState extends State<MapScreen> with DisconnectNavigationMixin {
contactsWithLocation,
settings,
);
final visibleOnlineRepeaters = _filterOnlineRepeatersBySettings(
_online.repeaters,
settings,
showGuessedLocations: settings.mapShowGuessedLocations,
);
Contact? selectedContact;
if (_selectedKey != null) {
for (final c in allContacts) {
@@ -950,6 +961,8 @@ class _MapScreenState extends State<MapScreen> with DisconnectNavigationMixin {
if (showOnline)
...buildNetworkMapOnlineLayers(
controller: _online,
repeaters: visibleOnlineRepeaters,
showLinks: settings.mapShowOnlineLinks,
localMarkerKeys: showLocal
? {for (final c in visibleContacts) c.publicKeyHex}
: const {},
@@ -1438,6 +1451,43 @@ class _MapScreenState extends State<MapScreen> with DisconnectNavigationMixin {
return filtered;
}
List<NetworkMapRepeater> _filterOnlineRepeatersBySettings(
List<NetworkMapRepeater> repeaters,
dynamic settings, {
required bool showGuessedLocations,
}) {
final keyPrefix = settings.mapKeyPrefix.trim().toLowerCase();
final now = DateTime.now();
return repeaters.where((repeater) {
if (repeater.isEstimated && !showGuessedLocations) return false;
final typeVisible = switch (repeater.type) {
advTypeRepeater => settings.mapShowRepeaters,
advTypeChat => settings.mapShowChatNodes,
_ => settings.mapShowOtherNodes,
};
if (!typeVisible) return false;
final freshnessVisible = switch (_freshness) {
_Freshness.all => true,
_Freshness.online => repeater.status == NetworkMapRepeaterStatus.active,
_Freshness.recent => repeater.status != NetworkMapRepeaterStatus.stale,
_Freshness.stale => repeater.status == NetworkMapRepeaterStatus.stale,
};
if (!freshnessVisible) return false;
if (settings.mapTimeFilterHours > 0 && repeater.lastSeen != null) {
final age = now.difference(repeater.lastSeen!).inHours;
if (age > settings.mapTimeFilterHours) return false;
}
return !settings.mapKeyPrefixEnabled ||
keyPrefix.isEmpty ||
repeater.key.toLowerCase().startsWith(keyPrefix);
}).toList();
}
List<Marker> _buildNodeMarkers(
List<Contact> contacts,
settings, {
@@ -2129,6 +2179,7 @@ class _MapScreenState extends State<MapScreen> with DisconnectNavigationMixin {
!settings.mapShowChatNodes,
!settings.mapShowRepeaters,
!settings.mapShowOtherNodes,
!settings.mapShowOnlineLinks,
settings.mapKeyPrefixEnabled,
].where((active) => active).length;
@@ -3577,6 +3628,8 @@ class _MapScreenState extends State<MapScreen> with DisconnectNavigationMixin {
BuildContext context,
AppSettingsService settingsService,
) {
final showOnlineFilters =
context.read<UiViewStateService>().mapSource != MapSourceOption.local;
showMeshSheet(
context,
builder: (sheetContext) => StatefulBuilder(
@@ -3707,6 +3760,14 @@ class _MapScreenState extends State<MapScreen> with DisconnectNavigationMixin {
onChanged: (value) =>
service.setMapShowOtherNodes(value),
),
if (showOnlineFilters)
SwitchListTile(
title: Text(sheetContext.l10n.map_showOnlineLinks),
value: settings.mapShowOnlineLinks,
dense: true,
onChanged: (value) =>
service.setMapShowOnlineLinks(value),
),
SectionHeader(sheetContext.l10n.map_markers),
SwitchListTile(
title: Text(sheetContext.l10n.map_showSharedMarkers),