mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-10-31 08:15:02 +00:00
Logout: do not double render the progress state and disable the cancel button during the process.
This commit is contained in:
+6
@@ -47,6 +47,9 @@ import io.element.android.libraries.testtags.TestTags
|
||||
import io.element.android.libraries.testtags.testTag
|
||||
import io.element.android.libraries.ui.strings.CommonStrings
|
||||
|
||||
/**
|
||||
* Ref: https://www.figma.com/design/kEAcfun9iSpszeUDvdKZ6b/ER-351--Multi-account-in-EX?node-id=442-34581
|
||||
*/
|
||||
@Composable
|
||||
fun LogoutView(
|
||||
state: LogoutState,
|
||||
@@ -78,6 +81,8 @@ fun LogoutView(
|
||||
|
||||
LogoutActionDialog(
|
||||
state.logoutAction,
|
||||
// Do not show the progress dialog, the progress is rendered in the button.
|
||||
showProgressDialog = false,
|
||||
onConfirmClick = {
|
||||
eventSink(LogoutEvent.Logout(ignoreSdkError = false))
|
||||
},
|
||||
@@ -149,6 +154,7 @@ private fun ColumnScope.Buttons(
|
||||
)
|
||||
TextButton(
|
||||
text = stringResource(id = CommonStrings.action_cancel),
|
||||
enabled = logoutAction !is AsyncAction.Loading,
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
onClick = onCancelClick,
|
||||
)
|
||||
|
||||
+1
@@ -27,6 +27,7 @@ class DefaultDirectLogoutView : DirectLogoutView {
|
||||
val eventSink = state.eventSink
|
||||
LogoutActionDialog(
|
||||
state.logoutAction,
|
||||
showProgressDialog = true,
|
||||
onConfirmClick = {
|
||||
eventSink(DirectLogoutEvent.Logout(ignoreSdkError = false))
|
||||
},
|
||||
|
||||
+6
-2
@@ -19,6 +19,7 @@ import io.element.android.libraries.ui.strings.CommonStrings
|
||||
@Composable
|
||||
fun LogoutActionDialog(
|
||||
state: AsyncAction<Unit>,
|
||||
showProgressDialog: Boolean,
|
||||
onConfirmClick: () -> Unit,
|
||||
onForceLogoutClick: () -> Unit,
|
||||
onDismissDialog: () -> Unit,
|
||||
@@ -31,8 +32,11 @@ fun LogoutActionDialog(
|
||||
onSubmitClick = onConfirmClick,
|
||||
onDismiss = onDismissDialog
|
||||
)
|
||||
is AsyncAction.Loading ->
|
||||
ProgressDialog(text = stringResource(id = R.string.screen_signout_in_progress_dialog_content))
|
||||
is AsyncAction.Loading -> {
|
||||
if (showProgressDialog) {
|
||||
ProgressDialog(text = stringResource(id = R.string.screen_signout_in_progress_dialog_content))
|
||||
}
|
||||
}
|
||||
is AsyncAction.Failure ->
|
||||
RetryDialog(
|
||||
title = stringResource(id = CommonStrings.dialog_title_error),
|
||||
|
||||
Reference in New Issue
Block a user