Adds direct and custom types to soft logout disambiguation
This commit is contained in:
parent
21459db634
commit
5fcae7f4e6
@ -40,8 +40,8 @@ import org.matrix.android.sdk.internal.auth.login.LoginType
|
||||
import javax.inject.Inject
|
||||
|
||||
class SoftLogoutController @Inject constructor(
|
||||
private val stringProvider: StringProvider,
|
||||
private val errorFormatter: ErrorFormatter
|
||||
private val stringProvider: StringProvider,
|
||||
private val errorFormatter: ErrorFormatter
|
||||
) : EpoxyController() {
|
||||
|
||||
var listener: Listener? = null
|
||||
@ -77,9 +77,9 @@ class SoftLogoutController @Inject constructor(
|
||||
loginTextItem {
|
||||
id("signText1")
|
||||
text(host.stringProvider.getString(R.string.soft_logout_signin_notice,
|
||||
state.homeServerUrl.toReducedUrl(),
|
||||
state.userDisplayName,
|
||||
state.userId))
|
||||
state.homeServerUrl.toReducedUrl(),
|
||||
state.userDisplayName,
|
||||
state.userId))
|
||||
}
|
||||
if (state.hasUnsavedKeys) {
|
||||
loginTextItem {
|
||||
@ -90,9 +90,9 @@ class SoftLogoutController @Inject constructor(
|
||||
}
|
||||
|
||||
private fun buildForm(state: SoftLogoutViewState) = when (state.asyncHomeServerLoginFlowRequest) {
|
||||
is Incomplete -> buildLoadingItem()
|
||||
is Fail -> buildLoginErrorWithRetryItem(state.asyncHomeServerLoginFlowRequest.error)
|
||||
is Success -> buildLoginSuccessItem(state)
|
||||
is Incomplete -> buildLoadingItem()
|
||||
is Fail -> buildLoginErrorWithRetryItem(state.asyncHomeServerLoginFlowRequest.error)
|
||||
is Success -> buildLoginSuccessItem(state)
|
||||
is Loading, Uninitialized -> Unit
|
||||
}
|
||||
|
||||
@ -112,11 +112,11 @@ class SoftLogoutController @Inject constructor(
|
||||
}
|
||||
|
||||
private fun buildLoginSuccessItem(state: SoftLogoutViewState) = when (state.asyncHomeServerLoginFlowRequest.invoke()) {
|
||||
LoginMode.Password -> buildLoginPasswordForm(state)
|
||||
is LoginMode.Sso -> buildLoginSSOForm()
|
||||
LoginMode.Password -> buildLoginPasswordForm(state)
|
||||
is LoginMode.Sso -> buildLoginSSOForm()
|
||||
is LoginMode.SsoAndPassword -> disambiguateLoginSSOAndPasswordForm(state)
|
||||
LoginMode.Unsupported -> buildLoginUnsupportedForm()
|
||||
LoginMode.Unknown, null -> Unit // Should not happen
|
||||
LoginMode.Unsupported -> buildLoginUnsupportedForm()
|
||||
LoginMode.Unknown, null -> Unit // Should not happen
|
||||
}
|
||||
|
||||
private fun buildLoginPasswordForm(state: SoftLogoutViewState) {
|
||||
@ -144,10 +144,12 @@ class SoftLogoutController @Inject constructor(
|
||||
|
||||
private fun disambiguateLoginSSOAndPasswordForm(state: SoftLogoutViewState) {
|
||||
when (state.loginType) {
|
||||
LoginType.PASSWORD -> buildLoginPasswordForm(state)
|
||||
LoginType.SSO -> buildLoginSSOForm()
|
||||
LoginType.PASSWORD -> buildLoginPasswordForm(state)
|
||||
LoginType.SSO -> buildLoginSSOForm()
|
||||
LoginType.DIRECT,
|
||||
LoginType.CUSTOM,
|
||||
LoginType.UNSUPPORTED -> buildLoginUnsupportedForm()
|
||||
LoginType.UNKNOWN -> Unit
|
||||
LoginType.UNKNOWN -> Unit
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user