2
0
mirror of https://github.com/fork-maintainers/iceraven-browser synced 2024-11-17 15:26:23 +00:00
This commit is contained in:
codrut.topliceanu 2020-09-14 15:48:25 +03:00 committed by ekager
parent 780ec96d7e
commit 26583d2e05
2 changed files with 7 additions and 4 deletions

View File

@ -92,6 +92,7 @@ class BrowserToolbarView(
with(container.context) { with(container.context) {
val sessionManager = components.core.sessionManager val sessionManager = components.core.sessionManager
val isPinningSupported = components.useCases.webAppUseCases.isPinningSupported()
if (toolbarPosition == ToolbarPosition.TOP) { if (toolbarPosition == ToolbarPosition.TOP) {
val offsetChangedListener = val offsetChangedListener =
@ -173,7 +174,8 @@ class BrowserToolbarView(
lifecycleOwner = lifecycleOwner, lifecycleOwner = lifecycleOwner,
sessionManager = sessionManager, sessionManager = sessionManager,
store = components.core.store, store = components.core.store,
bookmarksStorage = bookmarkStorage bookmarksStorage = bookmarkStorage,
isPinningSupported = isPinningSupported
) )
view.display.setMenuDismissAction { view.display.setMenuDismissAction {
view.invalidateActions() view.invalidateActions()

View File

@ -50,7 +50,8 @@ class DefaultToolbarMenu(
shouldReverseItems: Boolean, shouldReverseItems: Boolean,
private val onItemTapped: (ToolbarMenu.Item) -> Unit = {}, private val onItemTapped: (ToolbarMenu.Item) -> Unit = {},
private val lifecycleOwner: LifecycleOwner, private val lifecycleOwner: LifecycleOwner,
private val bookmarksStorage: BookmarksStorage private val bookmarksStorage: BookmarksStorage,
val isPinningSupported: Boolean
) : ToolbarMenu { ) : ToolbarMenu {
private var currentUrlIsBookmarked = false private var currentUrlIsBookmarked = false
@ -153,11 +154,11 @@ class DefaultToolbarMenu(
// Predicates that need to be repeatedly called as the session changes // Predicates that need to be repeatedly called as the session changes
private fun canAddToHomescreen(): Boolean = private fun canAddToHomescreen(): Boolean =
session != null && context.components.useCases.webAppUseCases.isPinningSupported() && session != null && isPinningSupported &&
!context.components.useCases.webAppUseCases.isInstallable() !context.components.useCases.webAppUseCases.isInstallable()
private fun canInstall(): Boolean = private fun canInstall(): Boolean =
session != null && context.components.useCases.webAppUseCases.isPinningSupported() && session != null && isPinningSupported &&
context.components.useCases.webAppUseCases.isInstallable() context.components.useCases.webAppUseCases.isInstallable()
private fun shouldShowOpenInApp(): Boolean = session?.let { session -> private fun shouldShowOpenInApp(): Boolean = session?.let { session ->