diff --git a/app/src/main/java/eu/m724/vastapp/activity/dashboard/DashboardViewModel.kt b/app/src/main/java/eu/m724/vastapp/activity/dashboard/DashboardViewModel.kt index beddded..06feaa2 100644 --- a/app/src/main/java/eu/m724/vastapp/activity/dashboard/DashboardViewModel.kt +++ b/app/src/main/java/eu/m724/vastapp/activity/dashboard/DashboardViewModel.kt @@ -1,39 +1,21 @@ package eu.m724.vastapp.activity.dashboard -import android.content.Intent -import android.net.Uri -import androidx.compose.ui.platform.LocalContext -import androidx.core.content.ContextCompat.startActivity import androidx.lifecycle.ViewModel -import androidx.lifecycle.viewModelScope import eu.m724.vastapp.vastai.ApiRoute import eu.m724.vastapp.vastai.VastApi import eu.m724.vastapp.vastai.api.UserUrlRequestCallback import eu.m724.vastapp.vastai.data.User -import kotlinx.coroutines.flow.MutableSharedFlow import kotlinx.coroutines.flow.MutableStateFlow -import kotlinx.coroutines.flow.SharedFlow import kotlinx.coroutines.flow.StateFlow -import kotlinx.coroutines.flow.asSharedFlow import kotlinx.coroutines.flow.asStateFlow -import kotlinx.coroutines.launch -class DashboardViewModel(private val _user: User, val vastApi: VastApi) : ViewModel() { +class DashboardViewModel(initialUser: User, private val vastApi: VastApi) : ViewModel() { // TODO do something with the user private val _uiState: MutableStateFlow = - MutableStateFlow(DashboardUiState(false, _user, null)) + MutableStateFlow(DashboardUiState(false, initialUser, null)) val uiState: StateFlow = _uiState.asStateFlow() - private val _navigationEvent = MutableSharedFlow() - val navigationEvent: SharedFlow = _navigationEvent.asSharedFlow() - - fun navigateTo(route: String) { - viewModelScope.launch { - _navigationEvent.emit(route) - } - } - fun refresh() { val request = vastApi.buildRequest( ApiRoute.SHOW_USER,