diff --git a/app/src/main/java/org/mozilla/fenix/components/Components.kt b/app/src/main/java/org/mozilla/fenix/components/Components.kt index 99edbce77a..e4f721cfc7 100644 --- a/app/src/main/java/org/mozilla/fenix/components/Components.kt +++ b/app/src/main/java/org/mozilla/fenix/components/Components.kt @@ -73,6 +73,7 @@ class Components(private val context: Context) { core.store, useCases.sessionUseCases, useCases.tabsUseCases, + useCases.customTabsUseCases, useCases.searchUseCases, core.relationChecker, core.customTabsStore, diff --git a/app/src/main/java/org/mozilla/fenix/components/IntentProcessors.kt b/app/src/main/java/org/mozilla/fenix/components/IntentProcessors.kt index 25bce31633..a2d35af89e 100644 --- a/app/src/main/java/org/mozilla/fenix/components/IntentProcessors.kt +++ b/app/src/main/java/org/mozilla/fenix/components/IntentProcessors.kt @@ -15,6 +15,7 @@ import mozilla.components.feature.pwa.intent.TrustedWebActivityIntentProcessor import mozilla.components.feature.pwa.intent.WebAppIntentProcessor import mozilla.components.feature.search.SearchUseCases import mozilla.components.feature.session.SessionUseCases +import mozilla.components.feature.tabs.CustomTabsUseCases import mozilla.components.feature.tabs.TabsUseCases import mozilla.components.service.digitalassetlinks.RelationChecker import mozilla.components.support.migration.MigrationIntentProcessor @@ -35,6 +36,7 @@ class IntentProcessors( private val store: BrowserStore, private val sessionUseCases: SessionUseCases, private val tabsUseCases: TabsUseCases, + private val customTabsUseCases: CustomTabsUseCases, private val searchUseCases: SearchUseCases, private val relationChecker: RelationChecker, private val customTabsStore: CustomTabsServiceStore, @@ -56,11 +58,11 @@ class IntentProcessors( } val customTabIntentProcessor by lazyMonitored { - CustomTabIntentProcessor(sessionManager, sessionUseCases.loadUrl, context.resources, isPrivate = false) + CustomTabIntentProcessor(customTabsUseCases.add, context.resources, isPrivate = false) } val privateCustomTabIntentProcessor by lazyMonitored { - CustomTabIntentProcessor(sessionManager, sessionUseCases.loadUrl, context.resources, isPrivate = true) + CustomTabIntentProcessor(customTabsUseCases.add, context.resources, isPrivate = true) } val externalAppIntentProcessors by lazyMonitored { diff --git a/app/src/main/java/org/mozilla/fenix/components/UseCases.kt b/app/src/main/java/org/mozilla/fenix/components/UseCases.kt index 40250e646a..956cda377c 100644 --- a/app/src/main/java/org/mozilla/fenix/components/UseCases.kt +++ b/app/src/main/java/org/mozilla/fenix/components/UseCases.kt @@ -18,6 +18,7 @@ import mozilla.components.feature.search.ext.toDefaultSearchEngineProvider import mozilla.components.feature.session.SessionUseCases import mozilla.components.feature.session.SettingsUseCases import mozilla.components.feature.session.TrackingProtectionUseCases +import mozilla.components.feature.tabs.CustomTabsUseCases import mozilla.components.feature.tabs.TabsUseCases import mozilla.components.feature.top.sites.TopSitesStorage import mozilla.components.feature.top.sites.TopSitesUseCases @@ -48,6 +49,13 @@ class UseCases( */ val tabsUseCases: TabsUseCases by lazyMonitored { TabsUseCases(store, sessionManager) } + /** + * Use cases for managing custom tabs. + */ + val customTabsUseCases: CustomTabsUseCases by lazyMonitored { + CustomTabsUseCases(sessionManager, sessionUseCases.loadUrl) + } + /** * Use cases that provide search engine integration. */ diff --git a/app/src/main/java/org/mozilla/fenix/customtabs/CustomTabsIntegration.kt b/app/src/main/java/org/mozilla/fenix/customtabs/CustomTabsIntegration.kt index 4752744723..04e902d519 100644 --- a/app/src/main/java/org/mozilla/fenix/customtabs/CustomTabsIntegration.kt +++ b/app/src/main/java/org/mozilla/fenix/customtabs/CustomTabsIntegration.kt @@ -11,6 +11,7 @@ import mozilla.components.browser.state.store.BrowserStore import mozilla.components.browser.toolbar.BrowserToolbar import mozilla.components.browser.toolbar.display.DisplayToolbar import mozilla.components.feature.customtabs.CustomTabsToolbarFeature +import mozilla.components.feature.tabs.CustomTabsUseCases import mozilla.components.support.base.feature.LifecycleAwareFeature import mozilla.components.support.base.feature.UserInteractionHandler import org.mozilla.fenix.R @@ -20,6 +21,7 @@ import org.mozilla.fenix.ext.settings class CustomTabsIntegration( sessionManager: SessionManager, store: BrowserStore, + useCases: CustomTabsUseCases, toolbar: BrowserToolbar, sessionId: String, activity: Activity, @@ -84,9 +86,10 @@ class CustomTabsIntegration( } private val feature = CustomTabsToolbarFeature( - sessionManager, + store, toolbar, sessionId, + useCases, menuBuilder = customTabToolbarMenu.menuBuilder, menuItemIndex = START_OF_MENU_ITEMS_INDEX, window = activity.window, diff --git a/app/src/main/java/org/mozilla/fenix/customtabs/ExternalAppBrowserFragment.kt b/app/src/main/java/org/mozilla/fenix/customtabs/ExternalAppBrowserFragment.kt index 0cc439d94b..9b86bdf855 100644 --- a/app/src/main/java/org/mozilla/fenix/customtabs/ExternalAppBrowserFragment.kt +++ b/app/src/main/java/org/mozilla/fenix/customtabs/ExternalAppBrowserFragment.kt @@ -66,6 +66,7 @@ class ExternalAppBrowserFragment : BaseBrowserFragment(), UserInteractionHandler feature = CustomTabsIntegration( sessionManager = requireComponents.core.sessionManager, store = requireComponents.core.store, + useCases = requireComponents.useCases.customTabsUseCases, toolbar = toolbar, sessionId = customTabSessionId, activity = activity, diff --git a/buildSrc/src/main/java/AndroidComponents.kt b/buildSrc/src/main/java/AndroidComponents.kt index f0de55ece1..ffc7fbc8e9 100644 --- a/buildSrc/src/main/java/AndroidComponents.kt +++ b/buildSrc/src/main/java/AndroidComponents.kt @@ -3,5 +3,5 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ object AndroidComponents { - const val VERSION = "71.0.20210114143040" + const val VERSION = "71.0.20210117143132" }