File tree Expand file tree Collapse file tree
presentation/src/main/java/com/threegap/bitnagil/presentation/splash Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ import com.threegap.bitnagil.presentation.splash.model.SplashState
1111import dagger.hilt.android.lifecycle.HiltViewModel
1212import kotlinx.coroutines.delay
1313import kotlinx.coroutines.launch
14+ import kotlinx.coroutines.withTimeoutOrNull
1415import org.orbitmvi.orbit.syntax.simple.SimpleSyntax
1516import javax.inject.Inject
1617
@@ -62,8 +63,14 @@ class SplashViewModel @Inject constructor(
6263
6364 private fun performAutoLogin () {
6465 viewModelScope.launch {
65- val userRole = autoLoginUseCase()
66- sendIntent(SplashIntent .SetUserRole (userRole))
66+ try {
67+ val userRole = withTimeoutOrNull(5000 ) {
68+ autoLoginUseCase()
69+ }
70+ sendIntent(SplashIntent .SetUserRole (userRole))
71+ } catch (e: Exception ) {
72+ sendIntent(SplashIntent .SetUserRole (null ))
73+ }
6774 }
6875 }
6976
You can’t perform that action at this time.
0 commit comments