diff --git a/features/lockscreen/impl/src/main/kotlin/io/element/android/features/lockscreen/impl/setup/biometric/SetupBiometricView.kt b/features/lockscreen/impl/src/main/kotlin/io/element/android/features/lockscreen/impl/setup/biometric/SetupBiometricView.kt index e565dc78fe..761d48ec38 100644 --- a/features/lockscreen/impl/src/main/kotlin/io/element/android/features/lockscreen/impl/setup/biometric/SetupBiometricView.kt +++ b/features/lockscreen/impl/src/main/kotlin/io/element/android/features/lockscreen/impl/setup/biometric/SetupBiometricView.kt @@ -31,7 +31,7 @@ fun SetupBiometricView( state: SetupBiometricState, modifier: Modifier = Modifier, ) { - BackHandler(true) { + BackHandler { state.eventSink(SetupBiometricEvents.UsePin) } HeaderFooterPage( diff --git a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/qrcode/confirmation/QrCodeConfirmationView.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/qrcode/confirmation/QrCodeConfirmationView.kt index 9b6da699d1..99bb11662e 100644 --- a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/qrcode/confirmation/QrCodeConfirmationView.kt +++ b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/qrcode/confirmation/QrCodeConfirmationView.kt @@ -45,9 +45,8 @@ fun QrCodeConfirmationView( onCancel: () -> Unit, modifier: Modifier = Modifier, ) { - BackHandler { - onCancel() - } + BackHandler(onBack = onCancel) + val icon = when (step) { is QrCodeConfirmationStep.DisplayCheckCode -> CompoundIcons.Computer() is QrCodeConfirmationStep.DisplayVerificationCode -> CompoundIcons.LockSolid() diff --git a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/qrcode/error/QrCodeErrorView.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/qrcode/error/QrCodeErrorView.kt index 26ba62c81c..6f3731bd75 100644 --- a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/qrcode/error/QrCodeErrorView.kt +++ b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/qrcode/error/QrCodeErrorView.kt @@ -45,16 +45,14 @@ fun QrCodeErrorView( onRetry: () -> Unit, modifier: Modifier = Modifier, ) { - BackHandler { - onRetry() - } + BackHandler(onBack = onRetry) FlowStepPage( modifier = modifier, iconStyle = BigIcon.Style.AlertSolid, title = titleText(errorScreenType, appName), subTitle = subtitleText(errorScreenType, appName), content = { Content(errorScreenType) }, - buttons = { Buttons(onRetry) } + buttons = { Buttons(onRetry) }, ) } diff --git a/features/userprofile/shared/src/main/kotlin/io/element/android/features/userprofile/shared/UserProfileView.kt b/features/userprofile/shared/src/main/kotlin/io/element/android/features/userprofile/shared/UserProfileView.kt index 93d93043b8..6fb3e5ccb7 100644 --- a/features/userprofile/shared/src/main/kotlin/io/element/android/features/userprofile/shared/UserProfileView.kt +++ b/features/userprofile/shared/src/main/kotlin/io/element/android/features/userprofile/shared/UserProfileView.kt @@ -7,7 +7,6 @@ package io.element.android.features.userprofile.shared -import androidx.activity.compose.BackHandler import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.consumeWindowInsets @@ -51,7 +50,6 @@ fun UserProfileView( openAvatarPreview: (username: String, url: String) -> Unit, modifier: Modifier = Modifier, ) { - BackHandler { goBack() } Scaffold( modifier = modifier, topBar = { diff --git a/features/userprofile/shared/src/test/kotlin/io/element/android/features/userprofile/UserProfileViewTest.kt b/features/userprofile/shared/src/test/kotlin/io/element/android/features/userprofile/UserProfileViewTest.kt index db444b13a8..6c81acd00a 100644 --- a/features/userprofile/shared/src/test/kotlin/io/element/android/features/userprofile/UserProfileViewTest.kt +++ b/features/userprofile/shared/src/test/kotlin/io/element/android/features/userprofile/UserProfileViewTest.kt @@ -34,7 +34,6 @@ import io.element.android.tests.testutils.ensureCalledOnce import io.element.android.tests.testutils.ensureCalledOnceWithParam import io.element.android.tests.testutils.ensureCalledOnceWithTwoParams import io.element.android.tests.testutils.pressBack -import io.element.android.tests.testutils.pressBackKey import kotlinx.coroutines.test.runTest import org.junit.Rule import org.junit.Test @@ -46,16 +45,6 @@ import org.robolectric.annotation.Config class UserProfileViewTest { @get:Rule val rule = createAndroidComposeRule() - @Test - fun `on back key press - the expected callback is called`() = runTest { - ensureCalledOnce { callback -> - rule.setUserProfileView( - goBack = callback, - ) - rule.pressBackKey() - } - } - @Test fun `on back button click - the expected callback is called`() = runTest { ensureCalledOnce { callback ->