The most complete open-source travel planner: real-time collaboration, bookings, budgets, packing lists, journals, offline PWA, SSO and an AI-ready MCP server, with planet-wide place search and routing built in.
TypeScript budget-trackercollaborativedockeritinerarymcp-serveroffline-firstopen-sourceopenstreetmappacking-listpwareal-timeself-hostedselfhostedtraveltravel-apptravel-journaltravel-plannertripitwanderlog
fix(native): GL maps load straight from their servers in the app, past the schemes they drew nothing through on iPadOS 26
Maurice53c18b861a95
diff --git a/client/src/components/Map/MapViewAuto.offline.test.tsx b/client/src/components/Map/MapViewAuto.offline.test.tsxindex fd0ec3773..198f731b3 100644--- a/client/src/components/Map/MapViewAuto.offline.test.tsx+++ b/client/src/components/Map/MapViewAuto.offline.test.tsx@@ -40,7 +40,10 @@ vi.mock('../../hooks/useNetworkMode', () => ({useNetworkMode: () => ({ offline: env.offline, forced: false, setForced: () => {} }),}));vi.mock('../../hooks/useIsDark', () => ({ useIsDark: () => env.dark }));-vi.mock('../../native/tileCache', () => ({ tileCacheActive: () => env.tileStore }));+vi.mock('../../native/tileCache', () => ({+ tileCacheActive: () => env.tileStore,+ glTileStoreActive: () => env.tileStore,+}));vi.mock('../../native/platform', async (importOriginal) => ({...(await importOriginal<typeof import('../../native/platform')>()),isNativeIos: () => false,diff --git a/client/src/components/Map/MapViewAuto.tsx b/client/src/components/Map/MapViewAuto.tsxindex b6e0d5e0a..0a97124d7 100644--- a/client/src/components/Map/MapViewAuto.tsx+++ b/client/src/components/Map/MapViewAuto.tsx@@ -13,7 +13,7 @@ import { useNetworkMode } from '../../hooks/useNetworkMode'import { useIsDark } from '../../hooks/useIsDark'import { OFM_POSITRON } from '../../constants/mapDefaults'import { glWorksOffline, leafletWorksOffline, offlineStyleFor } from './offlineBasemap'-import { tileCacheActive } from '../../native/tileCache'+import { glTileStoreActive, tileCacheActive } from '../../native/tileCache'// Auto-selects the map renderer based on user settings. Keeps the existing// Leaflet MapView untouched so the Mapbox GL variant can mature iteratively@@ -50,7 +50,7 @@ export function MapViewAuto(props: MapViewAutoProps) {// nothing stored is swapped for the stored one straight away.const nativeStore = tileCacheActive()const [preferStored, setPreferStored] = useState(false)- const mapboxKept = configuredGl === 'mapbox-gl' && nativeStore+ const mapboxKept = configuredGl === 'mapbox-gl' && glTileStoreActive()const glFallback = !!configuredGl && offline && !glWorksOffline(configuredGl, maplibreStyle) && (!mapboxKept || preferStored)const glProvider = glFallback ? 'maplibre-gl' : configuredGlconst leafletFallback = !configuredGl && offline && !leafletWorksOffline(mapProps.tileUrl ?? OFM_POSITRON, nativeIosWithoutStore(nativeStore))diff --git a/client/src/native/glSchemes.test.ts b/client/src/native/glSchemes.test.tsnew file mode 100644index 000000000..5c7f3052a--- /dev/null+++ b/client/src/native/glSchemes.test.ts@@ -0,0 +1,29 @@+import { describe, expect, it, vi } from 'vitest';+import { hasNativeFeature } from './capabilities';+import { GL_MAPS_THROUGH_APP_SCHEMES } from './glSchemes';+import { installOfflineProtocol, offlineStyle } from './offlineTiles';+import { isNativeApp, isNativeIos } from './platform';+import { glTileStoreActive, mapboxTileCacheRequest, tileCacheActive } from './tileCache';++vi.mock('./platform', () => ({ isNativeIos: vi.fn(() => true), isNativeApp: vi.fn(() => true) }));+vi.mock('./capabilities', () => ({ hasNativeFeature: vi.fn(() => true) }));++describe('GL maps and the app schemes', () => {+ it('FE-NATIVE-GLSCHEME-001: in the iOS app the GL maps load straight from their servers, the raster store stays', () => {+ expect(vi.mocked(isNativeIos)()).toBe(true);+ expect(vi.mocked(isNativeApp)()).toBe(true);+ expect(vi.mocked(hasNativeFeature)('tileCache')).toBe(true);+ expect(GL_MAPS_THROUGH_APP_SCHEMES).toBe(false);++ const style = 'https://tiles.openfreemap.org/styles/positron';+ expect(offlineStyle(style)).toBe(style);+ const addProtocol = vi.fn();+ installOfflineProtocol({ addProtocol });+ expect(addProtocol).not.toHaveBeenCalled();++ const tile = 'https://api.mapbox.com/v4/mapbox.mapbox-streets-v8/1/1/1.vector.pbf';+ expect(mapboxTileCacheRequest(tile, 'Tile')).toEqual({ url: tile });+ expect(glTileStoreActive()).toBe(false);+ expect(tileCacheActive()).toBe(true);+ });+});diff --git a/client/src/native/glSchemes.ts b/client/src/native/glSchemes.tsnew file mode 100644index 000000000..dce741fc7--- /dev/null+++ b/client/src/native/glSchemes.ts@@ -0,0 +1,14 @@+/**+ * 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+ * trek-tile://, for the offline copy.+ *+ * Off: on iPadOS 26 both drew nothing in the app (the vector basemap white,+ * 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.+ */+export const GL_MAPS_THROUGH_APP_SCHEMES = false;diff --git a/client/src/native/offlineTiles.test.ts b/client/src/native/offlineTiles.test.tsindex 741f6654a..b25597489 100644--- a/client/src/native/offlineTiles.test.ts+++ b/client/src/native/offlineTiles.test.ts@@ -10,6 +10,8 @@ import {import { isNativeIos } from './platform';vi.mock('./platform', () => ({ isNativeIos: vi.fn() }));+// The mechanism is what is tested here; whether the GL maps use it is glSchemes.ts's switch.+vi.mock('./glSchemes', () => ({ GL_MAPS_THROUGH_APP_SCHEMES: true }));const cached = new Map<string, Response>();const cache = { match: vi.fn(async (url: string) => cached.get(url)?.clone()) };diff --git a/client/src/native/offlineTiles.ts b/client/src/native/offlineTiles.tsindex f0aae2059..8b5651d65 100644--- a/client/src/native/offlineTiles.ts+++ b/client/src/native/offlineTiles.ts@@ -1,5 +1,6 @@import type { AddProtocolAction, GetResourceResponse, RequestParameters } from 'maplibre-gl';import { VECTOR_CACHE } from '../sync/glPrefetcher';+import { GL_MAPS_THROUGH_APP_SCHEMES } from './glSchemes';import { isNativeIos } from './platform';/**@@ -20,7 +21,7 @@ const OFFLINE_SCHEME = 'trek-offline';const PREFIX = `${OFFLINE_SCHEME}://`;function offlineTilesActive(): boolean {- return isNativeIos() && typeof caches !== 'undefined';+ return GL_MAPS_THROUGH_APP_SCHEMES && isNativeIos() && typeof caches !== 'undefined';}export function toOfflineUrl(url: string): string {diff --git a/client/src/native/tileCache.test.ts b/client/src/native/tileCache.test.tsindex ce55157d1..432fb0fbb 100644--- a/client/src/native/tileCache.test.ts+++ b/client/src/native/tileCache.test.ts@@ -5,6 +5,8 @@ import { mapboxTileCacheRequest, nativeRasterTemplate, tileCacheActive, toTileCavi.mock('./platform', () => ({ isNativeIos: vi.fn(), isNativeApp: vi.fn() }));vi.mock('./capabilities', () => ({ hasNativeFeature: vi.fn() }));+// The mechanism is what is tested here; whether the GL maps use it is glSchemes.ts's switch.+vi.mock('./glSchemes', () => ({ GL_MAPS_THROUGH_APP_SCHEMES: true }));beforeEach(() => {vi.mocked(isNativeIos).mockReturnValue(true);diff --git a/client/src/native/tileCache.ts b/client/src/native/tileCache.tsindex f08624d5a..879b3a64a 100644--- a/client/src/native/tileCache.ts+++ b/client/src/native/tileCache.ts@@ -1,4 +1,5 @@import { hasNativeFeature } from './capabilities';+import { GL_MAPS_THROUGH_APP_SCHEMES } from './glSchemes';import { isNativeApp, isNativeIos } from './platform';/**@@ -27,6 +28,11 @@ export function tileCacheActive(): boolean {return isNativeApp() && hasNativeFeature('tileCache');}+/** Whether a GL map keeps what it showed in the store (see glSchemes.ts for why not, for now). */+export function glTileStoreActive(): boolean {+ return GL_MAPS_THROUGH_APP_SCHEMES && tileSchemeActive();+}+/** Whether URLs go through the trek-tile:// scheme: the iOS store only. */function tileSchemeActive(): boolean {return isNativeIos() && hasNativeFeature('tileCache');@@ -61,7 +67,7 @@ const CACHED_RESOURCES = new Set([* Mapbox's servers go through the store, events and sessions never do.*/export function mapboxTileCacheRequest(url: string, resourceType?: string): { url: string } {- if (!tileSchemeActive() || !MAPBOX_HOST.test(url)) return { url };+ if (!glTileStoreActive() || !MAPBOX_HOST.test(url)) return { url };if (resourceType && !CACHED_RESOURCES.has(resourceType)) return { url };return { url: toTileCacheUrl(url) };}