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 2bc488126..ed82d6056 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 @@ -325,10 +325,13 @@ class ConversationFragment : SlidingPaneChildFragment() { override fun goBack(): Boolean { sharedViewModel.closeSlidingPaneEvent.value = Event(true) - // 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 } override fun onViewCreated(view: View, savedInstanceState: Bundle?) { diff --git a/app/src/main/java/org/linphone/ui/main/contacts/fragment/ContactFragment.kt b/app/src/main/java/org/linphone/ui/main/contacts/fragment/ContactFragment.kt index 6c23aea4b..1c367094a 100644 --- a/app/src/main/java/org/linphone/ui/main/contacts/fragment/ContactFragment.kt +++ b/app/src/main/java/org/linphone/ui/main/contacts/fragment/ContactFragment.kt @@ -81,10 +81,13 @@ class ContactFragment : SlidingPaneChildFragment() { override fun goBack(): Boolean { sharedViewModel.closeSlidingPaneEvent.value = Event(true) - // If not done this fragment won't be paused, which will cause us issues - val action = ContactFragmentDirections.actionContactFragmentToEmptyFragment() - findNavController().navigate(action) - return true + if (findNavController().currentDestination?.id == R.id.contactFragment) { + // If not done this fragment won't be paused, which will cause us issues + val action = ContactFragmentDirections.actionContactFragmentToEmptyFragment() + findNavController().navigate(action) + return true + } + return false } override fun onViewCreated(view: View, savedInstanceState: Bundle?) { diff --git a/app/src/main/java/org/linphone/ui/main/history/fragment/HistoryFragment.kt b/app/src/main/java/org/linphone/ui/main/history/fragment/HistoryFragment.kt index 13d4d1a67..5bfd18c91 100644 --- a/app/src/main/java/org/linphone/ui/main/history/fragment/HistoryFragment.kt +++ b/app/src/main/java/org/linphone/ui/main/history/fragment/HistoryFragment.kt @@ -64,10 +64,13 @@ class HistoryFragment : SlidingPaneChildFragment() { override fun goBack(): Boolean { sharedViewModel.closeSlidingPaneEvent.value = Event(true) - // If not done this fragment won't be paused, which will cause us issues - val action = HistoryFragmentDirections.actionHistoryFragmentToEmptyFragment() - findNavController().navigate(action) - return true + if (findNavController().currentDestination?.id == R.id.historyFragment) { + // If not done this fragment won't be paused, which will cause us issues + val action = HistoryFragmentDirections.actionHistoryFragmentToEmptyFragment() + findNavController().navigate(action) + return true + } + return false } override fun onCreate(savedInstanceState: Bundle?) { diff --git a/app/src/main/java/org/linphone/ui/main/meetings/fragment/MeetingFragment.kt b/app/src/main/java/org/linphone/ui/main/meetings/fragment/MeetingFragment.kt index 8ed8573be..7b804879c 100644 --- a/app/src/main/java/org/linphone/ui/main/meetings/fragment/MeetingFragment.kt +++ b/app/src/main/java/org/linphone/ui/main/meetings/fragment/MeetingFragment.kt @@ -82,10 +82,13 @@ class MeetingFragment : SlidingPaneChildFragment() { override fun goBack(): Boolean { sharedViewModel.closeSlidingPaneEvent.value = Event(true) - // If not done this fragment won't be paused, which will cause us issues - val action = MeetingFragmentDirections.actionMeetingFragmentToEmptyFragment() - findNavController().navigate(action) - return true + if (findNavController().currentDestination?.id == R.id.meetingFragment) { + // If not done this fragment won't be paused, which will cause us issues + val action = MeetingFragmentDirections.actionMeetingFragmentToEmptyFragment() + findNavController().navigate(action) + return true + } + return false } override fun onViewCreated(view: View, savedInstanceState: Bundle?) {