Hi there. I have a flow where I should check if us...
# rx
u
Hi there. I have a flow where I should check if user is logged in and ready to go, if not, i should log him in and signal that now he's ready to go. Trying to translate in Rx:
Copy code
private fun isReadyToGo(
  loginAnonymously : SingleTokenData, 
  saveTokenData : Completable, 
  isLoggedIn : SingleBoolean
) {
  isLoggedIn.flatMapCompletable { isUserLoggedIn ->
      if (isUserLoggedIn)
        Completable.complete()
      else
        loginAnonymously.flatMapCompletable { tokenData ->
          saveToken
        }
  }
}
It feels wrong and verbose. Is there another way to do that? Thanks.