Add offline-first tile system with per-provider caching and error retry

- Add ServicePolicy framework with OSM-specific rate limiting and TTL
- Add per-provider disk tile cache (ProviderTileCacheStore) with O(1)
  lookup, oldest-modified eviction, and ETag/304 revalidation
- Rewrite DeflockTileProvider with two paths: common (NetworkTileProvider)
  and offline-first (disk cache -> local tiles -> network with caching)
- Add zoom-aware offline routing so tiles outside offline area zoom ranges
  use the efficient common path instead of the overhead-heavy offline path
- Fix HTTP client lifecycle: dispose() is now a no-op for flutter_map
  widget recycling; shutdown() handles permanent teardown
- Add TileLayerManager with exponential backoff retry (2s->60s cap),
  provider switch detection, and backoff reset
- Guard null provider/tileType in download dialog with localized error
- Fix Nominatim cache key to use normalized viewbox values
- Comprehensive test coverage (1800+ lines across 6 test files)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Doug Borg
2026-03-07 12:34:01 -07:00
co-authored by Claude Opus 4.6
parent be446fbcbc
commit 2d92214bed
36 changed files with 3940 additions and 351 deletions
+9 -3
View File
@@ -181,7 +181,10 @@
"offlineModeWarning": "Pobieranie wyłączone w trybie offline. Wyłącz tryb offline, aby pobierać nowe obszary.",
"areaTooBigMessage": "Przybliż do co najmniej poziomu {}, aby pobierać obszary offline. Duże pobieranie obszarów może sprawić, że aplikacja przestanie odpowiadać.",
"downloadStarted": "Pobieranie rozpoczęte! Pobieranie kafelków i węzłów...",
"downloadFailed": "Nie udało się rozpocząć pobierania: {}"
"downloadFailed": "Nie udało się rozpocząć pobierania: {}",
"offlineNotPermitted": "Serwer {} nie zezwala na pobieranie offline. Przełącz się na dostawcę kafelków, który obsługuje tryb offline (np. Bing Maps, Mapbox lub samodzielnie hostowany serwer kafelków).",
"currentTileProvider": "bieżący kafelek",
"noTileProviderSelected": "Nie wybrano dostawcy kafelków. Wybierz styl mapy przed pobraniem obszaru offline."
},
"downloadStarted": {
"title": "Pobieranie Rozpoczęte",
@@ -335,7 +338,10 @@
"mapTiles": {
"title": "Kafelki Mapy",
"manageProviders": "Zarządzaj Dostawcami",
"attribution": "Atrybucja Mapy"
"attribution": "Atrybucja Mapy",
"mapAttribution": "Źródło mapy: {}",
"couldNotOpenLink": "Nie udało się otworzyć linku",
"openLicense": "Otwórz licencję: {}"
},
"profileEditor": {
"viewProfile": "Zobacz Profil",
@@ -552,4 +558,4 @@
"metricDescription": "Metryczny (km, m)",
"imperialDescription": "Imperialny (mila, ft)"
}
}
}