fix: GL maps read the stored copy again while offline, and a switch that is on keeps a visible knob in the dark scheme

This commit is contained in:
Maurice
2026-11-08 12:21:52 +01:00
parent 06c03cbded
commit eea83bb1c9
6 changed files with 83 additions and 26 deletions
+17 -3
View File
@@ -1,3 +1,5 @@
import { isEffectivelyOffline } from '../sync/networkMode';
/**
* Whether the GL maps (the Leaflet map's vector basemap and Mapbox GL) read
* their style and tiles through the app's own URL schemes, trek-offline:// and
@@ -7,8 +9,20 @@
* Mapbox black) while the 3D map, the Mapbox preview in the settings and the
* raster maps, which do not go through those schemes for a GL map, drew
* normally. The same maps draw normally in a browser. Until that is traced on a
* device, the GL maps load straight from their servers in the app, as they do
* in a browser, and keep no offline copy; the raster maps (Topo, satellite, a
* raster template of the user's) keep going through the tile store.
* device, the GL maps load straight from their servers in the app while it is
* online, as they do in a browser; offline they read the stored copy as before
* (glMapsThroughAppSchemes). The raster maps (Topo, satellite, a raster
* template of the user's) keep going through the tile store throughout.
*/
export const GL_MAPS_THROUGH_APP_SCHEMES = false;
/**
* Whether a MapLibre basemap goes through trek-offline:// right now: always
* while the switch above is on, and otherwise while the app is offline (or set
* to be). Offline the stored copy is all there is to draw, so nothing is lost
* by trying it; online the map loads straight from its server. Mapbox does not
* follow: offline it gives way to the stored MapLibre basemap anyway.
*/
export function glMapsThroughAppSchemes(): boolean {
return GL_MAPS_THROUGH_APP_SCHEMES || isEffectivelyOffline();
}