mirror of
https://github.com/fork-maintainers/iceraven-browser
synced 2024-11-11 13:11:01 +00:00
parent
4954aadd84
commit
8537ff10a8
@ -401,7 +401,7 @@ class HomeFragment : Fragment(), CoroutineScope, AccountObserver {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Suppress("ComplexMethod")
|
@Suppress("ComplexMethod", "NestedBlockDepth")
|
||||||
private fun handleCollectionAction(action: CollectionAction) {
|
private fun handleCollectionAction(action: CollectionAction) {
|
||||||
when (action) {
|
when (action) {
|
||||||
is CollectionAction.Expand -> {
|
is CollectionAction.Expand -> {
|
||||||
@ -429,16 +429,39 @@ class HomeFragment : Fragment(), CoroutineScope, AccountObserver {
|
|||||||
}
|
}
|
||||||
is CollectionAction.OpenTab -> {
|
is CollectionAction.OpenTab -> {
|
||||||
invokePendingDeleteJobs()
|
invokePendingDeleteJobs()
|
||||||
(activity as HomeActivity).openToBrowserAndLoad(
|
context?.let { context ->
|
||||||
searchTermOrURL = action.tab.url,
|
val tabSnapshot = action.tab.restore(context, requireComponents.core.engine, action.tab)
|
||||||
newTab = true,
|
if (tabSnapshot.isEmpty()) {
|
||||||
from = BrowserDirection.FromHome
|
// We were unable to create a snapshot, so just load the tab instead
|
||||||
)
|
(activity as HomeActivity).openToBrowserAndLoad(
|
||||||
|
searchTermOrURL = action.tab.url,
|
||||||
|
newTab = true,
|
||||||
|
from = BrowserDirection.FromHome
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
requireComponents.core.sessionManager.restore(
|
||||||
|
tabSnapshot,
|
||||||
|
true
|
||||||
|
)
|
||||||
|
(activity as HomeActivity).openToBrowser(BrowserDirection.FromHome)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
is CollectionAction.OpenTabs -> {
|
is CollectionAction.OpenTabs -> {
|
||||||
invokePendingDeleteJobs()
|
invokePendingDeleteJobs()
|
||||||
action.collection.tabs.forEach {
|
context?.let { context ->
|
||||||
requireComponents.useCases.tabsUseCases.addTab.invoke(it.url)
|
action.collection.tabs.forEach {
|
||||||
|
val tabSnapshot = it.restore(context, requireComponents.core.engine, it)
|
||||||
|
if (tabSnapshot.isEmpty()) {
|
||||||
|
// We were unable to create a snapshot, so just load the tab instead
|
||||||
|
requireComponents.useCases.tabsUseCases.addTab.invoke(it.url)
|
||||||
|
} else {
|
||||||
|
requireComponents.core.sessionManager.restore(
|
||||||
|
tabSnapshot,
|
||||||
|
requireComponents.core.sessionManager.selectedSession == null
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
is CollectionAction.ShareTabs -> {
|
is CollectionAction.ShareTabs -> {
|
||||||
|
Loading…
Reference in New Issue
Block a user