2
0
mirror of https://github.com/fork-maintainers/iceraven-browser synced 2024-11-03 23:15:31 +00:00

Bug 1812736 - Display snackbar when a new tab is added to a collection

This commit is contained in:
gitstart 2023-03-16 11:04:49 +00:00 committed by mergify[bot]
parent f6f1b1a407
commit 14a5666a3f

View File

@ -49,6 +49,7 @@ import mozilla.components.browser.state.selector.findTab
import mozilla.components.browser.state.selector.normalTabs
import mozilla.components.browser.state.selector.privateTabs
import mozilla.components.browser.state.state.BrowserState
import mozilla.components.browser.state.state.TabSessionState
import mozilla.components.browser.state.state.searchEngines
import mozilla.components.browser.state.state.selectedOrDefaultSearchEngine
import mozilla.components.browser.state.store.BrowserStore
@ -163,6 +164,24 @@ class HomeFragment : Fragment() {
}
showRenamedSnackbar()
}
override fun onTabsAdded(tabCollection: TabCollection, sessions: List<TabSessionState>) {
view?.let {
val message = if (sessions.size == 1) {
R.string.create_collection_tab_saved
} else {
R.string.create_collection_tabs_saved
}
FenixSnackbar.make(
view = it,
duration = Snackbar.LENGTH_LONG,
isDisplayedWithBrowserToolbar = false,
)
.setText(it.context.getString(message))
.setAnchorView(snackbarAnchorView)
.show()
}
}
}
private val store: BrowserStore