Remove LoginUserStory.
No that we do not have the WaitList screen anymore, this interface and implementation are useless.
This commit is contained in:
parent
c45a1ca842
commit
516ba08f9c
13 changed files with 6 additions and 119 deletions
|
|
@ -1,26 +0,0 @@
|
|||
/*
|
||||
* Copyright 2023, 2024 New Vector Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
|
||||
* Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
package io.element.android.features.login.impl
|
||||
|
||||
import com.squareup.anvil.annotations.ContributesBinding
|
||||
import io.element.android.features.login.api.LoginUserStory
|
||||
import io.element.android.libraries.di.AppScope
|
||||
import io.element.android.libraries.di.SingleIn
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
import javax.inject.Inject
|
||||
|
||||
@SingleIn(AppScope::class)
|
||||
@ContributesBinding(AppScope::class)
|
||||
class DefaultLoginUserStory @Inject constructor() : LoginUserStory {
|
||||
// True by default, will be set to false when the login user story is started, and set to true again once it's done.
|
||||
override val loginFlowIsDone: MutableStateFlow<Boolean> = MutableStateFlow(true)
|
||||
|
||||
fun setLoginFlowIsDone(value: Boolean) {
|
||||
loginFlowIsDone.value = value
|
||||
}
|
||||
}
|
||||
|
|
@ -55,7 +55,6 @@ class LoginFlowNode @AssistedInject constructor(
|
|||
@Assisted buildContext: BuildContext,
|
||||
@Assisted plugins: List<Plugin>,
|
||||
private val accountProviderDataSource: AccountProviderDataSource,
|
||||
private val defaultLoginUserStory: DefaultLoginUserStory,
|
||||
private val oidcActionFlow: OidcActionFlow,
|
||||
) : BaseFlowNode<LoginFlowNode.NavTarget>(
|
||||
backstack = BackStack(
|
||||
|
|
@ -77,7 +76,6 @@ class LoginFlowNode @AssistedInject constructor(
|
|||
|
||||
override fun onBuilt() {
|
||||
super.onBuilt()
|
||||
defaultLoginUserStory.setLoginFlowIsDone(false)
|
||||
lifecycle.subscribe(
|
||||
onResume = {
|
||||
if (externalAppStarted) {
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@ import androidx.compose.runtime.LaunchedEffect
|
|||
import androidx.compose.runtime.MutableState
|
||||
import androidx.compose.runtime.State
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import io.element.android.features.login.impl.DefaultLoginUserStory
|
||||
import io.element.android.features.login.impl.error.ChangeServerError
|
||||
import io.element.android.features.login.impl.screens.chooseaccountprovider.ChooseAccountProviderPresenter
|
||||
import io.element.android.features.login.impl.screens.confirmaccountprovider.ConfirmAccountProviderPresenter
|
||||
|
|
@ -38,7 +37,6 @@ import javax.inject.Inject
|
|||
class LoginHelper @Inject constructor(
|
||||
private val oidcActionFlow: OidcActionFlow,
|
||||
private val authenticationService: MatrixAuthenticationService,
|
||||
private val defaultLoginUserStory: DefaultLoginUserStory,
|
||||
private val webClientUrlForAuthenticationRetriever: WebClientUrlForAuthenticationRetriever,
|
||||
) {
|
||||
private val loginModeState: MutableState<AsyncData<LoginMode>> = mutableStateOf(AsyncData.Uninitialized)
|
||||
|
|
@ -108,9 +106,6 @@ class LoginHelper @Inject constructor(
|
|||
}
|
||||
is OidcAction.Success -> {
|
||||
authenticationService.loginWithOidc(oidcAction.url)
|
||||
.onSuccess { _ ->
|
||||
defaultLoginUserStory.setLoginFlowIsDone(true)
|
||||
}
|
||||
.onFailure { failure ->
|
||||
loginModeState.value = AsyncData.Failure(failure)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@ import com.bumble.appyx.navmodel.backstack.operation.replace
|
|||
import dagger.assisted.Assisted
|
||||
import dagger.assisted.AssistedInject
|
||||
import io.element.android.anvilannotations.ContributesNode
|
||||
import io.element.android.features.login.impl.DefaultLoginUserStory
|
||||
import io.element.android.features.login.impl.di.QrCodeLoginBindings
|
||||
import io.element.android.features.login.impl.di.QrCodeLoginComponent
|
||||
import io.element.android.features.login.impl.screens.qrcode.confirmation.QrCodeConfirmationNode
|
||||
|
|
@ -54,7 +53,6 @@ class QrCodeLoginFlowNode @AssistedInject constructor(
|
|||
@Assisted buildContext: BuildContext,
|
||||
@Assisted plugins: List<Plugin>,
|
||||
qrCodeLoginComponentBuilder: QrCodeLoginComponent.Builder,
|
||||
private val defaultLoginUserStory: DefaultLoginUserStory,
|
||||
private val coroutineDispatchers: CoroutineDispatchers,
|
||||
) : BaseFlowNode<QrCodeLoginFlowNode.NavTarget>(
|
||||
backstack = BackStack(
|
||||
|
|
@ -198,7 +196,6 @@ class QrCodeLoginFlowNode @AssistedInject constructor(
|
|||
authenticationJob = launch(coroutineDispatchers.main) {
|
||||
qrCodeLoginManager.authenticate(qrCodeLoginData)
|
||||
.onSuccess {
|
||||
defaultLoginUserStory.setLoginFlowIsDone(true)
|
||||
authenticationJob = null
|
||||
}
|
||||
.onFailure { throwable ->
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@ import androidx.compose.runtime.rememberCoroutineScope
|
|||
import dagger.assisted.Assisted
|
||||
import dagger.assisted.AssistedFactory
|
||||
import dagger.assisted.AssistedInject
|
||||
import io.element.android.features.login.impl.DefaultLoginUserStory
|
||||
import io.element.android.libraries.architecture.AsyncAction
|
||||
import io.element.android.libraries.architecture.Presenter
|
||||
import io.element.android.libraries.core.data.tryOrNull
|
||||
|
|
@ -36,7 +35,6 @@ class CreateAccountPresenter @AssistedInject constructor(
|
|||
@Assisted private val url: String,
|
||||
private val authenticationService: MatrixAuthenticationService,
|
||||
private val clientProvider: MatrixClientProvider,
|
||||
private val defaultLoginUserStory: DefaultLoginUserStory,
|
||||
private val messageParser: MessageParser,
|
||||
private val buildMeta: BuildMeta,
|
||||
) : Presenter<CreateAccountState> {
|
||||
|
|
@ -86,8 +84,6 @@ class CreateAccountPresenter @AssistedInject constructor(
|
|||
val sessionVerificationService = client.sessionVerificationService()
|
||||
withTimeout(10.seconds) { sessionVerificationService.sessionVerifiedStatus.first { it.isVerified() } }
|
||||
}
|
||||
// We will not navigate to the WaitList screen, so the login user story is done
|
||||
defaultLoginUserStory.setLoginFlowIsDone(true)
|
||||
loggedInState.value = AsyncAction.Success(sessionId)
|
||||
}.onFailure { failure ->
|
||||
loggedInState.value = AsyncAction.Failure(failure)
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@ import androidx.compose.runtime.mutableStateOf
|
|||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.rememberCoroutineScope
|
||||
import androidx.compose.runtime.saveable.rememberSaveable
|
||||
import io.element.android.features.login.impl.DefaultLoginUserStory
|
||||
import io.element.android.features.login.impl.accountprovider.AccountProviderDataSource
|
||||
import io.element.android.libraries.architecture.AsyncData
|
||||
import io.element.android.libraries.architecture.Presenter
|
||||
|
|
@ -28,7 +27,6 @@ import javax.inject.Inject
|
|||
class LoginPasswordPresenter @Inject constructor(
|
||||
private val authenticationService: MatrixAuthenticationService,
|
||||
private val accountProviderDataSource: AccountProviderDataSource,
|
||||
private val defaultLoginUserStory: DefaultLoginUserStory,
|
||||
) : Presenter<LoginPasswordState> {
|
||||
@Composable
|
||||
override fun present(): LoginPasswordState {
|
||||
|
|
@ -69,8 +67,6 @@ class LoginPasswordPresenter @Inject constructor(
|
|||
loggedInState.value = AsyncData.Loading()
|
||||
authenticationService.login(formState.login.trim(), formState.password)
|
||||
.onSuccess { sessionId ->
|
||||
// We will not navigate to the WaitList screen, so the login user story is done
|
||||
defaultLoginUserStory.setLoginFlowIsDone(true)
|
||||
loggedInState.value = AsyncData.Success(sessionId)
|
||||
}
|
||||
.onFailure { failure ->
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue