diff --git a/app/src/main/java/org/mozilla/fenix/browser/BaseBrowserFragment.kt b/app/src/main/java/org/mozilla/fenix/browser/BaseBrowserFragment.kt index e90c70b0a8..b9761c3d16 100644 --- a/app/src/main/java/org/mozilla/fenix/browser/BaseBrowserFragment.kt +++ b/app/src/main/java/org/mozilla/fenix/browser/BaseBrowserFragment.kt @@ -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() private val downloadsFeature = ViewBoundFeatureWrapper() private val shareDownloadsFeature = ViewBoundFeatureWrapper() + private val copyDownloadsFeature = ViewBoundFeatureWrapper() private val appLinksFeature = ViewBoundFeatureWrapper() private val promptsFeature = ViewBoundFeatureWrapper() private val findInPageIntegration = ViewBoundFeatureWrapper() @@ -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, diff --git a/app/src/main/java/org/mozilla/fenix/browser/CustomTabContextMenuCandidate.kt b/app/src/main/java/org/mozilla/fenix/browser/CustomTabContextMenuCandidate.kt index be54beb3a6..eb1c8040c7 100644 --- a/app/src/main/java/org/mozilla/fenix/browser/CustomTabContextMenuCandidate.kt +++ b/app/src/main/java/org/mozilla/fenix/browser/CustomTabContextMenuCandidate.kt @@ -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 = listOf( ContextMenuCandidate.createCopyLinkCandidate( context, diff --git a/app/src/main/java/org/mozilla/fenix/browser/FenixSnackbarDelegate.kt b/app/src/main/java/org/mozilla/fenix/browser/FenixSnackbarDelegate.kt index 12113cd1fb..66bead845b 100644 --- a/app/src/main/java/org/mozilla/fenix/browser/FenixSnackbarDelegate.kt +++ b/app/src/main/java/org/mozilla/fenix/browser/FenixSnackbarDelegate.kt @@ -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,