parent
d1aed157dd
commit
7d02354f4f
|
@ -70,7 +70,6 @@ import org.mozilla.fenix.ext.components
|
|||
import org.mozilla.fenix.ext.enterToImmersiveMode
|
||||
import org.mozilla.fenix.ext.nav
|
||||
import org.mozilla.fenix.ext.requireComponents
|
||||
import org.mozilla.fenix.ext.toTab
|
||||
import org.mozilla.fenix.quickactionsheet.QuickActionSheetBehavior
|
||||
import org.mozilla.fenix.settings.SupportUtils
|
||||
import org.mozilla.fenix.utils.Settings
|
||||
|
@ -172,7 +171,6 @@ abstract class BaseBrowserFragment : Fragment(), BackHandler, SessionManager.Obs
|
|||
it.action = Intent.ACTION_VIEW
|
||||
it.flags = Intent.FLAG_ACTIVITY_NEW_TASK
|
||||
},
|
||||
currentSessionAsTab = session.toTab(context!!),
|
||||
bottomSheetBehavior = QuickActionSheetBehavior.from(nestedScrollQuickAction)
|
||||
)
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ import org.mozilla.fenix.collections.getStepForCollectionsSize
|
|||
import org.mozilla.fenix.components.metrics.Event
|
||||
import org.mozilla.fenix.ext.components
|
||||
import org.mozilla.fenix.ext.nav
|
||||
import org.mozilla.fenix.home.sessioncontrol.Tab
|
||||
import org.mozilla.fenix.ext.toTab
|
||||
import org.mozilla.fenix.lib.Do
|
||||
import org.mozilla.fenix.quickactionsheet.QuickActionSheetBehavior
|
||||
|
||||
|
@ -47,7 +47,6 @@ class DefaultBrowserToolbarController(
|
|||
private val viewModel: CreateCollectionViewModel,
|
||||
private val getSupportUrl: () -> String,
|
||||
private val openInFenixIntent: Intent,
|
||||
private val currentSessionAsTab: Tab,
|
||||
private val bottomSheetBehavior: QuickActionSheetBehavior<NestedScrollView>
|
||||
) : BrowserToolbarController {
|
||||
|
||||
|
@ -58,7 +57,7 @@ class DefaultBrowserToolbarController(
|
|||
navController.nav(
|
||||
R.id.browserFragment,
|
||||
BrowserFragmentDirections.actionBrowserFragmentToSearchFragment(
|
||||
customTabSession?.id
|
||||
customTabSession?.id ?: context.components.core.sessionManager.selectedSession?.id
|
||||
)
|
||||
)
|
||||
}
|
||||
|
@ -124,17 +123,19 @@ class DefaultBrowserToolbarController(
|
|||
context.components.analytics.metrics
|
||||
.track(Event.CollectionSaveButtonPressed(TELEMETRY_BROWSER_IDENTIFIER))
|
||||
|
||||
viewModel.tabs = listOf(currentSessionAsTab)
|
||||
val selectedSet = mutableSetOf(currentSessionAsTab)
|
||||
viewModel.selectedTabs = selectedSet
|
||||
viewModel.tabCollections =
|
||||
context.components.core.tabCollectionStorage.cachedTabCollections.reversed()
|
||||
viewModel.saveCollectionStep = viewModel.tabCollections.getStepForCollectionsSize()
|
||||
viewModel.snackbarAnchorView = nestedScrollQuickActionView
|
||||
viewModel.previousFragmentId = R.id.browserFragment
|
||||
currentSession?.toTab(context)?.let {
|
||||
viewModel.tabs = listOf(it)
|
||||
val selectedSet = mutableSetOf(it)
|
||||
viewModel.selectedTabs = selectedSet
|
||||
viewModel.tabCollections =
|
||||
context.components.core.tabCollectionStorage.cachedTabCollections.reversed()
|
||||
viewModel.saveCollectionStep = viewModel.tabCollections.getStepForCollectionsSize()
|
||||
viewModel.snackbarAnchorView = nestedScrollQuickActionView
|
||||
viewModel.previousFragmentId = R.id.browserFragment
|
||||
|
||||
val directions = BrowserFragmentDirections.actionBrowserFragmentToCreateCollectionFragment()
|
||||
navController.nav(R.id.browserFragment, directions)
|
||||
val directions = BrowserFragmentDirections.actionBrowserFragmentToCreateCollectionFragment()
|
||||
navController.nav(R.id.browserFragment, directions)
|
||||
}
|
||||
}
|
||||
ToolbarMenu.Item.OpenInFenix -> {
|
||||
// Release the session from this view so that it can immediately be rendered by a different view
|
||||
|
|
|
@ -11,6 +11,7 @@ import io.mockk.Runs
|
|||
import io.mockk.every
|
||||
import io.mockk.just
|
||||
import io.mockk.mockk
|
||||
import io.mockk.mockkStatic
|
||||
import io.mockk.verify
|
||||
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
||||
import kotlinx.coroutines.ObsoleteCoroutinesApi
|
||||
|
@ -34,6 +35,7 @@ import org.mozilla.fenix.components.metrics.Event
|
|||
import org.mozilla.fenix.components.metrics.MetricController
|
||||
import org.mozilla.fenix.ext.components
|
||||
import org.mozilla.fenix.ext.nav
|
||||
import org.mozilla.fenix.ext.toTab
|
||||
import org.mozilla.fenix.home.sessioncontrol.Tab
|
||||
import org.mozilla.fenix.home.sessioncontrol.TabCollection
|
||||
import org.mozilla.fenix.quickactionsheet.QuickActionSheetBehavior
|
||||
|
@ -73,10 +75,14 @@ class DefaultBrowserToolbarControllerTest {
|
|||
viewModel = viewModel,
|
||||
getSupportUrl = getSupportUrl,
|
||||
openInFenixIntent = openInFenixIntent,
|
||||
currentSessionAsTab = currentSessionAsTab,
|
||||
bottomSheetBehavior = bottomSheetBehavior
|
||||
)
|
||||
|
||||
mockkStatic(
|
||||
"org.mozilla.fenix.ext.SessionKt"
|
||||
)
|
||||
every { any<Session>().toTab(any()) } returns currentSessionAsTab
|
||||
|
||||
every { context.components.analytics } returns analytics
|
||||
every { analytics.metrics } returns metrics
|
||||
every { context.components.useCases.sessionUseCases } returns sessionUseCases
|
||||
|
@ -342,7 +348,6 @@ class DefaultBrowserToolbarControllerTest {
|
|||
viewModel = viewModel,
|
||||
getSupportUrl = getSupportUrl,
|
||||
openInFenixIntent = openInFenixIntent,
|
||||
currentSessionAsTab = currentSessionAsTab,
|
||||
bottomSheetBehavior = bottomSheetBehavior
|
||||
)
|
||||
|
||||
|
|
Loading…
Reference in New Issue