MapPrefs

interface MapPrefs(source)

Reactive interface for general map preferences.

Properties

Link copied to clipboard
abstract val hiddenLayerUrls: StateFlow<Set<String>>

URIs of imported map layers the user has toggled off; a layer is visible unless its URI is in this set.

Link copied to clipboard
abstract val layerOpacity: StateFlow<Set<String>>

Per-layer opacity, each entry encoded as key|:|opacity. A layer absent from the set is fully opaque.

Link copied to clipboard
abstract val mapFilters: StateFlow<MapFilterPrefs>

Every map filter, as one value — the same shape, and for the same reason, as UiPrefs.nodeFilters. The map keeps its own copy of the node-list vocabulary: filtering the map to routers is not a statement about the contact list.

Link copied to clipboard
abstract val mapStyle: StateFlow<Int>
Link copied to clipboard
abstract val networkMapLayers: StateFlow<Set<String>>

Persisted network (URL-backed) map layers, each encoded as id|:|name|:|uri.

Functions

Link copied to clipboard
abstract suspend fun awaitCameraPosition(): MapCameraPosition?

Load the complete persisted camera, or null before the map has ever been positioned.

Link copied to clipboard
abstract suspend fun awaitHiddenLayerUrls(): Set<String>

Persisted hiddenLayerUrls; suspends for the first disk load to avoid a cold-start empty default.

Link copied to clipboard
abstract suspend fun awaitMapStyle(): Int

Persisted mapStyle; suspends for the first disk load to avoid a cold-start default.

Link copied to clipboard
abstract suspend fun awaitNetworkMapLayers(): Set<String>

Persisted networkMapLayers; suspends for the first disk load to avoid a cold-start empty default.

Link copied to clipboard
abstract fun setCameraPosition(position: MapCameraPosition)

Persist the F-Droid map camera as one atomic preference update.

Link copied to clipboard
abstract fun setMapStyle(style: Int)
Link copied to clipboard
abstract fun updateHiddenLayerUrls(transform: (Set<String>) -> Set<String>)

Atomically mutate hiddenLayerUrls; transform runs against the persisted value, avoiding lost updates.

Link copied to clipboard
abstract fun updateLayerOpacity(transform: (Set<String>) -> Set<String>)

Atomically mutate layerOpacity; transform runs against the persisted value, avoiding lost updates.

Link copied to clipboard
abstract fun updateMapFilters(transform: (MapFilterPrefs) -> MapFilterPrefs)

Applies transform to the stored filters. Read-modify-write happens inside the store's own transaction.

Link copied to clipboard
abstract fun updateNetworkMapLayers(transform: (Set<String>) -> Set<String>)

Atomically mutate networkMapLayers; transform runs against the persisted value, avoiding lost updates.