fetch configutation on startup
This commit is contained in:
		
							parent
							
								
									cf97565dec
								
							
						
					
					
						commit
						79dcede47b
					
				
					 1 changed files with 6 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -2,6 +2,7 @@ package be.ugent.sel.studeez.screens.splash
 | 
			
		|||
 | 
			
		||||
import androidx.compose.runtime.mutableStateOf
 | 
			
		||||
import be.ugent.sel.studeez.domain.AccountDAO
 | 
			
		||||
import be.ugent.sel.studeez.domain.ConfigurationService
 | 
			
		||||
import be.ugent.sel.studeez.domain.LogService
 | 
			
		||||
import be.ugent.sel.studeez.navigation.StudeezDestinations
 | 
			
		||||
import be.ugent.sel.studeez.screens.StudeezViewModel
 | 
			
		||||
| 
						 | 
				
			
			@ -11,10 +12,15 @@ import javax.inject.Inject
 | 
			
		|||
@HiltViewModel
 | 
			
		||||
class SplashViewModel @Inject constructor(
 | 
			
		||||
    private val accountDAO: AccountDAO,
 | 
			
		||||
    private val configurationService: ConfigurationService,
 | 
			
		||||
    logService: LogService
 | 
			
		||||
) : StudeezViewModel(logService) {
 | 
			
		||||
    val showError = mutableStateOf(false)
 | 
			
		||||
 | 
			
		||||
    init {
 | 
			
		||||
        launchCatching { configurationService.fetchConfiguration() }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fun onAppStart(openAndPopUp: (String, String) -> Unit) {
 | 
			
		||||
 | 
			
		||||
        showError.value = false
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Reference in a new issue