mirror of
https://github.com/vector-im/element-android.git
synced 2024-11-16 02:05:06 +08:00
Keep the data entered by the user for the UI
Actually import what has been done in Login V2...
This commit is contained in:
parent
8f3db11693
commit
24d2669255
@ -174,7 +174,7 @@ class LoginFragment @Inject constructor() : AbstractSSOLoginFragment<FragmentLog
|
|||||||
ServerType.MatrixOrg -> {
|
ServerType.MatrixOrg -> {
|
||||||
views.loginServerIcon.isVisible = true
|
views.loginServerIcon.isVisible = true
|
||||||
views.loginServerIcon.setImageResource(R.drawable.ic_logo_matrix_org)
|
views.loginServerIcon.setImageResource(R.drawable.ic_logo_matrix_org)
|
||||||
views.loginTitle.text = getString(resId, state.homeServerUrl.toReducedUrl())
|
views.loginTitle.text = getString(resId, state.homeServerUrlFromUser.toReducedUrl())
|
||||||
views.loginNotice.text = getString(R.string.login_server_matrix_org_text)
|
views.loginNotice.text = getString(R.string.login_server_matrix_org_text)
|
||||||
}
|
}
|
||||||
ServerType.EMS -> {
|
ServerType.EMS -> {
|
||||||
@ -185,7 +185,7 @@ class LoginFragment @Inject constructor() : AbstractSSOLoginFragment<FragmentLog
|
|||||||
}
|
}
|
||||||
ServerType.Other -> {
|
ServerType.Other -> {
|
||||||
views.loginServerIcon.isVisible = false
|
views.loginServerIcon.isVisible = false
|
||||||
views.loginTitle.text = getString(resId, state.homeServerUrl.toReducedUrl())
|
views.loginTitle.text = getString(resId, state.homeServerUrlFromUser.toReducedUrl())
|
||||||
views.loginNotice.text = getString(R.string.login_server_other_text)
|
views.loginNotice.text = getString(R.string.login_server_other_text)
|
||||||
}
|
}
|
||||||
ServerType.Unknown -> Unit /* Should not happen */
|
ServerType.Unknown -> Unit /* Should not happen */
|
||||||
|
@ -55,7 +55,7 @@ class LoginResetPasswordFragment @Inject constructor() : AbstractLoginFragment<F
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun setupUi(state: LoginViewState) {
|
private fun setupUi(state: LoginViewState) {
|
||||||
views.resetPasswordTitle.text = getString(R.string.login_reset_password_on, state.homeServerUrl.toReducedUrl())
|
views.resetPasswordTitle.text = getString(R.string.login_reset_password_on, state.homeServerUrlFromUser.toReducedUrl())
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setupSubmitButton() {
|
private fun setupSubmitButton() {
|
||||||
|
@ -53,19 +53,19 @@ class LoginSignUpSignInSelectionFragment @Inject constructor() : AbstractSSOLogi
|
|||||||
ServerType.MatrixOrg -> {
|
ServerType.MatrixOrg -> {
|
||||||
views.loginSignupSigninServerIcon.setImageResource(R.drawable.ic_logo_matrix_org)
|
views.loginSignupSigninServerIcon.setImageResource(R.drawable.ic_logo_matrix_org)
|
||||||
views.loginSignupSigninServerIcon.isVisible = true
|
views.loginSignupSigninServerIcon.isVisible = true
|
||||||
views.loginSignupSigninTitle.text = getString(R.string.login_connect_to, state.homeServerUrl.toReducedUrl())
|
views.loginSignupSigninTitle.text = getString(R.string.login_connect_to, state.homeServerUrlFromUser.toReducedUrl())
|
||||||
views.loginSignupSigninText.text = getString(R.string.login_server_matrix_org_text)
|
views.loginSignupSigninText.text = getString(R.string.login_server_matrix_org_text)
|
||||||
}
|
}
|
||||||
ServerType.EMS -> {
|
ServerType.EMS -> {
|
||||||
views.loginSignupSigninServerIcon.setImageResource(R.drawable.ic_logo_element_matrix_services)
|
views.loginSignupSigninServerIcon.setImageResource(R.drawable.ic_logo_element_matrix_services)
|
||||||
views.loginSignupSigninServerIcon.isVisible = true
|
views.loginSignupSigninServerIcon.isVisible = true
|
||||||
views.loginSignupSigninTitle.text = getString(R.string.login_connect_to_modular)
|
views.loginSignupSigninTitle.text = getString(R.string.login_connect_to_modular)
|
||||||
views.loginSignupSigninText.text = state.homeServerUrl.toReducedUrl()
|
views.loginSignupSigninText.text = state.homeServerUrlFromUser.toReducedUrl()
|
||||||
}
|
}
|
||||||
ServerType.Other -> {
|
ServerType.Other -> {
|
||||||
views.loginSignupSigninServerIcon.isVisible = false
|
views.loginSignupSigninServerIcon.isVisible = false
|
||||||
views.loginSignupSigninTitle.text = getString(R.string.login_server_other_title)
|
views.loginSignupSigninTitle.text = getString(R.string.login_server_other_title)
|
||||||
views.loginSignupSigninText.text = getString(R.string.login_connect_to, state.homeServerUrl.toReducedUrl())
|
views.loginSignupSigninText.text = getString(R.string.login_connect_to, state.homeServerUrlFromUser.toReducedUrl())
|
||||||
}
|
}
|
||||||
ServerType.Unknown -> Unit /* Should not happen */
|
ServerType.Unknown -> Unit /* Should not happen */
|
||||||
}
|
}
|
||||||
|
@ -214,6 +214,7 @@ class LoginViewModel @AssistedInject constructor(
|
|||||||
copy(
|
copy(
|
||||||
signMode = SignMode.SignIn,
|
signMode = SignMode.SignIn,
|
||||||
loginMode = LoginMode.Sso(action.ssoIdentityProviders),
|
loginMode = LoginMode.Sso(action.ssoIdentityProviders),
|
||||||
|
homeServerUrlFromUser = action.homeServerUrl,
|
||||||
homeServerUrl = action.homeServerUrl,
|
homeServerUrl = action.homeServerUrl,
|
||||||
deviceId = action.deviceId
|
deviceId = action.deviceId
|
||||||
)
|
)
|
||||||
@ -365,6 +366,7 @@ class LoginViewModel @AssistedInject constructor(
|
|||||||
setState {
|
setState {
|
||||||
copy(
|
copy(
|
||||||
asyncHomeServerLoginFlowRequest = Uninitialized,
|
asyncHomeServerLoginFlowRequest = Uninitialized,
|
||||||
|
homeServerUrlFromUser = null,
|
||||||
homeServerUrl = null,
|
homeServerUrl = null,
|
||||||
loginMode = LoginMode.Unknown,
|
loginMode = LoginMode.Unknown,
|
||||||
serverType = ServerType.Unknown,
|
serverType = ServerType.Unknown,
|
||||||
@ -788,6 +790,7 @@ class LoginViewModel @AssistedInject constructor(
|
|||||||
setState {
|
setState {
|
||||||
copy(
|
copy(
|
||||||
asyncHomeServerLoginFlowRequest = Uninitialized,
|
asyncHomeServerLoginFlowRequest = Uninitialized,
|
||||||
|
homeServerUrlFromUser = homeServerConnectionConfig.homeServerUri.toString(),
|
||||||
homeServerUrl = data.homeServerUrl,
|
homeServerUrl = data.homeServerUrl,
|
||||||
loginMode = loginMode,
|
loginMode = loginMode,
|
||||||
loginModeSupportedTypes = data.supportedLoginTypes.toList()
|
loginModeSupportedTypes = data.supportedLoginTypes.toList()
|
||||||
|
@ -38,7 +38,12 @@ data class LoginViewState(
|
|||||||
@PersistState
|
@PersistState
|
||||||
val resetPasswordEmail: String? = null,
|
val resetPasswordEmail: String? = null,
|
||||||
@PersistState
|
@PersistState
|
||||||
|
val homeServerUrlFromUser: String? = null,
|
||||||
|
|
||||||
|
// Can be modified after a Wellknown request
|
||||||
|
@PersistState
|
||||||
val homeServerUrl: String? = null,
|
val homeServerUrl: String? = null,
|
||||||
|
|
||||||
// For SSO session recovery
|
// For SSO session recovery
|
||||||
@PersistState
|
@PersistState
|
||||||
val deviceId: String? = null,
|
val deviceId: String? = null,
|
||||||
|
@ -112,7 +112,7 @@ class LoginTermsFragment @Inject constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun updateWithState(state: LoginViewState) {
|
override fun updateWithState(state: LoginViewState) {
|
||||||
policyController.homeServer = state.homeServerUrl.toReducedUrl()
|
policyController.homeServer = state.homeServerUrlFromUser.toReducedUrl()
|
||||||
renderState()
|
renderState()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user