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