fix(native): GL maps load straight from their servers in the app, past the schemes they drew nothing through on iPadOS 26

This commit is contained in:
Maurice
2026-11-08 12:11:23 +01:00
parent 9b1bf89382
commit 53c18b861a
8 changed files with 62 additions and 5 deletions
+7 -1
View File
@@ -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) };
}