Unverified Commit 948db6f7 authored by Elise Richards's avatar Elise Richards Committed by GitHub
Browse files

Reload restored tabs from collection (#16865)

parent 69545cf9
......@@ -237,6 +237,7 @@ class HomeFragment : Fragment() {
sessionManager = sessionManager,
tabCollectionStorage = components.core.tabCollectionStorage,
addTabUseCase = components.useCases.tabsUseCases.addTab,
reloadUrlUseCase = components.useCases.sessionUseCases.reload,
fragmentStore = homeFragmentStore,
navController = findNavController(),
viewLifecycleScope = viewLifecycleOwner.lifecycleScope,
......
......@@ -16,6 +16,7 @@ import mozilla.components.browser.state.state.selectedOrDefaultSearchEngine
import mozilla.components.browser.state.store.BrowserStore
import mozilla.components.concept.engine.Engine
import mozilla.components.concept.engine.prompt.ShareData
import mozilla.components.feature.session.SessionUseCases
import mozilla.components.feature.tab.collections.TabCollection
import mozilla.components.feature.tab.collections.ext.restore
import mozilla.components.feature.tabs.TabsUseCases
......@@ -176,6 +177,7 @@ class DefaultSessionControlController(
private val store: BrowserStore,
private val tabCollectionStorage: TabCollectionStorage,
private val addTabUseCase: TabsUseCases.AddNewTabUseCase,
private val reloadUrlUseCase: SessionUseCases.ReloadUrlUseCase,
private val fragmentStore: HomeFragmentStore,
private val navController: NavController,
private val viewLifecycleScope: CoroutineScope,
......@@ -212,6 +214,7 @@ class DefaultSessionControlController(
tab,
onTabRestored = {
activity.openToBrowser(BrowserDirection.FromHome)
reloadUrlUseCase.invoke(sessionManager.selectedSession)
},
onFailure = {
activity.openToBrowserAndLoad(
......
......@@ -18,6 +18,7 @@ import mozilla.components.browser.state.state.BrowserState
import mozilla.components.browser.state.state.SearchState
import mozilla.components.browser.state.store.BrowserStore
import mozilla.components.concept.engine.Engine
import mozilla.components.feature.session.SessionUseCases
import mozilla.components.feature.tab.collections.TabCollection
import mozilla.components.feature.tabs.TabsUseCases
import mozilla.components.feature.top.sites.TopSite
......@@ -57,6 +58,7 @@ class DefaultSessionControlControllerTest {
private val engine: Engine = mockk(relaxed = true)
private val tabCollectionStorage: TabCollectionStorage = mockk(relaxed = true)
private val tabsUseCases: TabsUseCases = mockk(relaxed = true)
private val reloadUrlUseCase: SessionUseCases = mockk(relaxed = true)
private val hideOnboarding: () -> Unit = mockk(relaxed = true)
private val registerCollectionStorageObserver: () -> Unit = mockk(relaxed = true)
private val showTabTray: () -> Unit = mockk(relaxed = true)
......@@ -115,6 +117,7 @@ class DefaultSessionControlControllerTest {
sessionManager = sessionManager,
tabCollectionStorage = tabCollectionStorage,
addTabUseCase = tabsUseCases.addTab,
reloadUrlUseCase = reloadUrlUseCase.reload,
fragmentStore = fragmentStore,
navController = navController,
viewLifecycleScope = scope,
......@@ -142,7 +145,9 @@ class DefaultSessionControlControllerTest {
verify { metrics.track(Event.CollectionAddTabPressed) }
verify {
navController.navigate(
match<NavDirections> { it.actionId == R.id.action_global_collectionCreationFragment },
match<NavDirections> {
it.actionId == R.id.action_global_collectionCreationFragment
},
null
)
}
......@@ -178,6 +183,7 @@ class DefaultSessionControlControllerTest {
verify { metrics.track(Event.CollectionTabRestored) }
verify { activity.openToBrowser(BrowserDirection.FromHome) }
verify { reloadUrlUseCase.reload }
}
@Test
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment