Skip to content
This repository has been archived by the owner on Feb 20, 2023. It is now read-only.

Commit

Permalink
For #12414 - Support sharing images through ShareDownloadFeature
Browse files Browse the repository at this point in the history
Register a ViewBoundFeatureWrapper<ShareDownloadFeature> that will respond to
"Share image" from the browser contextual menu
  • Loading branch information
Mugurell committed Feb 3, 2021
1 parent fedc2e1 commit 40fc9c1
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions app/src/main/java/org/mozilla/fenix/browser/BaseBrowserFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ 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.intent.ext.EXTRA_SESSION_ID
import mozilla.components.feature.media.fullscreen.MediaSessionFullscreenFeature
import mozilla.components.feature.privatemode.feature.SecureWindowFeature
Expand Down Expand Up @@ -161,6 +162,7 @@ abstract class BaseBrowserFragment : Fragment(), UserInteractionHandler, Activit
private val sessionFeature = ViewBoundFeatureWrapper<SessionFeature>()
private val contextMenuFeature = ViewBoundFeatureWrapper<ContextMenuFeature>()
private val downloadsFeature = ViewBoundFeatureWrapper<DownloadsFeature>()
private val shareDownloadsFeature = ViewBoundFeatureWrapper<ShareDownloadFeature>()
private val appLinksFeature = ViewBoundFeatureWrapper<AppLinksFeature>()
private val promptsFeature = ViewBoundFeatureWrapper<PromptFeature>()
private val findInPageIntegration = ViewBoundFeatureWrapper<FindInPageIntegration>()
Expand Down Expand Up @@ -429,6 +431,13 @@ abstract class BaseBrowserFragment : Fragment(), UserInteractionHandler, Activit
)
}

val shareDownloadFeature = ShareDownloadFeature(
context = context.applicationContext,
httpClient = context.components.core.client,
store = store,
tabId = customTabSessionId
)

val downloadFeature = DownloadsFeature(
context.applicationContext,
store = store,
Expand Down Expand Up @@ -508,6 +517,12 @@ abstract class BaseBrowserFragment : Fragment(), UserInteractionHandler, Activit
store, view, context, toolbarHeight
)

shareDownloadsFeature.set(
shareDownloadFeature,
owner = this,
view = view
)

downloadsFeature.set(
downloadFeature,
owner = this,
Expand Down

0 comments on commit 40fc9c1

Please sign in to comment.