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

[fenix] Close https://github.com/mozilla-mobile/fenix/issues/9760: Add external app links context menu candidate

This commit is contained in:
Roger Yang 2020-04-22 15:54:01 -04:00 committed by Emily Kager
parent 51ca89fcf4
commit e85a7bd2ff

View File

@ -16,6 +16,7 @@ import kotlinx.android.synthetic.main.fragment_browser.*
import kotlinx.android.synthetic.main.fragment_browser.view.* import kotlinx.android.synthetic.main.fragment_browser.view.*
import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.ExperimentalCoroutinesApi
import mozilla.components.browser.session.Session import mozilla.components.browser.session.Session
import mozilla.components.feature.app.links.AppLinksUseCases
import mozilla.components.feature.contextmenu.ContextMenuCandidate import mozilla.components.feature.contextmenu.ContextMenuCandidate
import mozilla.components.feature.readerview.ReaderViewFeature import mozilla.components.feature.readerview.ReaderViewFeature
import mozilla.components.feature.search.SearchFeature import mozilla.components.feature.search.SearchFeature
@ -222,13 +223,21 @@ class BrowserFragment : BaseBrowserFragment(), UserInteractionHandler {
override fun getContextMenuCandidates( override fun getContextMenuCandidates(
context: Context, context: Context,
view: View view: View
): List<ContextMenuCandidate> = ContextMenuCandidate.defaultCandidates( ): List<ContextMenuCandidate> {
val contextMenuCandidateAppLinksUseCases = AppLinksUseCases(
requireContext(),
{ true }
)
return ContextMenuCandidate.defaultCandidates(
context, context,
context.components.useCases.tabsUseCases, context.components.useCases.tabsUseCases,
context.components.useCases.contextMenuUseCases, context.components.useCases.contextMenuUseCases,
view, view,
FenixSnackbarDelegate(view) FenixSnackbarDelegate(view)
) ) + ContextMenuCandidate.createOpenInExternalAppCandidate(requireContext(),
contextMenuCandidateAppLinksUseCases)
}
companion object { companion object {
private const val SHARED_TRANSITION_MS = 200L private const val SHARED_TRANSITION_MS = 200L