Improve readability

This commit is contained in:
Benoit Marty 2023-06-23 15:24:46 +02:00 committed by Benoit Marty
parent baf117e8fa
commit cc1c3c8f7b

View file

@ -96,11 +96,13 @@ class RootFlowNode @AssistedInject constructor(
matrixClientsHolder.removeAll() matrixClientsHolder.removeAll()
} }
) { isLoggedIn, cacheIdx -> isLoggedIn to cacheIdx } ) { isLoggedIn, cacheIdx -> isLoggedIn to cacheIdx }
.onEach { isLoggedIn -> .onEach { pair ->
Timber.v("isLoggedIn=$isLoggedIn") val isLoggedIn = pair.first
if (isLoggedIn.first) { val cacheIndex = pair.second
Timber.v("isLoggedIn=$isLoggedIn, cacheIndex=$cacheIndex")
if (isLoggedIn) {
tryToRestoreLatestSession( tryToRestoreLatestSession(
onSuccess = { switchToLoggedInFlow(it, isLoggedIn.second) }, onSuccess = { switchToLoggedInFlow(it, cacheIndex) },
onFailure = { switchToNotLoggedInFlow() } onFailure = { switchToNotLoggedInFlow() }
) )
} else { } else {