Remove SessionManager dependency from CustomTabsIntegration.
This commit is contained in:
parent
854a5e676f
commit
28c105dcb3
|
@ -6,7 +6,6 @@ package org.mozilla.fenix.customtabs
|
|||
|
||||
import android.app.Activity
|
||||
import androidx.appcompat.content.res.AppCompatResources.getDrawable
|
||||
import mozilla.components.browser.session.SessionManager
|
||||
import mozilla.components.browser.state.store.BrowserStore
|
||||
import mozilla.components.browser.toolbar.BrowserToolbar
|
||||
import mozilla.components.browser.toolbar.display.DisplayToolbar
|
||||
|
@ -19,7 +18,6 @@ import org.mozilla.fenix.components.toolbar.ToolbarMenu
|
|||
import org.mozilla.fenix.ext.settings
|
||||
|
||||
class CustomTabsIntegration(
|
||||
sessionManager: SessionManager,
|
||||
store: BrowserStore,
|
||||
useCases: CustomTabsUseCases,
|
||||
toolbar: BrowserToolbar,
|
||||
|
@ -61,16 +59,6 @@ class CustomTabsIntegration(
|
|||
// If in private mode, override toolbar background to use private color
|
||||
// See #5334
|
||||
if (isPrivate) {
|
||||
sessionManager.findSessionById(sessionId)?.apply {
|
||||
val config = customTabConfig
|
||||
customTabConfig = config?.copy(
|
||||
// Don't set toolbar background automatically
|
||||
toolbarColor = null,
|
||||
// Force tinting the action button
|
||||
actionButtonConfig = config.actionButtonConfig?.copy(tint = true)
|
||||
)
|
||||
}
|
||||
|
||||
toolbar.background = getDrawable(activity, R.drawable.toolbar_background)
|
||||
}
|
||||
}
|
||||
|
@ -94,7 +82,9 @@ class CustomTabsIntegration(
|
|||
menuItemIndex = START_OF_MENU_ITEMS_INDEX,
|
||||
window = activity.window,
|
||||
shareListener = { onItemTapped.invoke(ToolbarMenu.Item.Share) },
|
||||
closeListener = { activity.finishAndRemoveTask() }
|
||||
closeListener = { activity.finishAndRemoveTask() },
|
||||
updateToolbarBackground = !isPrivate,
|
||||
forceActionButtonTinting = isPrivate
|
||||
)
|
||||
|
||||
override fun start() = feature.start()
|
||||
|
|
|
@ -61,7 +61,6 @@ class ExternalAppBrowserFragment : BaseBrowserFragment(), UserInteractionHandler
|
|||
|
||||
customTabsIntegration.set(
|
||||
feature = CustomTabsIntegration(
|
||||
sessionManager = requireComponents.core.sessionManager,
|
||||
store = requireComponents.core.store,
|
||||
useCases = requireComponents.useCases.customTabsUseCases,
|
||||
toolbar = toolbar,
|
||||
|
|
Loading…
Reference in New Issue
Block a user