diff --git a/app/src/main/java/org/linphone/ui/main/chat/fragment/ConversationFragment.kt b/app/src/main/java/org/linphone/ui/main/chat/fragment/ConversationFragment.kt index dc477869f..1ef931273 100644 --- a/app/src/main/java/org/linphone/ui/main/chat/fragment/ConversationFragment.kt +++ b/app/src/main/java/org/linphone/ui/main/chat/fragment/ConversationFragment.kt @@ -389,16 +389,20 @@ open class ConversationFragment : SlidingPaneChildFragment() { } override fun goBack(): Boolean { - sharedViewModel.closeSlidingPaneEvent.value = Event(true) - sharedViewModel.displayedChatRoom = null + if (!findNavController().popBackStack()) { + sharedViewModel.closeSlidingPaneEvent.value = Event(true) + sharedViewModel.displayedChatRoom = null - if (findNavController().currentDestination?.id == R.id.conversationFragment) { - // If not done this fragment won't be paused, which will cause us issues - val action = ConversationFragmentDirections.actionConversationFragmentToEmptyFragment() - findNavController().navigate(action) - return true + if (findNavController().currentDestination?.id == R.id.conversationFragment) { + // If not done this fragment won't be paused, which will cause us issues + val action = + ConversationFragmentDirections.actionConversationFragmentToEmptyFragment() + findNavController().navigate(action) + return true + } + return false } - return false + return true } override fun onViewCreated(view: View, savedInstanceState: Bundle?) {