|
@@ -5,8 +5,10 @@ import androidx.lifecycle.MutableLiveData
|
|
|
import androidx.lifecycle.ViewModel
|
|
|
import androidx.lifecycle.viewModelScope
|
|
|
import com.fastest.pass.splash.domain.usecase.SplashUseCase
|
|
|
+import com.fastest.pass.splash.utils.SplashRoute
|
|
|
import dagger.hilt.android.lifecycle.HiltViewModel
|
|
|
import kotlinx.coroutines.delay
|
|
|
+import kotlinx.coroutines.flow.MutableStateFlow
|
|
|
import kotlinx.coroutines.launch
|
|
|
import javax.inject.Inject
|
|
|
|
|
@@ -16,10 +18,18 @@ class SplashViewModel @Inject constructor(var splashUseCase: SplashUseCase) : Vi
|
|
|
private val _navigateToLogin = MutableLiveData<Boolean>(false)
|
|
|
val navigateToLogin: LiveData<Boolean> = _navigateToLogin
|
|
|
|
|
|
+
|
|
|
+ private val _router = MutableStateFlow<SplashRoute>(SplashRoute.NoneScreen)
|
|
|
+ val router :MutableStateFlow<SplashRoute> = _router
|
|
|
+
|
|
|
fun checkAuthentication() {
|
|
|
viewModelScope.launch {
|
|
|
delay(2000)
|
|
|
_navigateToLogin.value = true
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ fun navigateTo(splashRoute: SplashRoute) {
|
|
|
+ _router.value = splashRoute
|
|
|
+ }
|
|
|
}
|