From 8b177645a90a17be33894edbecab0bd2b5946f5e Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Fri, 9 Jun 2023 17:51:42 +0200 Subject: [PATCH] Rename `InlineErrorMessage` to simple `Error` to not consider how the error will be used (actually used in a dialog now) --- .../features/login/impl/changeserver/ChangeServerView.kt | 2 +- .../android/features/login/impl/error/ChangeServerError.kt | 4 ++-- .../confirmaccountprovider/ConfirmAccountProviderView.kt | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/changeserver/ChangeServerView.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/changeserver/ChangeServerView.kt index 136a4a7d5b..d2e1a03cf5 100644 --- a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/changeserver/ChangeServerView.kt +++ b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/changeserver/ChangeServerView.kt @@ -39,7 +39,7 @@ fun ChangeServerView( when (state.changeServerAction) { is Async.Failure -> { when (val error = state.changeServerAction.error) { - is ChangeServerError.InlineErrorMessage -> { + is ChangeServerError.Error -> { ErrorDialog( modifier = modifier, content = error.message(), diff --git a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/error/ChangeServerError.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/error/ChangeServerError.kt index 9976089f52..444ea3d3f2 100644 --- a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/error/ChangeServerError.kt +++ b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/error/ChangeServerError.kt @@ -23,7 +23,7 @@ import io.element.android.features.login.impl.R import io.element.android.libraries.matrix.api.auth.AuthenticationException sealed class ChangeServerError : Throwable() { - data class InlineErrorMessage(@StringRes val messageId: Int) : ChangeServerError() { + data class Error(@StringRes val messageId: Int) : ChangeServerError() { @Composable fun message(): String = stringResource(messageId) } @@ -32,7 +32,7 @@ sealed class ChangeServerError : Throwable() { companion object { fun from(error: Throwable): ChangeServerError = when (error) { is AuthenticationException.SlidingSyncNotAvailable -> SlidingSyncAlert - else -> InlineErrorMessage(R.string.screen_change_server_error_invalid_homeserver) + else -> Error(R.string.screen_change_server_error_invalid_homeserver) } } } diff --git a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderView.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderView.kt index 9305bccd12..c9053d67c9 100644 --- a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderView.kt +++ b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderView.kt @@ -112,7 +112,7 @@ fun ConfirmAccountProviderView( when (state.loginFlow) { is Async.Failure -> { when (val error = state.loginFlow.error) { - is ChangeServerError.InlineErrorMessage -> { + is ChangeServerError.Error -> { ErrorDialog( content = error.message(), onDismiss = {