Replace if with when in SplashViewModel

This commit is contained in:
Kirill Kamakin
2022-04-09 03:58:08 +05:00
parent a9e0842a38
commit 15b4c2b91a

View File

@@ -23,12 +23,11 @@ class SplashViewModel @Inject constructor(
init { init {
viewModelScope.launch { viewModelScope.launch {
delay(1000) delay(1000)
_nextDestination.value = if (!disclaimerStorage.isDisclaimerAccepted()) _nextDestination.value = when {
SplashFragmentDirections.actionSplashFragmentToDisclaimerFragment() !disclaimerStorage.isDisclaimerAccepted() -> SplashFragmentDirections.actionSplashFragmentToDisclaimerFragment()
else if (baseURLStorage.getBaseURL() == null) baseURLStorage.getBaseURL() == null -> SplashFragmentDirections.actionSplashFragmentToBaseURLFragment()
SplashFragmentDirections.actionSplashFragmentToBaseURLFragment() else -> SplashFragmentDirections.actionSplashFragmentToRecipesFragment()
else }
SplashFragmentDirections.actionSplashFragmentToRecipesFragment()
} }
} }
} }