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

Reload restored tabs from collection (#16865)

This commit is contained in:
Elise Richards 2020-12-07 11:32:27 -06:00 committed by GitHub
parent 69545cf946
commit 948db6f77b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 1 deletions

View File

@ -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,

View File

@ -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(

View File

@ -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