mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-10-31 16:22:49 +00:00
Logout screen: add Cancel button and update icon.
This commit is contained in:
+10
-2
@@ -32,6 +32,7 @@ import io.element.android.libraries.designsystem.theme.components.Button
|
||||
import io.element.android.libraries.designsystem.theme.components.LinearProgressIndicator
|
||||
import io.element.android.libraries.designsystem.theme.components.OutlinedButton
|
||||
import io.element.android.libraries.designsystem.theme.components.Text
|
||||
import io.element.android.libraries.designsystem.theme.components.TextButton
|
||||
import io.element.android.libraries.designsystem.theme.progressIndicatorTrackColor
|
||||
import io.element.android.libraries.matrix.api.encryption.BackupState
|
||||
import io.element.android.libraries.matrix.api.encryption.BackupUploadState
|
||||
@@ -54,7 +55,7 @@ fun LogoutView(
|
||||
onBackClick = onBackClick,
|
||||
title = title(state),
|
||||
subTitle = subtitle(state),
|
||||
iconStyle = BigIcon.Style.Default(CompoundIcons.KeySolid()),
|
||||
iconStyle = BigIcon.Style.Default(CompoundIcons.Mobile()),
|
||||
modifier = modifier,
|
||||
buttons = {
|
||||
Buttons(
|
||||
@@ -62,7 +63,8 @@ fun LogoutView(
|
||||
onChangeRecoveryKeyClick = onChangeRecoveryKeyClick,
|
||||
onLogoutClick = {
|
||||
eventSink(LogoutEvent.Logout(ignoreSdkError = false))
|
||||
}
|
||||
},
|
||||
onCancelClick = onBackClick,
|
||||
)
|
||||
},
|
||||
) {
|
||||
@@ -116,6 +118,7 @@ private fun ColumnScope.Buttons(
|
||||
state: LogoutState,
|
||||
onLogoutClick: () -> Unit,
|
||||
onChangeRecoveryKeyClick: () -> Unit,
|
||||
onCancelClick: () -> Unit,
|
||||
) {
|
||||
val logoutAction = state.logoutAction
|
||||
if (state.isLastDevice) {
|
||||
@@ -139,6 +142,11 @@ private fun ColumnScope.Buttons(
|
||||
.testTag(TestTags.signOut),
|
||||
onClick = onLogoutClick,
|
||||
)
|
||||
TextButton(
|
||||
text = stringResource(id = CommonStrings.action_cancel),
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
onClick = onCancelClick,
|
||||
)
|
||||
}
|
||||
|
||||
@Composable
|
||||
|
||||
+15
-1
@@ -88,10 +88,24 @@ class LogoutViewTest : RobolectricTest() {
|
||||
eventSink = eventsRecorder
|
||||
),
|
||||
)
|
||||
clickOn(CommonStrings.action_cancel)
|
||||
clickOn(CommonStrings.action_cancel, inDialog = true)
|
||||
eventsRecorder.assertSingle(LogoutEvent.CloseDialogs)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `clicking on cancel invoke back callback`() = runAndroidComposeUiTest {
|
||||
val eventsRecorder = EventsRecorder<LogoutEvent>(expectEvents = false)
|
||||
ensureCalledOnce { callback ->
|
||||
setLogoutView(
|
||||
aLogoutState(
|
||||
eventSink = eventsRecorder
|
||||
),
|
||||
onBackClick = callback,
|
||||
)
|
||||
clickOn(CommonStrings.action_cancel)
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `last session setting button invoke onChangeRecoveryKeyClicked`() = runAndroidComposeUiTest {
|
||||
val eventsRecorder = EventsRecorder<LogoutEvent>(expectEvents = false)
|
||||
|
||||
Reference in New Issue
Block a user