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

Bug 1809305 - Allow user to copy an image to the clipboard (#948)

* Bug 1809305 - Allow user to copy an image to the clipboard

* Bug 1809305 - Update import & remove unnecessary gradle androidTestImplementation dependency

* Bug 1809305 - PR changes

* Bug 1819746 - Add explicit dependency to support-ktx

* Add buildconfig changes needed after adding support-ktx to componse-engine

---------

Co-authored-by: t-p-white <t-p-white>
Co-authored-by: Christian Sadilek <christian.sadilek@gmail.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
This commit is contained in:
t-p-white 2023-03-06 12:16:22 +00:00 committed by GitHub
parent 77f485baf1
commit 0a34b4b1da
3 changed files with 23 additions and 5 deletions

View File

@ -63,7 +63,8 @@ import mozilla.components.feature.contextmenu.ContextMenuCandidate
import mozilla.components.feature.contextmenu.ContextMenuFeature
import mozilla.components.feature.downloads.DownloadsFeature
import mozilla.components.feature.downloads.manager.FetchDownloadManager
import mozilla.components.feature.downloads.share.ShareDownloadFeature
import mozilla.components.feature.downloads.temporary.CopyDownloadFeature
import mozilla.components.feature.downloads.temporary.ShareDownloadFeature
import mozilla.components.feature.intent.ext.EXTRA_SESSION_ID
import mozilla.components.feature.media.fullscreen.MediaSessionFullscreenFeature
import mozilla.components.feature.privatemode.feature.SecureWindowFeature
@ -189,6 +190,7 @@ abstract class BaseBrowserFragment :
private val contextMenuFeature = ViewBoundFeatureWrapper<ContextMenuFeature>()
private val downloadsFeature = ViewBoundFeatureWrapper<DownloadsFeature>()
private val shareDownloadsFeature = ViewBoundFeatureWrapper<ShareDownloadFeature>()
private val copyDownloadsFeature = ViewBoundFeatureWrapper<CopyDownloadFeature>()
private val appLinksFeature = ViewBoundFeatureWrapper<AppLinksFeature>()
private val promptsFeature = ViewBoundFeatureWrapper<PromptFeature>()
private val findInPageIntegration = ViewBoundFeatureWrapper<FindInPageIntegration>()
@ -487,6 +489,15 @@ abstract class BaseBrowserFragment :
tabId = customTabSessionId,
)
val copyDownloadFeature = CopyDownloadFeature(
context = context.applicationContext,
httpClient = context.components.core.client,
store = store,
tabId = customTabSessionId,
snackbarParent = binding.dynamicSnackbarContainer,
snackbarDelegate = FenixSnackbarDelegate(binding.dynamicSnackbarContainer),
)
val downloadFeature = DownloadsFeature(
context.applicationContext,
store = store,
@ -595,6 +606,12 @@ abstract class BaseBrowserFragment :
view = view,
)
copyDownloadsFeature.set(
copyDownloadFeature,
owner = this,
view = view,
)
downloadsFeature.set(
downloadFeature,
owner = this,

View File

@ -8,7 +8,8 @@ import android.content.Context
import android.view.View
import mozilla.components.feature.contextmenu.ContextMenuCandidate
import mozilla.components.feature.contextmenu.ContextMenuUseCases
import mozilla.components.feature.contextmenu.DefaultSnackbarDelegate
import mozilla.components.support.utils.DefaultSnackbarDelegate
import mozilla.components.support.utils.SnackbarDelegate
class CustomTabContextMenuCandidate {
companion object {
@ -20,7 +21,7 @@ class CustomTabContextMenuCandidate {
context: Context,
contextMenuUseCases: ContextMenuUseCases,
snackBarParentView: View,
snackbarDelegate: ContextMenuCandidate.SnackbarDelegate = DefaultSnackbarDelegate(),
snackbarDelegate: SnackbarDelegate = DefaultSnackbarDelegate(),
): List<ContextMenuCandidate> = listOf(
ContextMenuCandidate.createCopyLinkCandidate(
context,

View File

@ -6,10 +6,10 @@ package org.mozilla.fenix.browser
import android.view.View
import androidx.annotation.StringRes
import mozilla.components.feature.contextmenu.ContextMenuCandidate
import mozilla.components.support.utils.SnackbarDelegate
import org.mozilla.fenix.components.FenixSnackbar
class FenixSnackbarDelegate(private val view: View) : ContextMenuCandidate.SnackbarDelegate {
class FenixSnackbarDelegate(private val view: View) : SnackbarDelegate {
override fun show(
snackBarParentView: View,