Rename InlineErrorMessage to simple Error to not consider how the error will be used (actually used in a dialog now)

This commit is contained in:
Benoit Marty 2023-06-09 17:51:42 +02:00
parent 0dd4109d21
commit 8b177645a9
3 changed files with 4 additions and 4 deletions

View file

@ -39,7 +39,7 @@ fun ChangeServerView(
when (state.changeServerAction) { when (state.changeServerAction) {
is Async.Failure -> { is Async.Failure -> {
when (val error = state.changeServerAction.error) { when (val error = state.changeServerAction.error) {
is ChangeServerError.InlineErrorMessage -> { is ChangeServerError.Error -> {
ErrorDialog( ErrorDialog(
modifier = modifier, modifier = modifier,
content = error.message(), content = error.message(),

View file

@ -23,7 +23,7 @@ import io.element.android.features.login.impl.R
import io.element.android.libraries.matrix.api.auth.AuthenticationException import io.element.android.libraries.matrix.api.auth.AuthenticationException
sealed class ChangeServerError : Throwable() { sealed class ChangeServerError : Throwable() {
data class InlineErrorMessage(@StringRes val messageId: Int) : ChangeServerError() { data class Error(@StringRes val messageId: Int) : ChangeServerError() {
@Composable @Composable
fun message(): String = stringResource(messageId) fun message(): String = stringResource(messageId)
} }
@ -32,7 +32,7 @@ sealed class ChangeServerError : Throwable() {
companion object { companion object {
fun from(error: Throwable): ChangeServerError = when (error) { fun from(error: Throwable): ChangeServerError = when (error) {
is AuthenticationException.SlidingSyncNotAvailable -> SlidingSyncAlert is AuthenticationException.SlidingSyncNotAvailable -> SlidingSyncAlert
else -> InlineErrorMessage(R.string.screen_change_server_error_invalid_homeserver) else -> Error(R.string.screen_change_server_error_invalid_homeserver)
} }
} }
} }

View file

@ -112,7 +112,7 @@ fun ConfirmAccountProviderView(
when (state.loginFlow) { when (state.loginFlow) {
is Async.Failure -> { is Async.Failure -> {
when (val error = state.loginFlow.error) { when (val error = state.loginFlow.error) {
is ChangeServerError.InlineErrorMessage -> { is ChangeServerError.Error -> {
ErrorDialog( ErrorDialog(
content = error.message(), content = error.message(),
onDismiss = { onDismiss = {