mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-25 22:27:32 +00:00
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:
@@ -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) };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user