mirror of
https://github.com/FoggedLens/deflock-app.git
synced 2026-02-12 16:52:51 +00:00
Clean up nav state when offline mode is enabled
This commit is contained in:
@@ -175,7 +175,22 @@ class AppState extends ChangeNotifier {
|
||||
bool get suspectedLocationsLoading => _suspectedLocationState.isLoading;
|
||||
DateTime? get suspectedLocationsLastFetch => _suspectedLocationState.lastFetchTime;
|
||||
|
||||
// Track previous offline mode to detect changes
|
||||
bool? _previousOfflineMode;
|
||||
|
||||
void _onStateChanged() {
|
||||
// Check if offline mode changed
|
||||
final currentOfflineMode = _settingsState.offlineMode;
|
||||
if (_previousOfflineMode != null && _previousOfflineMode != currentOfflineMode) {
|
||||
// Offline mode changed
|
||||
if (currentOfflineMode) {
|
||||
// Went offline - cancel any active navigation/search
|
||||
debugPrint('[AppState] Went offline - canceling navigation');
|
||||
_navigationState.cancelNavigation();
|
||||
}
|
||||
}
|
||||
_previousOfflineMode = currentOfflineMode;
|
||||
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
@@ -184,6 +199,9 @@ class AppState extends ChangeNotifier {
|
||||
// Initialize all state modules
|
||||
await _settingsState.init();
|
||||
|
||||
// Initialize offline mode tracking
|
||||
_previousOfflineMode = _settingsState.offlineMode;
|
||||
|
||||
// Initialize changelog service
|
||||
await ChangelogService().init();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user