feat: enable onBackInvokedCallback in AndroidManifest and refine back handling in ChatsListScreen

This commit is contained in:
k1ngsterr1
2026-02-12 20:19:39 +05:00
parent e208ce050a
commit 899d79c9fd
2 changed files with 4 additions and 7 deletions

View File

@@ -14,7 +14,7 @@
<application <application
android:name=".RosettaApplication" android:name=".RosettaApplication"
android:allowBackup="true" android:allowBackup="true"
android:enableOnBackInvokedCallback="false" android:enableOnBackInvokedCallback="true"
android:dataExtractionRules="@xml/data_extraction_rules" android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules" android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher" android:icon="@mipmap/ic_launcher"

View File

@@ -288,16 +288,13 @@ fun ChatsListScreen(
val mutedChats by preferencesManager.mutedChatsForAccount(accountPublicKey) val mutedChats by preferencesManager.mutedChatsForAccount(accountPublicKey)
.collectAsState(initial = emptySet()) .collectAsState(initial = emptySet())
val activity = context as? android.app.Activity // Back: drawer → закрыть, selection → сбросить
// Когда ничего не открыто — НЕ перехватываем, система сама закроет приложение корректно
// Всегда перехватываем back чтобы predictive back анимация не ломала UI BackHandler(enabled = isSelectionMode || drawerState.isOpen) {
BackHandler(enabled = true) {
if (isSelectionMode) { if (isSelectionMode) {
selectedChatKeys = emptySet() selectedChatKeys = emptySet()
} else if (drawerState.isOpen) { } else if (drawerState.isOpen) {
scope.launch { drawerState.close() } scope.launch { drawerState.close() }
} else {
activity?.moveTaskToBack(true)
} }
} }