Add switch to the gamemaster screen + small adjustment for the UI.
This commit is contained in:
		
							parent
							
								
									50ed975913
								
							
						
					
					
						commit
						edbb508f6a
					
				
					 6 changed files with 76 additions and 15 deletions
				
			
		| 
						 | 
				
			
			@ -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(
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue