[fenix] Fixes https://github.com/mozilla-mobile/fenix/issues/6408: Pop stack to homeFragment when opening bookmarks from homeFragment

When bookmark fragment is opened from homeFragment, libraryFragment does not
exists so the popBackStack(R.id.libraryFragment, true) would have failed. So
the solution for this was to pop back stack to homeFragment when the
bookmarks/history fragments are opened from homeFragment.
pull/600/head
ValentinTimisica 5 years ago committed by Emily Kager
parent 0ab4fb0e25
commit c7dc1bad43

@ -16,7 +16,9 @@ abstract class LibraryPageFragment<T> : Fragment() {
abstract val selectedItems: Set<T>
protected fun close() {
findNavController().popBackStack(R.id.libraryFragment, true)
if (!findNavController().popBackStack(R.id.libraryFragment, true)) {
findNavController().popBackStack(R.id.homeFragment, false)
}
}
protected fun openItemsInNewTab(private: Boolean = false, toUrl: (T) -> String?) {

Loading…
Cancel
Save