improve network status indicator

This commit is contained in:
stopflock
2025-08-26 18:35:52 -05:00
parent a3edcfc2de
commit c1e25ec5b1
2 changed files with 11 additions and 14 deletions

View File

@@ -112,20 +112,12 @@ class NetworkStatus extends ChangeNotifier {
// Don't log routine waiting - only log if we stay waiting too long
}
// Set timeout to show appropriate status after reasonable time
// Set timeout for genuine network issues (not 404s)
_waitingTimer?.cancel();
_waitingTimer = Timer(const Duration(seconds: 10), () {
_waitingTimer = Timer(const Duration(seconds: 8), () {
_isWaitingForData = false;
// If in offline mode, this is "no data" not "timed out"
if (AppState.instance.offlineMode) {
_hasNoData = true;
debugPrint('[NetworkStatus] No offline data available (timeout in offline mode)');
} else {
_isTimedOut = true;
debugPrint('[NetworkStatus] Data request timed out (online mode)');
}
_isTimedOut = true;
debugPrint('[NetworkStatus] Request timed out - likely network issues');
notifyListeners();
});
}
@@ -143,6 +135,8 @@ class NetworkStatus extends ChangeNotifier {
// Quietly clear waiting status - don't log routine data arrival
}
}
/// Report that a tile was not available offline
void reportOfflineMiss() {

View File

@@ -71,8 +71,11 @@ class SimpleTileHttpClient extends http.BaseClient {
} catch (e) {
debugPrint('[SimpleTileService] Could not get tile $z/$x/$y: $e');
// Let MapDataProvider handle offline mode logic
// Just return 404 and let flutter_map handle it gracefully
// 404 means no tiles available - clear waiting status
// This is true whether we're online or offline
NetworkStatus.instance.clearWaiting();
// Return 404 and let flutter_map handle it gracefully
return http.StreamedResponse(
Stream.value(<int>[]),
404,