1
Fork 0
mirror of https://github.com/Steffo99/twom.git synced 2024-11-25 01:24:24 +00:00

Display an X in case of error when inputting the homeserver

This commit is contained in:
Steffo 2023-11-18 05:21:37 +01:00
parent 9de4425287
commit b1e4051b60
Signed by: steffo
GPG key ID: 2A24051445686895
2 changed files with 5 additions and 3 deletions

View file

@ -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
}

View file

@ -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)