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 {
viewModelScope.launch {
delay(1000)
_nextDestination.value = if (!disclaimerStorage.isDisclaimerAccepted())
SplashFragmentDirections.actionSplashFragmentToDisclaimerFragment()
else if (baseURLStorage.getBaseURL() == null)
SplashFragmentDirections.actionSplashFragmentToBaseURLFragment()
else
SplashFragmentDirections.actionSplashFragmentToRecipesFragment()
_nextDestination.value = when {
!disclaimerStorage.isDisclaimerAccepted() -> SplashFragmentDirections.actionSplashFragmentToDisclaimerFragment()
baseURLStorage.getBaseURL() == null -> SplashFragmentDirections.actionSplashFragmentToBaseURLFragment()
else -> SplashFragmentDirections.actionSplashFragmentToRecipesFragment()
}
}
}
}