Add switch to the gamemaster screen + small adjustment for the UI.

This commit is contained in:
Andres Gomez, Thomas (ITDV RL) 2025-03-19 09:48:13 +01:00
parent 50ed975913
commit edbb508f6a
6 changed files with 76 additions and 15 deletions

View file

@ -9,6 +9,7 @@ import com.pixelized.desktop.lwa.repository.settings.SettingsRepository
import com.pixelized.shared.lwa.model.campaign.Campaign
import kotlinx.coroutines.coroutineScope
import kotlinx.coroutines.flow.combine
import kotlinx.coroutines.flow.distinctUntilChanged
import kotlinx.coroutines.flow.filter
import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.onEach
@ -36,17 +37,16 @@ class DataSyncViewModel(
networkRepository.status
.filter { status -> status == NetworkRepository.Status.CONNECTED }
.onEach { campaignRepository.campaign(update = true) }
.launchIn(this)
networkRepository.status
.filter { status -> status == NetworkRepository.Status.CONNECTED }
.onEach { characterRepository.updateCharacterPreviews() }
.onEach {
campaignRepository.campaign(update = true)
characterRepository.updateCharacterPreviews()
}
.launchIn(this)
networkRepository.status
.filter { status -> status == NetworkRepository.Status.CONNECTED }
.combine(campaignRepository.campaignFlow) { _, campaign: Campaign -> campaign }
.distinctUntilChanged()
.onEach { campaign ->
(campaign.characters.keys + campaign.npcs.keys).forEach { id ->
characterRepository.characterDetail(