adding unavailable homeserver error messaging in the registration page

This commit is contained in:
Adam Brown 2022-06-09 16:48:15 +01:00
parent d71d37c1ce
commit c6bae6812d

View File

@ -48,6 +48,7 @@ import im.vector.app.features.onboarding.OnboardingViewEvents
import im.vector.app.features.onboarding.OnboardingViewState
import kotlinx.coroutines.flow.launchIn
import org.matrix.android.sdk.api.auth.data.SsoIdentityProvider
import org.matrix.android.sdk.api.failure.isHomeserverUnavailable
import org.matrix.android.sdk.api.failure.isInvalidPassword
import org.matrix.android.sdk.api.failure.isInvalidUsername
import org.matrix.android.sdk.api.failure.isLoginEmailUnknown
@ -133,6 +134,9 @@ class FtueAuthCombinedRegisterFragment @Inject constructor() : AbstractSSOFtueAu
throwable.isWeakPassword() || throwable.isInvalidPassword() -> {
views.createAccountPasswordInput.error = errorFormatter.toHumanReadable(throwable)
}
throwable.isHomeserverUnavailable() -> {
views.createAccountInput.error = getString(R.string.login_error_homeserver_not_found)
}
throwable.isRegistrationDisabled() -> {
MaterialAlertDialogBuilder(requireActivity())
.setTitle(R.string.dialog_title_error)