For #11918: Take a screenshot when clicking the tab tray
We looked into taking a screenshot right before leaving the BrowserFragment, however this call will always fail since it's non-blocking (we never want it to be blocking too), and we will never receive a screenshot when a session is detached from an EngineView before the callback is complete. In Fenix, we can nicely evade this by taking a screenshot when click the tabs tray icon, which is where you would want to see the most up-to-date thumbnail of the tab and also does not leave the BrowserFragment as well.master
parent
5ecab0f48a
commit
f3b870d356
|
@ -42,6 +42,7 @@ import mozilla.components.browser.state.selector.findTabOrCustomTabOrSelectedTab
|
||||||
import mozilla.components.browser.state.state.SessionState
|
import mozilla.components.browser.state.state.SessionState
|
||||||
import mozilla.components.browser.state.state.content.DownloadState
|
import mozilla.components.browser.state.state.content.DownloadState
|
||||||
import mozilla.components.browser.state.store.BrowserStore
|
import mozilla.components.browser.state.store.BrowserStore
|
||||||
|
import mozilla.components.browser.thumbnails.BrowserThumbnails
|
||||||
import mozilla.components.concept.engine.prompt.ShareData
|
import mozilla.components.concept.engine.prompt.ShareData
|
||||||
import mozilla.components.feature.accounts.FxaCapability
|
import mozilla.components.feature.accounts.FxaCapability
|
||||||
import mozilla.components.feature.accounts.FxaWebChannelFeature
|
import mozilla.components.feature.accounts.FxaWebChannelFeature
|
||||||
|
@ -132,6 +133,7 @@ abstract class BaseBrowserFragment : Fragment(), UserInteractionHandler, Session
|
||||||
get() = _browserToolbarView!!
|
get() = _browserToolbarView!!
|
||||||
|
|
||||||
protected val readerViewFeature = ViewBoundFeatureWrapper<ReaderViewFeature>()
|
protected val readerViewFeature = ViewBoundFeatureWrapper<ReaderViewFeature>()
|
||||||
|
protected val thumbnailsFeature = ViewBoundFeatureWrapper<BrowserThumbnails>()
|
||||||
|
|
||||||
private val sessionFeature = ViewBoundFeatureWrapper<SessionFeature>()
|
private val sessionFeature = ViewBoundFeatureWrapper<SessionFeature>()
|
||||||
private val contextMenuFeature = ViewBoundFeatureWrapper<ContextMenuFeature>()
|
private val contextMenuFeature = ViewBoundFeatureWrapper<ContextMenuFeature>()
|
||||||
|
@ -231,6 +233,7 @@ abstract class BaseBrowserFragment : Fragment(), UserInteractionHandler, Session
|
||||||
tabCollectionStorage = requireComponents.core.tabCollectionStorage,
|
tabCollectionStorage = requireComponents.core.tabCollectionStorage,
|
||||||
topSiteStorage = requireComponents.core.topSiteStorage,
|
topSiteStorage = requireComponents.core.topSiteStorage,
|
||||||
onTabCounterClicked = {
|
onTabCounterClicked = {
|
||||||
|
thumbnailsFeature.get()?.requestScreenshot()
|
||||||
findNavController().nav(
|
findNavController().nav(
|
||||||
R.id.browserFragment,
|
R.id.browserFragment,
|
||||||
BrowserFragmentDirections.actionGlobalTabTrayDialogFragment()
|
BrowserFragmentDirections.actionGlobalTabTrayDialogFragment()
|
||||||
|
|
|
@ -54,7 +54,6 @@ class BrowserFragment : BaseBrowserFragment(), UserInteractionHandler {
|
||||||
|
|
||||||
private val windowFeature = ViewBoundFeatureWrapper<WindowFeature>()
|
private val windowFeature = ViewBoundFeatureWrapper<WindowFeature>()
|
||||||
private val searchFeature = ViewBoundFeatureWrapper<SearchFeature>()
|
private val searchFeature = ViewBoundFeatureWrapper<SearchFeature>()
|
||||||
private val thumbnailsFeature = ViewBoundFeatureWrapper<BrowserThumbnails>()
|
|
||||||
|
|
||||||
private var readerModeAvailable = false
|
private var readerModeAvailable = false
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue