fetch configutation on startup

This commit is contained in:
lbarraga 2023-04-16 23:31:35 +02:00
parent cf97565dec
commit 79dcede47b

View file

@ -2,6 +2,7 @@ package be.ugent.sel.studeez.screens.splash
import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.mutableStateOf
import be.ugent.sel.studeez.domain.AccountDAO 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.domain.LogService
import be.ugent.sel.studeez.navigation.StudeezDestinations import be.ugent.sel.studeez.navigation.StudeezDestinations
import be.ugent.sel.studeez.screens.StudeezViewModel import be.ugent.sel.studeez.screens.StudeezViewModel
@ -11,10 +12,15 @@ import javax.inject.Inject
@HiltViewModel @HiltViewModel
class SplashViewModel @Inject constructor( class SplashViewModel @Inject constructor(
private val accountDAO: AccountDAO, private val accountDAO: AccountDAO,
private val configurationService: ConfigurationService,
logService: LogService logService: LogService
) : StudeezViewModel(logService) { ) : StudeezViewModel(logService) {
val showError = mutableStateOf(false) val showError = mutableStateOf(false)
init {
launchCatching { configurationService.fetchConfiguration() }
}
fun onAppStart(openAndPopUp: (String, String) -> Unit) { fun onAppStart(openAndPopUp: (String, String) -> Unit) {
showError.value = false showError.value = false