From 9f9af5e2f7cadeb78bac93357075b89e0457e7f3 Mon Sep 17 00:00:00 2001 From: k1ngsterr1 Date: Sat, 24 Jan 2026 22:10:06 +0500 Subject: [PATCH] feat: Implement back button handling in ProfileScreen to navigate to chat list --- .../messenger/ui/settings/ProfileScreen.kt | 28 ++++++++----------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/app/src/main/java/com/rosetta/messenger/ui/settings/ProfileScreen.kt b/app/src/main/java/com/rosetta/messenger/ui/settings/ProfileScreen.kt index ee10245..a28865b 100644 --- a/app/src/main/java/com/rosetta/messenger/ui/settings/ProfileScreen.kt +++ b/app/src/main/java/com/rosetta/messenger/ui/settings/ProfileScreen.kt @@ -6,6 +6,7 @@ import android.content.ClipboardManager import android.content.Context import android.net.Uri import android.util.Log +import androidx.activity.compose.BackHandler import androidx.activity.compose.rememberLauncherForActivityResult import androidx.activity.result.contract.ActivityResultContracts import androidx.compose.animation.* @@ -343,6 +344,11 @@ fun ProfileScreen( LaunchedEffect(editedName, editedUsername) { hasChanges = editedName != accountName || editedUsername != accountUsername } + + // Handle back button press - navigate to chat list instead of closing app + BackHandler { + onBack() + } Box( modifier = Modifier @@ -1067,22 +1073,12 @@ private fun TelegramBiometricItem( Spacer(modifier = Modifier.width(20.dp)) - Column(modifier = Modifier.weight(1f)) { - Text( - text = "Biometric Authentication", - fontSize = 16.sp, - color = textColor - ) - - if (isEnabled) { - Text( - text = "Face ID / Touch ID", - fontSize = 13.sp, - color = textColor.copy(alpha = 0.5f), - modifier = Modifier.padding(top = 2.dp) - ) - } - } + Text( + text = "Biometric Authentication", + fontSize = 16.sp, + color = textColor, + modifier = Modifier.weight(1f) + ) // iOS-style animated switch val animatedThumbOffset by animateFloatAsState(