Merge branch 'develop' into feature/fga/app_nav_node_fixes
This commit is contained in:
commit
a07808c314
39 changed files with 875 additions and 42 deletions
|
|
@ -41,6 +41,7 @@ import io.element.android.appnav.intent.IntentResolver
|
|||
import io.element.android.appnav.intent.ResolvedIntent
|
||||
import io.element.android.appnav.root.RootPresenter
|
||||
import io.element.android.appnav.root.RootView
|
||||
import io.element.android.features.login.api.LoginUserStory
|
||||
import io.element.android.features.login.api.oidc.OidcAction
|
||||
import io.element.android.features.login.api.oidc.OidcActionFlow
|
||||
import io.element.android.features.preferences.api.CacheService
|
||||
|
|
@ -54,6 +55,8 @@ import io.element.android.libraries.designsystem.theme.components.CircularProgre
|
|||
import io.element.android.libraries.di.AppScope
|
||||
import io.element.android.libraries.matrix.api.auth.MatrixAuthenticationService
|
||||
import io.element.android.libraries.matrix.api.core.SessionId
|
||||
import kotlinx.coroutines.flow.distinctUntilChanged
|
||||
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import kotlinx.coroutines.flow.combine
|
||||
import kotlinx.coroutines.flow.launchIn
|
||||
|
|
@ -75,6 +78,7 @@ class RootFlowNode @AssistedInject constructor(
|
|||
private val bugReportEntryPoint: BugReportEntryPoint,
|
||||
private val intentResolver: IntentResolver,
|
||||
private val oidcActionFlow: OidcActionFlow,
|
||||
private val loginUserStory: LoginUserStory,
|
||||
) :
|
||||
BackstackNode<RootFlowNode.NavTarget>(
|
||||
backstack = BackStack(
|
||||
|
|
@ -93,7 +97,7 @@ class RootFlowNode @AssistedInject constructor(
|
|||
private fun observeLoggedInState() {
|
||||
combine(
|
||||
cacheService.onClearedCacheEventFlow(),
|
||||
authenticationService.isLoggedIn(),
|
||||
isUserLoggedInFlow(),
|
||||
) { _, isLoggedIn -> isLoggedIn }
|
||||
.onEach { isLoggedIn ->
|
||||
Timber.v("isLoggedIn=$isLoggedIn")
|
||||
|
|
@ -109,10 +113,21 @@ class RootFlowNode @AssistedInject constructor(
|
|||
.launchIn(lifecycleScope)
|
||||
}
|
||||
|
||||
|
||||
private fun switchToLoggedInFlow(sessionId: SessionId) {
|
||||
backstack.safeRoot(NavTarget.LoggedInFlow(sessionId))
|
||||
}
|
||||
|
||||
private fun isUserLoggedInFlow(): Flow<Boolean> {
|
||||
return combine(
|
||||
authenticationService.isLoggedIn(),
|
||||
loginUserStory.loginFlowIsDone
|
||||
) { isLoggedIn, loginFlowIsDone ->
|
||||
isLoggedIn && loginFlowIsDone
|
||||
}
|
||||
.distinctUntilChanged()
|
||||
}
|
||||
|
||||
private fun switchToNotLoggedInFlow() {
|
||||
matrixClientsHolder.removeAll()
|
||||
backstack.safeRoot(NavTarget.NotLoggedInFlow)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue