[fenix] For https://github.com/mozilla-mobile/fenix/issues/4877: Restored logic for closing tabs when not on browserFragment

Added return in function when saving collections coming from browser fragment
pull/600/head
mihai-adrian 5 years ago committed by Emily Kager
parent 3c746c4b5c
commit ed24b8b0f1

@ -187,11 +187,10 @@ class CreateCollectionFragment : DialogFragment() {
private fun closeTabsIfNecessary(tabs: List<Tab>) {
// Only close the tabs if the user is not on the BrowserFragment
if (viewModel.previousFragmentId == R.id.browserFragment) {
if (viewModel.previousFragmentId == R.id.browserFragment) { return }
val components = requireComponents
tabs.asSequence()
.mapNotNull { tab -> components.core.sessionManager.findSessionById(tab.sessionId) }
.forEach { session -> components.useCases.tabsUseCases.removeTab(session) }
}
}
}

Loading…
Cancel
Save