Expose per-setting SettingsService getters/setters and wire map offline visibility to GraphQL.

This moves offline filtering to the API query path so map data respects settings at source instead of client-side post-filtering.

Made-with: Cursor
This commit is contained in:
2026-03-01 00:28:43 +01:00
parent 920a832424
commit c155a3cc2e
7 changed files with 60 additions and 12 deletions

View File

@@ -23,10 +23,12 @@ import org.db3.airmq.features.map.MapScreenContract.State
import org.db3.airmq.features.map.MapScreenContract.TimeRange
import org.db3.airmq.sdk.map.MapService
import org.db3.airmq.sdk.map.domain.MapItem
import org.db3.airmq.sdk.settings.SettingsService
@HiltViewModel
class MapViewModel @Inject constructor(
private val mapService: MapService
private val mapService: MapService,
private val settingsService: SettingsService
) : ViewModel() {
private val _uiState = MutableStateFlow(State(isLoading = true))
@@ -141,7 +143,10 @@ class MapViewModel @Inject constructor(
private fun refreshMapItems() {
_uiState.value = _uiState.value.copy(isLoading = true)
viewModelScope.launch(Dispatchers.IO) {
val result = runCatching { mapService.fetchMapItems() }
val result = runCatching {
val showOfflineDevices = settingsService.getOfflineDevicesVisible()
mapService.fetchMapItems(showOfflineDevices = showOfflineDevices)
}
_uiState.value = result.fold(
onSuccess = { items ->
domainItems = items