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