MPMapboxStyleSource

sealed class MPMapboxStyleSource

Which Mapbox style MPMapboxBaseMapCacheProvider caches base-map tiles for.

There is deliberately no default. Both alternatives were considered and rejected for concrete reasons:

  • Falling back to the MapsIndoors style silently is dangerous. If the live map renders a different style — useMapsIndoorsStyle == false, or the app swapped styles — the cache would build tiles and a style pack for the wrong style. Tiles download, storage fills, and the live map never benefits. It only surfaces later, offline, when it is hardest to debug.

  • Requiring a raw style URI string doesn't work either, because the MapsIndoors URI is a private implementation detail. A caller has no way to know what to pass for "just use the standard style".

So the caller always makes an explicit choice, and the MapsIndoors URI is never exposed as a string.

The provider cannot work this out for itself: useMapsIndoorsStyle is a bare constructor parameter on the live map provider, captured by its initialiser and unreadable afterwards, and the cache is by design constructible with no map in existence.

Inheritors

Types

Link copied to clipboard
data class Custom(val styleUri: String) : MPMapboxStyleSource

A style the host app loads itself.

Link copied to clipboard

The MapsIndoors standard style — the same one MPMapConfig.Builder(useMapsIndoorsStyle = true) loads.