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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user