From f3e904310c0194a463d146359db67c8ee508b5fc Mon Sep 17 00:00:00 2001 From: Sagar Date: Sat, 11 Jan 2025 20:06:29 +0530 Subject: [PATCH] Fix TopBar visibility reset after onResume in MultiSelect --- .../securesms/main/MainActivityListHostFragment.kt | 4 ++++ .../securesms/stories/tabs/ConversationListTabsViewModel.kt | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/app/src/main/java/org/thoughtcrime/securesms/main/MainActivityListHostFragment.kt b/app/src/main/java/org/thoughtcrime/securesms/main/MainActivityListHostFragment.kt index 5a79ed541bc..33a6eaffa2d 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/main/MainActivityListHostFragment.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/main/MainActivityListHostFragment.kt @@ -176,6 +176,10 @@ class MainActivityListHostFragment : Fragment(R.layout.main_activity_list_host_f .findViewById(R.id.fragment_container) .findNavController() .addOnDestinationChangedListener(destinationChangedListener) + + if(conversationListTabsViewModel.isMultiSelectOpen()) { + presentToolbarForMultiselect() + } } override fun onPause() { diff --git a/app/src/main/java/org/thoughtcrime/securesms/stories/tabs/ConversationListTabsViewModel.kt b/app/src/main/java/org/thoughtcrime/securesms/stories/tabs/ConversationListTabsViewModel.kt index c5c116256cf..0f8a3d69c92 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/stories/tabs/ConversationListTabsViewModel.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/stories/tabs/ConversationListTabsViewModel.kt @@ -74,6 +74,10 @@ class ConversationListTabsViewModel(startingTab: ConversationListTab, repository performStoreUpdate { it.copy(visibilityState = it.visibilityState.copy(isMultiSelectOpen = true)) } } + fun isMultiSelectOpen(): Boolean { + return store.state.visibilityState.isMultiSelectOpen + } + fun onMultiSelectFinished() { performStoreUpdate { it.copy(visibilityState = it.visibilityState.copy(isMultiSelectOpen = false)) } }