diff --git a/README.md b/README.md index df99396..31e25ea 100644 --- a/README.md +++ b/README.md @@ -79,7 +79,6 @@ cp lib/keys.dart.example lib/keys.dart ## Roadmap ### Current Development -- Network status indicator option in advanced - Help button with links to email, discord, and website - Move download button? - Clean cache when nodes have disappeared / been deleted by others diff --git a/lib/app_state.dart b/lib/app_state.dart index 059d1d1..bc5009c 100644 --- a/lib/app_state.dart +++ b/lib/app_state.dart @@ -82,6 +82,7 @@ class AppState extends ChangeNotifier { FollowMeMode get followMeMode => _settingsState.followMeMode; bool get proximityAlertsEnabled => _settingsState.proximityAlertsEnabled; int get proximityAlertDistance => _settingsState.proximityAlertDistance; + bool get networkStatusIndicatorEnabled => _settingsState.networkStatusIndicatorEnabled; // Tile provider state List get tileProviders => _settingsState.tileProviders; @@ -287,6 +288,11 @@ class AppState extends ChangeNotifier { await _settingsState.setProximityAlertDistance(distance); } + /// Set network status indicator enabled/disabled + Future setNetworkStatusIndicatorEnabled(bool enabled) async { + await _settingsState.setNetworkStatusIndicatorEnabled(enabled); + } + // ---------- Queue Methods ---------- void clearQueue() { _uploadQueueState.clearQueue(); diff --git a/lib/localizations/de.json b/lib/localizations/de.json index d733d47..b946259 100644 --- a/lib/localizations/de.json +++ b/lib/localizations/de.json @@ -45,7 +45,8 @@ "offlineSettingsSubtitle": "Offline-Modus und heruntergeladene Bereiche verwalten", "advancedSettings": "Erweiterte Einstellungen", "advancedSettingsSubtitle": "Leistungs-, Warnungs- und Kachelanbieter-Einstellungen", - "proximityAlerts": "Näherungswarnungen" + "proximityAlerts": "Näherungswarnungen", + "networkStatusIndicator": "Netzwerkstatus-Anzeige" }, "proximityAlerts": { "getNotified": "Benachrichtigung erhalten beim Annähern an Überwachungsgeräte", @@ -287,5 +288,9 @@ "cannotChangeTileTypes": "Kachel-Typen können während des Herunterladens von Offline-Bereichen nicht geändert werden", "selectMapLayer": "Kartenschicht Auswählen", "noTileProvidersAvailable": "Keine Kachel-Anbieter verfügbar" + }, + "networkStatus": { + "showIndicator": "Netzwerkstatus-Anzeige anzeigen", + "showIndicatorSubtitle": "Netzwerk-Ladestatus und Fehlerstatus auf der Karte anzeigen" } } \ No newline at end of file diff --git a/lib/localizations/en.json b/lib/localizations/en.json index b4ebf67..56e9d5c 100644 --- a/lib/localizations/en.json +++ b/lib/localizations/en.json @@ -45,7 +45,8 @@ "offlineSettingsSubtitle": "Manage offline mode and downloaded areas", "advancedSettings": "Advanced Settings", "advancedSettingsSubtitle": "Performance, alerts, and tile provider settings", - "proximityAlerts": "Proximity Alerts" + "proximityAlerts": "Proximity Alerts", + "networkStatusIndicator": "Network Status Indicator" }, "proximityAlerts": { "getNotified": "Get notified when approaching surveillance devices", @@ -287,5 +288,9 @@ "cannotChangeTileTypes": "Cannot change tile types while downloading offline areas", "selectMapLayer": "Select Map Layer", "noTileProvidersAvailable": "No tile providers available" + }, + "networkStatus": { + "showIndicator": "Show network status indicator", + "showIndicatorSubtitle": "Display network loading and error status on the map" } } \ No newline at end of file diff --git a/lib/localizations/es.json b/lib/localizations/es.json index db4f7a1..ad7b9be 100644 --- a/lib/localizations/es.json +++ b/lib/localizations/es.json @@ -45,7 +45,8 @@ "offlineSettingsSubtitle": "Gestionar modo sin conexión y áreas descargadas", "advancedSettings": "Configuración Avanzada", "advancedSettingsSubtitle": "Configuración de rendimiento, alertas y proveedores de teselas", - "proximityAlerts": "Alertas de Proximidad" + "proximityAlerts": "Alertas de Proximidad", + "networkStatusIndicator": "Indicador de Estado de Red" }, "proximityAlerts": { "getNotified": "Recibe notificaciones al acercarte a dispositivos de vigilancia", @@ -287,5 +288,9 @@ "cannotChangeTileTypes": "No se pueden cambiar los tipos de teselas mientras se descargan áreas sin conexión", "selectMapLayer": "Seleccionar Capa del Mapa", "noTileProvidersAvailable": "No hay proveedores de teselas disponibles" + }, + "networkStatus": { + "showIndicator": "Mostrar indicador de estado de red", + "showIndicatorSubtitle": "Mostrar estado de carga y errores de red en el mapa" } } \ No newline at end of file diff --git a/lib/localizations/fr.json b/lib/localizations/fr.json index a25873a..e219741 100644 --- a/lib/localizations/fr.json +++ b/lib/localizations/fr.json @@ -45,7 +45,8 @@ "offlineSettingsSubtitle": "Gérer le mode hors ligne et les zones téléchargées", "advancedSettings": "Paramètres Avancés", "advancedSettingsSubtitle": "Paramètres de performance, alertes et fournisseurs de tuiles", - "proximityAlerts": "Alertes de Proximité" + "proximityAlerts": "Alertes de Proximité", + "networkStatusIndicator": "Indicateur de Statut Réseau" }, "proximityAlerts": { "getNotified": "Recevoir des notifications en s'approchant de dispositifs de surveillance", @@ -287,5 +288,9 @@ "cannotChangeTileTypes": "Impossible de changer les types de tuiles pendant le téléchargement des zones hors ligne", "selectMapLayer": "Sélectionner la Couche de Carte", "noTileProvidersAvailable": "Aucun fournisseur de tuiles disponible" + }, + "networkStatus": { + "showIndicator": "Afficher l'indicateur de statut réseau", + "showIndicatorSubtitle": "Afficher l'état de chargement et d'erreur réseau sur la carte" } } \ No newline at end of file diff --git a/lib/localizations/it.json b/lib/localizations/it.json index f7c3cc4..97413c4 100644 --- a/lib/localizations/it.json +++ b/lib/localizations/it.json @@ -45,7 +45,8 @@ "offlineSettingsSubtitle": "Gestisci modalità offline e aree scaricate", "advancedSettings": "Impostazioni Avanzate", "advancedSettingsSubtitle": "Impostazioni di prestazioni, avvisi e fornitori di tessere", - "proximityAlerts": "Avvisi di Prossimità" + "proximityAlerts": "Avvisi di Prossimità", + "networkStatusIndicator": "Indicatore di Stato di Rete" }, "proximityAlerts": { "getNotified": "Ricevi notifiche quando ti avvicini a dispositivi di sorveglianza", @@ -287,5 +288,9 @@ "cannotChangeTileTypes": "Impossibile cambiare tipi di tile durante il download di aree offline", "selectMapLayer": "Seleziona Livello Mappa", "noTileProvidersAvailable": "Nessun fornitore di tile disponibile" + }, + "networkStatus": { + "showIndicator": "Mostra indicatore di stato di rete", + "showIndicatorSubtitle": "Visualizza lo stato di caricamento e errori di rete sulla mappa" } } \ No newline at end of file diff --git a/lib/localizations/pt.json b/lib/localizations/pt.json index 0243f61..943d280 100644 --- a/lib/localizations/pt.json +++ b/lib/localizations/pt.json @@ -45,7 +45,8 @@ "offlineSettingsSubtitle": "Gerenciar modo offline e áreas baixadas", "advancedSettings": "Configurações Avançadas", "advancedSettingsSubtitle": "Configurações de desempenho, alertas e provedores de mapas", - "proximityAlerts": "Alertas de Proximidade" + "proximityAlerts": "Alertas de Proximidade", + "networkStatusIndicator": "Indicador de Status de Rede" }, "proximityAlerts": { "getNotified": "Receba notificações ao se aproximar de dispositivos de vigilância", @@ -287,5 +288,9 @@ "cannotChangeTileTypes": "Não é possível alterar tipos de tiles durante o download de áreas offline", "selectMapLayer": "Selecionar Camada do Mapa", "noTileProvidersAvailable": "Nenhum provedor de tiles disponível" + }, + "networkStatus": { + "showIndicator": "Exibir indicador de status de rede", + "showIndicatorSubtitle": "Mostrar status de carregamento e erro de rede no mapa" } } \ No newline at end of file diff --git a/lib/localizations/zh.json b/lib/localizations/zh.json index eac44f4..bd19cc8 100644 --- a/lib/localizations/zh.json +++ b/lib/localizations/zh.json @@ -45,7 +45,8 @@ "offlineSettingsSubtitle": "管理离线模式和已下载区域", "advancedSettings": "高级设置", "advancedSettingsSubtitle": "性能、警报和地图提供商设置", - "proximityAlerts": "邻近警报" + "proximityAlerts": "邻近警报", + "networkStatusIndicator": "网络状态指示器" }, "proximityAlerts": { "getNotified": "接近监控设备时接收通知", @@ -287,5 +288,9 @@ "cannotChangeTileTypes": "在下载离线区域时无法更改瓦片类型", "selectMapLayer": "选择地图图层", "noTileProvidersAvailable": "无可用瓦片提供商" + }, + "networkStatus": { + "showIndicator": "显示网络状态指示器", + "showIndicatorSubtitle": "在地图上显示网络加载和错误状态" } } \ No newline at end of file diff --git a/lib/screens/advanced_settings_screen.dart b/lib/screens/advanced_settings_screen.dart index 188e2dd..acad603 100644 --- a/lib/screens/advanced_settings_screen.dart +++ b/lib/screens/advanced_settings_screen.dart @@ -2,6 +2,7 @@ import 'package:flutter/material.dart'; import 'settings/sections/max_nodes_section.dart'; import 'settings/sections/proximity_alerts_section.dart'; import 'settings/sections/tile_provider_section.dart'; +import 'settings/sections/network_status_section.dart'; import '../services/localization_service.dart'; class AdvancedSettingsScreen extends StatelessWidget { @@ -24,6 +25,8 @@ class AdvancedSettingsScreen extends StatelessWidget { Divider(), ProximityAlertsSection(), Divider(), + NetworkStatusSection(), + Divider(), TileProviderSection(), ], ), diff --git a/lib/screens/settings/sections/network_status_section.dart b/lib/screens/settings/sections/network_status_section.dart new file mode 100644 index 0000000..1c1dbe7 --- /dev/null +++ b/lib/screens/settings/sections/network_status_section.dart @@ -0,0 +1,42 @@ +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; + +import '../../../app_state.dart'; +import '../../../services/localization_service.dart'; + +/// Settings section for network status indicator configuration +/// Follows brutalist principles: simple, explicit UI that matches existing patterns +class NetworkStatusSection extends StatelessWidget { + const NetworkStatusSection({super.key}); + + @override + Widget build(BuildContext context) { + return Consumer( + builder: (context, appState, child) { + final locService = LocalizationService.instance; + + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + locService.t('settings.networkStatusIndicator'), + style: Theme.of(context).textTheme.titleMedium, + ), + const SizedBox(height: 8), + + // Enable/disable toggle + SwitchListTile( + title: Text(locService.t('networkStatus.showIndicator')), + subtitle: Text(locService.t('networkStatus.showIndicatorSubtitle')), + value: appState.networkStatusIndicatorEnabled, + onChanged: (enabled) { + appState.setNetworkStatusIndicatorEnabled(enabled); + }, + contentPadding: EdgeInsets.zero, + ), + ], + ); + }, + ); + } +} \ No newline at end of file diff --git a/lib/state/settings_state.dart b/lib/state/settings_state.dart index dea3475..835de1f 100644 --- a/lib/state/settings_state.dart +++ b/lib/state/settings_state.dart @@ -26,6 +26,7 @@ class SettingsState extends ChangeNotifier { static const String _followMeModePrefsKey = 'follow_me_mode'; static const String _proximityAlertsEnabledPrefsKey = 'proximity_alerts_enabled'; static const String _proximityAlertDistancePrefsKey = 'proximity_alert_distance'; + static const String _networkStatusIndicatorEnabledPrefsKey = 'network_status_indicator_enabled'; bool _offlineMode = false; int _maxCameras = 250; @@ -33,6 +34,7 @@ class SettingsState extends ChangeNotifier { FollowMeMode _followMeMode = FollowMeMode.northUp; bool _proximityAlertsEnabled = false; int _proximityAlertDistance = kProximityAlertDefaultDistance; + bool _networkStatusIndicatorEnabled = false; List _tileProviders = []; String _selectedTileTypeId = ''; @@ -43,6 +45,7 @@ class SettingsState extends ChangeNotifier { FollowMeMode get followMeMode => _followMeMode; bool get proximityAlertsEnabled => _proximityAlertsEnabled; int get proximityAlertDistance => _proximityAlertDistance; + bool get networkStatusIndicatorEnabled => _networkStatusIndicatorEnabled; List get tileProviders => List.unmodifiable(_tileProviders); String get selectedTileTypeId => _selectedTileTypeId; @@ -95,6 +98,9 @@ class SettingsState extends ChangeNotifier { _proximityAlertsEnabled = prefs.getBool(_proximityAlertsEnabledPrefsKey) ?? false; _proximityAlertDistance = prefs.getInt(_proximityAlertDistancePrefsKey) ?? kProximityAlertDefaultDistance; + // Load network status indicator setting + _networkStatusIndicatorEnabled = prefs.getBool(_networkStatusIndicatorEnabledPrefsKey) ?? false; + // Load upload mode (including migration from old test_mode bool) if (prefs.containsKey(_uploadModePrefsKey)) { final idx = prefs.getInt(_uploadModePrefsKey) ?? 0; @@ -285,4 +291,14 @@ class SettingsState extends ChangeNotifier { } } + /// Set network status indicator enabled/disabled + Future setNetworkStatusIndicatorEnabled(bool enabled) async { + if (_networkStatusIndicatorEnabled != enabled) { + _networkStatusIndicatorEnabled = enabled; + final prefs = await SharedPreferences.getInstance(); + await prefs.setBool(_networkStatusIndicatorEnabledPrefsKey, enabled); + notifyListeners(); + } + } + } \ No newline at end of file diff --git a/lib/widgets/map_view.dart b/lib/widgets/map_view.dart index 265568e..605a6fb 100644 --- a/lib/widgets/map_view.dart +++ b/lib/widgets/map_view.dart @@ -470,8 +470,9 @@ class MapViewState extends State { attribution: appState.selectedTileType?.attribution, ), - // Network status indicator (top-left) - const NetworkStatusIndicator(), + // Network status indicator (top-left) - conditionally shown + if (appState.networkStatusIndicatorEnabled) + const NetworkStatusIndicator(), // Proximity alert banner (top) ProximityAlertBanner(