[fenix] No issue: Fix regression in last tab deleted

When we allow the homescreen to handle undo for the last tab, we no
longer need to handle this ourselves with our own binding.

In the future, we should re-think this logic to be more robust and less
spread out across multiple screens.
pull/600/head
Jonathan Almeida 4 years ago committed by Jonathan Almeida
parent b0d0e1b8c9
commit bc86a34797

@ -71,7 +71,6 @@ class TabsTrayFragment : AppCompatDialogFragment(), TabsTrayInteractor {
private val selectionBannerBinding = ViewBoundFeatureWrapper<SelectionBannerBinding>()
private val selectionHandleBinding = ViewBoundFeatureWrapper<SelectionHandleBinding>()
private val tabsTrayCtaBinding = ViewBoundFeatureWrapper<TabsTrayInfoBannerBinding>()
private val closeOnLastTabBinding = ViewBoundFeatureWrapper<CloseOnLastTabBinding>()
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
@ -253,16 +252,6 @@ class TabsTrayFragment : AppCompatDialogFragment(), TabsTrayInteractor {
owner = this,
view = view
)
closeOnLastTabBinding.set(
feature = CloseOnLastTabBinding(
browserStore = requireComponents.core.store,
tabsTrayStore = tabsTrayStore,
navigationInteractor = navigationInteractor
),
owner = this,
view = view
)
}
override fun setCurrentTrayPosition(position: Int, smoothScroll: Boolean) {
@ -290,9 +279,11 @@ class TabsTrayFragment : AppCompatDialogFragment(), TabsTrayInteractor {
val tab = browserStore.state.findTab(tabId)
tab?.let {
requireComponents.useCases.tabsUseCases.removeTab(tabId)
if (browserStore.state.getNormalOrPrivateTabs(it.content.private).isNotEmpty()) {
if (browserStore.state.getNormalOrPrivateTabs(it.content.private).size != 1) {
requireComponents.useCases.tabsUseCases.removeTab(tabId)
showUndoSnackbarForTab(it)
} else {
dismissTabsTrayAndNavigateHome(tabId)
}
}
}

Loading…
Cancel
Save