From b1e4051b60eabb8f574dbb01c4dc0716e613edd6 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Sat, 18 Nov 2023 05:21:37 +0100 Subject: [PATCH] Display an X in case of error when inputting the homeserver --- .../java/eu/steffo/twom/ui/fragment/HomeserverFragment.kt | 5 ++--- app/src/main/java/eu/steffo/twom/ui/input/HomeserverField.kt | 3 +++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/eu/steffo/twom/ui/fragment/HomeserverFragment.kt b/app/src/main/java/eu/steffo/twom/ui/fragment/HomeserverFragment.kt index 3478151..48370b1 100644 --- a/app/src/main/java/eu/steffo/twom/ui/fragment/HomeserverFragment.kt +++ b/app/src/main/java/eu/steffo/twom/ui/fragment/HomeserverFragment.kt @@ -32,7 +32,7 @@ import kotlinx.coroutines.launch import org.matrix.android.sdk.api.auth.data.HomeServerConnectionConfig @Composable -fun LoginFragment() { +fun HomeserverFragment() { TwoMMatrixProvider { TwoMTheme { HomeserverContents() @@ -98,8 +98,7 @@ fun HomeserverContents() { )) } catch(e: Throwable) { - Log.e("LoginFragment", "Failed to get flows for homeserver", e) - homeserverFieldState = HomeserverFieldState.Done + homeserverFieldState = HomeserverFieldState.Error homeserverFlowValid = false return@ValidateFlows } diff --git a/app/src/main/java/eu/steffo/twom/ui/input/HomeserverField.kt b/app/src/main/java/eu/steffo/twom/ui/input/HomeserverField.kt index 2387122..3c04e78 100644 --- a/app/src/main/java/eu/steffo/twom/ui/input/HomeserverField.kt +++ b/app/src/main/java/eu/steffo/twom/ui/input/HomeserverField.kt @@ -3,6 +3,7 @@ package eu.steffo.twom.ui.input import androidx.compose.material.icons.Icons import androidx.compose.material.icons.filled.Build import androidx.compose.material.icons.filled.Check +import androidx.compose.material.icons.filled.Close import androidx.compose.material.icons.filled.Create import androidx.compose.material.icons.filled.Send import androidx.compose.material3.Icon @@ -19,6 +20,7 @@ enum class HomeserverFieldState { Empty, Waiting, Validating, + Error, Done, } @@ -51,6 +53,7 @@ fun HomeserverField( HomeserverFieldState.Empty -> Icons.Default.Build HomeserverFieldState.Waiting -> Icons.Default.Create HomeserverFieldState.Validating -> Icons.Default.Send + HomeserverFieldState.Error -> Icons.Default.Close HomeserverFieldState.Done -> Icons.Default.Check }, LocalContext.current.getString(R.string.homeserver_trailingicon_validating_description)