Bug 1904921 - Fix Tabs Tray not scrolling to the active tab on first open r=android-reviewers,calu

Differential Revision: https://phabricator.services.mozilla.com/D215572
This commit is contained in:
Noah Bond 2024-07-03 22:49:51 +00:00
parent b1b635d41d
commit cfbca7dc06

View File

@ -50,6 +50,7 @@ import org.mozilla.fenix.databinding.ComponentTabstrayFabBinding
import org.mozilla.fenix.databinding.FragmentTabTrayDialogBinding
import org.mozilla.fenix.databinding.TabsTrayTabCounter2Binding
import org.mozilla.fenix.databinding.TabstrayMultiselectItemsBinding
import org.mozilla.fenix.ext.actualInactiveTabs
import org.mozilla.fenix.ext.components
import org.mozilla.fenix.ext.requireComponents
import org.mozilla.fenix.ext.runIfFragmentIsAttached
@ -150,14 +151,19 @@ class TabsTrayFragment : AppCompatDialogFragment() {
val initialPage = args.page
val activity = activity as HomeActivity
val initialInactiveExpanded = requireComponents.appStore.state.inactiveTabsExpanded
val inactiveTabs = requireComponents.core.store.state.actualInactiveTabs(requireContext().settings())
val normalTabs = requireComponents.core.store.state.normalTabs - inactiveTabs.toSet()
tabsTrayStore = StoreProvider.get(this) {
TabsTrayStore(
initialState = TabsTrayState(
selectedPage = initialPage,
mode = initialMode,
selectedTabId = requireComponents.core.store.state.selectedTabId,
inactiveTabs = inactiveTabs,
inactiveTabsExpanded = initialInactiveExpanded,
normalTabs = normalTabs,
privateTabs = requireComponents.core.store.state.privateTabs,
selectedTabId = requireComponents.core.store.state.selectedTabId,
),
middlewares = listOf(
TabsTrayMiddleware(),