From 060cd646c8616b82466b87881e3d778b8064697e Mon Sep 17 00:00:00 2001 From: James Hugman Date: Fri, 31 May 2019 16:08:13 +0100 Subject: [PATCH] Fixes #1570 - Enable app-links feature --- CHANGELOG.md | 1 + app/build.gradle | 1 + .../org/mozilla/fenix/browser/BrowserFragment.kt | 14 ++++++++++++++ buildSrc/src/main/java/Dependencies.kt | 1 + 4 files changed, 17 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e6011974a..639e47aa1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -54,6 +54,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - #225 - Adds the ability to delete all browsing data - #2903 - Fixed crash when trying to rate the app on a devices without the play store app. - #2419 - Adds a deletion state to the history component +- #1570 - Enables the opening of links by other apps. ### Changed - #2673 - Fixed can't upload files using third party apps from the file manager. diff --git a/app/build.gradle b/app/build.gradle index ddaadbbbb..272cc94ff 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -294,6 +294,7 @@ dependencies { implementation Deps.mozilla_browser_toolbar implementation Deps.mozilla_feature_accounts + implementation Deps.mozilla_feature_app_links implementation Deps.mozilla_feature_awesomebar implementation Deps.mozilla_feature_contextmenu implementation Deps.mozilla_feature_customtabs diff --git a/app/src/main/java/org/mozilla/fenix/browser/BrowserFragment.kt b/app/src/main/java/org/mozilla/fenix/browser/BrowserFragment.kt index c6644af1f..0e73966a7 100644 --- a/app/src/main/java/org/mozilla/fenix/browser/BrowserFragment.kt +++ b/app/src/main/java/org/mozilla/fenix/browser/BrowserFragment.kt @@ -34,6 +34,7 @@ import kotlinx.coroutines.runBlocking import mozilla.appservices.places.BookmarkRoot import mozilla.components.browser.session.Session import mozilla.components.browser.session.SessionManager +import mozilla.components.feature.app.links.AppLinksFeature import mozilla.components.feature.contextmenu.ContextMenuCandidate import mozilla.components.feature.contextmenu.ContextMenuFeature import mozilla.components.feature.downloads.DownloadsFeature @@ -92,6 +93,7 @@ import kotlin.coroutines.CoroutineContext @SuppressWarnings("TooManyFunctions", "LargeClass") class BrowserFragment : Fragment(), BackHandler, CoroutineScope { + private lateinit var toolbarComponent: ToolbarComponent private var sessionObserver: Session.Observer? = null @@ -100,6 +102,7 @@ class BrowserFragment : Fragment(), BackHandler, CoroutineScope { private val sessionFeature = ViewBoundFeatureWrapper() private val contextMenuFeature = ViewBoundFeatureWrapper() private val downloadsFeature = ViewBoundFeatureWrapper() + private val appLinksFeature = ViewBoundFeatureWrapper() private val promptsFeature = ViewBoundFeatureWrapper() private val findInPageIntegration = ViewBoundFeatureWrapper() private val toolbarIntegration = ViewBoundFeatureWrapper() @@ -224,6 +227,17 @@ class BrowserFragment : Fragment(), BackHandler, CoroutineScope { view = view ) + appLinksFeature.set( + feature = AppLinksFeature( + requireContext(), + sessionManager = sessionManager, + sessionId = customTabSessionId, + fragmentManager = requireFragmentManager() + ), + owner = this, + view = view + ) + promptsFeature.set( feature = PromptFeature( fragment = this, diff --git a/buildSrc/src/main/java/Dependencies.kt b/buildSrc/src/main/java/Dependencies.kt index 19ac2756c..5311f6be8 100644 --- a/buildSrc/src/main/java/Dependencies.kt +++ b/buildSrc/src/main/java/Dependencies.kt @@ -97,6 +97,7 @@ object Deps { const val mozilla_browser_storage_sync = "org.mozilla.components:browser-storage-sync:${Versions.mozilla_android_components}" const val mozilla_feature_accounts = "org.mozilla.components:feature-accounts:${Versions.mozilla_android_components}" + const val mozilla_feature_app_links = "org.mozilla.components:feature-app-links:${Versions.mozilla_android_components}" const val mozilla_feature_awesomebar = "org.mozilla.components:feature-awesomebar:${Versions.mozilla_android_components}" const val mozilla_feature_contextmenu = "org.mozilla.components:feature-contextmenu:${Versions.mozilla_android_components}" const val mozilla_feature_customtabs = "org.mozilla.components:feature-customtabs:${Versions.mozilla_android_components}"