* Revert "For #26790 - Dismiss search dialog when opening recent bookmark dropdown menu" This reverts commit262aa16991
. * Revert "For #26790 - Dismiss search dialog when opening recent visit dropdown menu" This reverts commitb93b0850
* Revert "For #26790 - Dismiss search dialog when opening recent tab dropdown menu" This reverts commit44b71bb590
. * Revert "For #26690 - Dismiss search dialog when opening recent synced tab dropdown menu" This reverts commitbda817a608
. * For #26957 - Remove code to dismiss search dialog when interacting with homescreen top sites * For #26957 - Remove code to dismiss search dialog when interacting with homescreen collection * For #26957 - Remove code to dismiss search dialog when interacting with homescreen recent visits * For #26957 - Remove code to dismiss search dialog when interacting with homescreen recent tabs * For #26957 - Remove code to dismiss search dialog when interacting with homescreen recent bookmarks * For #26957 - Remove code to dismiss search dialog when interacting with pocket stories * For #26957 - Dismiss search dialog when interacting with home fragment Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
This commit is contained in:
parent
df4e08ff38
commit
4ee62ddfe7
|
@ -390,6 +390,7 @@ class SettingsSearchTest {
|
|||
|
||||
// Expected for app language set to Arabic
|
||||
@Test
|
||||
@Ignore("Failing after changing SearchDialog homescreen interaction. See: https://github.com/mozilla-mobile/fenix/issues/28182")
|
||||
fun verifySearchEnginesWithRTLLocale() {
|
||||
homeScreen {
|
||||
}.openThreeDotMenu {
|
||||
|
@ -430,6 +431,7 @@ class SettingsSearchTest {
|
|||
|
||||
// Expected for en-us defaults
|
||||
@Test
|
||||
@Ignore("Failing after changing SearchDialog homescreen interaction. See: https://github.com/mozilla-mobile/fenix/issues/28182")
|
||||
fun toggleSearchEnginesShortcutListTest() {
|
||||
homeScreen {
|
||||
}.openThreeDotMenu {
|
||||
|
|
|
@ -417,7 +417,6 @@ class HomeFragment : Fragment() {
|
|||
pocketStoriesController = DefaultPocketStoriesController(
|
||||
homeActivity = activity,
|
||||
appStore = components.appStore,
|
||||
navController = findNavController(),
|
||||
),
|
||||
)
|
||||
|
||||
|
|
|
@ -0,0 +1,57 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
package org.mozilla.fenix.home
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.Rect
|
||||
import android.util.AttributeSet
|
||||
import android.view.MotionEvent
|
||||
import android.view.MotionEvent.ACTION_UP
|
||||
import androidx.coordinatorlayout.widget.CoordinatorLayout
|
||||
import androidx.navigation.findNavController
|
||||
import mozilla.components.support.ktx.android.view.findViewInHierarchy
|
||||
import org.mozilla.fenix.R
|
||||
import org.mozilla.fenix.search.SearchDialogFragment
|
||||
|
||||
/**
|
||||
* Parent layout for [HomeFragment], used to dismiss the [SearchDialogFragment] when
|
||||
* interacting with elements in the [HomeFragment].
|
||||
*/
|
||||
class HomeFragmentLayout @JvmOverloads constructor(
|
||||
context: Context,
|
||||
attrs: AttributeSet? = null,
|
||||
defStyleAttr: Int = 0,
|
||||
) : CoordinatorLayout(context, attrs, defStyleAttr) {
|
||||
|
||||
/**
|
||||
* Returns whether or not the motion event is touching the private browsing button.
|
||||
*
|
||||
* @param x X coordinate of the event.
|
||||
* @param y Y coordinate of the event.
|
||||
*/
|
||||
private fun isTouchingPrivateButton(x: Float, y: Float): Boolean {
|
||||
val view = this.findViewInHierarchy {
|
||||
it.id == R.id.privateBrowsingButton
|
||||
} ?: return false
|
||||
val privateButtonRect = Rect()
|
||||
view.getHitRect(privateButtonRect)
|
||||
return privateButtonRect.contains(x.toInt(), y.toInt())
|
||||
}
|
||||
|
||||
override fun onInterceptTouchEvent(ev: MotionEvent?): Boolean {
|
||||
val nav = findNavController()
|
||||
|
||||
// If the private button is touched from the [SearchDialogFragment], then it should not be
|
||||
// dismissed to allow the user to continue the search.
|
||||
if (ev?.action == ACTION_UP &&
|
||||
nav.currentDestination?.id == R.id.searchDialogFragment &&
|
||||
!isTouchingPrivateButton(ev.x, ev.y)
|
||||
) {
|
||||
nav.popBackStack()
|
||||
}
|
||||
|
||||
return super.onInterceptTouchEvent(ev)
|
||||
}
|
||||
}
|
|
@ -62,17 +62,15 @@ private val expandedCollectionShape = RoundedCornerShape(topStart = 8.dp, topEnd
|
|||
* @param menuItems List of [CollectionMenuItem] to be shown in a menu.
|
||||
* @param onToggleCollectionExpanded Invoked when the user clicks on the collection.
|
||||
* @param onCollectionShareTabsClicked Invoked when the user clicks to share the collection.
|
||||
* @param onCollectionMenuOpened Invoked when the user clicks to open a menu for the collection.
|
||||
*/
|
||||
@Composable
|
||||
@Suppress("LongParameterList", "LongMethod")
|
||||
@Suppress("LongMethod")
|
||||
fun Collection(
|
||||
collection: TabCollection,
|
||||
expanded: Boolean,
|
||||
menuItems: List<CollectionMenuItem>,
|
||||
onToggleCollectionExpanded: (TabCollection, Boolean) -> Unit,
|
||||
onCollectionShareTabsClicked: (TabCollection) -> Unit,
|
||||
onCollectionMenuOpened: () -> Unit,
|
||||
) {
|
||||
var isMenuExpanded by remember(collection) { mutableStateOf(false) }
|
||||
val isExpanded by remember(collection) { mutableStateOf(expanded) }
|
||||
|
@ -131,7 +129,6 @@ fun Collection(
|
|||
IconButton(
|
||||
onClick = {
|
||||
isMenuExpanded = !isMenuExpanded
|
||||
onCollectionMenuOpened()
|
||||
},
|
||||
) {
|
||||
Icon(
|
||||
|
@ -165,7 +162,6 @@ private fun CollectionDarkPreview() {
|
|||
menuItems = emptyList(),
|
||||
onToggleCollectionExpanded = { _, _ -> },
|
||||
onCollectionShareTabsClicked = {},
|
||||
onCollectionMenuOpened = {},
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -180,7 +176,6 @@ private fun CollectionDarkExpandedPreview() {
|
|||
menuItems = emptyList(),
|
||||
onToggleCollectionExpanded = { _, _ -> },
|
||||
onCollectionShareTabsClicked = {},
|
||||
onCollectionMenuOpened = {},
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -195,7 +190,6 @@ private fun CollectionLightPreview() {
|
|||
menuItems = emptyList(),
|
||||
onToggleCollectionExpanded = { _, _ -> },
|
||||
onCollectionShareTabsClicked = {},
|
||||
onCollectionMenuOpened = {},
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -210,7 +204,6 @@ private fun CollectionLightExpandedPreview() {
|
|||
menuItems = emptyList(),
|
||||
onToggleCollectionExpanded = { _, _ -> },
|
||||
onCollectionShareTabsClicked = {},
|
||||
onCollectionMenuOpened = {},
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -67,7 +67,6 @@ class CollectionViewHolder(
|
|||
menuItems = menuItems,
|
||||
onToggleCollectionExpanded = interactor::onToggleCollectionExpanded,
|
||||
onCollectionShareTabsClicked = interactor::onCollectionShareTabsClicked,
|
||||
onCollectionMenuOpened = interactor::onCollectionMenuOpened,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
|
||||
package org.mozilla.fenix.home.pocket
|
||||
|
||||
import androidx.annotation.VisibleForTesting
|
||||
import androidx.navigation.NavController
|
||||
import mozilla.components.service.glean.private.NoExtras
|
||||
import mozilla.components.service.pocket.PocketStory
|
||||
import mozilla.components.service.pocket.PocketStory.PocketRecommendedStory
|
||||
|
@ -15,7 +13,6 @@ import org.mozilla.fenix.BrowserDirection
|
|||
import org.mozilla.fenix.GleanMetrics.Pings
|
||||
import org.mozilla.fenix.GleanMetrics.Pocket
|
||||
import org.mozilla.fenix.HomeActivity
|
||||
import org.mozilla.fenix.R
|
||||
import org.mozilla.fenix.components.AppStore
|
||||
import org.mozilla.fenix.components.appstate.AppAction
|
||||
|
||||
|
@ -73,12 +70,10 @@ interface PocketStoriesController {
|
|||
*
|
||||
* @param homeActivity [HomeActivity] used to open URLs in a new tab.
|
||||
* @param appStore [AppStore] from which to read the current Pocket recommendations and dispatch new actions on.
|
||||
* @param navController [NavController] used for navigation.
|
||||
*/
|
||||
internal class DefaultPocketStoriesController(
|
||||
private val homeActivity: HomeActivity,
|
||||
private val appStore: AppStore,
|
||||
private val navController: NavController,
|
||||
) : PocketStoriesController {
|
||||
override fun handleStoryShown(
|
||||
storyShown: PocketStory,
|
||||
|
@ -153,7 +148,6 @@ internal class DefaultPocketStoriesController(
|
|||
storyClicked: PocketStory,
|
||||
storyPosition: Pair<Int, Int>,
|
||||
) {
|
||||
dismissSearchDialogIfDisplayed()
|
||||
homeActivity.openToBrowserAndLoad(storyClicked.url, true, BrowserDirection.FromHome)
|
||||
|
||||
when (storyClicked) {
|
||||
|
@ -179,21 +173,12 @@ internal class DefaultPocketStoriesController(
|
|||
}
|
||||
|
||||
override fun handleLearnMoreClicked(link: String) {
|
||||
dismissSearchDialogIfDisplayed()
|
||||
homeActivity.openToBrowserAndLoad(link, true, BrowserDirection.FromHome)
|
||||
Pocket.homeRecsLearnMoreClicked.record(NoExtras())
|
||||
}
|
||||
|
||||
override fun handleDiscoverMoreClicked(link: String) {
|
||||
dismissSearchDialogIfDisplayed()
|
||||
homeActivity.openToBrowserAndLoad(link, true, BrowserDirection.FromHome)
|
||||
Pocket.homeRecsDiscoverClicked.record(NoExtras())
|
||||
}
|
||||
|
||||
@VisibleForTesting(otherwise = VisibleForTesting.PRIVATE)
|
||||
internal fun dismissSearchDialogIfDisplayed() {
|
||||
if (navController.currentDestination?.id == R.id.searchDialogFragment) {
|
||||
navController.navigateUp()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
|
||||
package org.mozilla.fenix.home.recentbookmarks.controller
|
||||
|
||||
import androidx.annotation.VisibleForTesting
|
||||
import androidx.annotation.VisibleForTesting.Companion.PRIVATE
|
||||
import androidx.navigation.NavController
|
||||
import mozilla.appservices.places.BookmarkRoot
|
||||
import mozilla.components.concept.engine.EngineSession
|
||||
|
@ -13,7 +11,6 @@ import mozilla.components.concept.engine.EngineSession.LoadUrlFlags.Companion.AL
|
|||
import org.mozilla.fenix.BrowserDirection
|
||||
import org.mozilla.fenix.GleanMetrics.RecentBookmarks
|
||||
import org.mozilla.fenix.HomeActivity
|
||||
import org.mozilla.fenix.R
|
||||
import org.mozilla.fenix.components.AppStore
|
||||
import org.mozilla.fenix.components.appstate.AppAction
|
||||
import org.mozilla.fenix.home.HomeFragmentDirections
|
||||
|
@ -40,11 +37,6 @@ interface RecentBookmarksController {
|
|||
* @see [RecentBookmarksInteractor.onRecentBookmarkRemoved]
|
||||
*/
|
||||
fun handleBookmarkRemoved(bookmark: RecentBookmark)
|
||||
|
||||
/**
|
||||
* @see [RecentBookmarksInteractor.onRecentBookmarkLongClicked]
|
||||
*/
|
||||
fun handleBookmarkLongClicked()
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -57,7 +49,6 @@ class DefaultRecentBookmarksController(
|
|||
) : RecentBookmarksController {
|
||||
|
||||
override fun handleBookmarkClicked(bookmark: RecentBookmark) {
|
||||
dismissSearchDialogIfDisplayed()
|
||||
activity.openToBrowserAndLoad(
|
||||
searchTermOrURL = bookmark.url!!,
|
||||
newTab = true,
|
||||
|
@ -69,7 +60,6 @@ class DefaultRecentBookmarksController(
|
|||
|
||||
override fun handleShowAllBookmarksClicked() {
|
||||
RecentBookmarks.showAllBookmarks.add()
|
||||
dismissSearchDialogIfDisplayed()
|
||||
navController.navigate(
|
||||
HomeFragmentDirections.actionGlobalBookmarkFragment(BookmarkRoot.Mobile.id),
|
||||
)
|
||||
|
@ -78,15 +68,4 @@ class DefaultRecentBookmarksController(
|
|||
override fun handleBookmarkRemoved(bookmark: RecentBookmark) {
|
||||
appStore.dispatch(AppAction.RemoveRecentBookmark(bookmark))
|
||||
}
|
||||
|
||||
override fun handleBookmarkLongClicked() {
|
||||
dismissSearchDialogIfDisplayed()
|
||||
}
|
||||
|
||||
@VisibleForTesting(otherwise = PRIVATE)
|
||||
fun dismissSearchDialogIfDisplayed() {
|
||||
if (navController.currentDestination?.id == R.id.searchDialogFragment) {
|
||||
navController.navigateUp()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,9 +33,4 @@ interface RecentBookmarksInteractor {
|
|||
* @param bookmark The bookmark that has been removed.
|
||||
*/
|
||||
fun onRecentBookmarkRemoved(bookmark: RecentBookmark)
|
||||
|
||||
/**
|
||||
* Called when the user long clicks a recent bookmark.
|
||||
*/
|
||||
fun onRecentBookmarkLongClicked()
|
||||
}
|
||||
|
|
|
@ -70,7 +70,6 @@ private val imageModifier = Modifier
|
|||
* @param menuItems List of [RecentBookmarksMenuItem] shown when long clicking a [RecentBookmarkItem]
|
||||
* @param backgroundColor The background [Color] of each bookmark.
|
||||
* @param onRecentBookmarkClick Invoked when the user clicks on a recent bookmark.
|
||||
* @param onRecentBookmarkLongClick Invoked when the user long clicks on a recent bookmark.
|
||||
*/
|
||||
@OptIn(ExperimentalComposeUiApi::class)
|
||||
@Composable
|
||||
|
@ -79,7 +78,6 @@ fun RecentBookmarks(
|
|||
menuItems: List<RecentBookmarksMenuItem>,
|
||||
backgroundColor: Color,
|
||||
onRecentBookmarkClick: (RecentBookmark) -> Unit = {},
|
||||
onRecentBookmarkLongClick: () -> Unit = {},
|
||||
) {
|
||||
LazyRow(
|
||||
modifier = Modifier.semantics {
|
||||
|
@ -95,7 +93,6 @@ fun RecentBookmarks(
|
|||
menuItems = menuItems,
|
||||
backgroundColor = backgroundColor,
|
||||
onRecentBookmarkClick = onRecentBookmarkClick,
|
||||
onRecentBookmarkLongClick = onRecentBookmarkLongClick,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -108,7 +105,6 @@ fun RecentBookmarks(
|
|||
* @param menuItems The list of [RecentBookmarksMenuItem] shown when long clicking on the recent bookmark item.
|
||||
* @param backgroundColor The background [Color] of the recent bookmark item.
|
||||
* @param onRecentBookmarkClick Invoked when the user clicks on the recent bookmark item.
|
||||
* @param onRecentBookmarkLongClick Invoked when the user long clicks on the recent bookmark item.
|
||||
*/
|
||||
@OptIn(
|
||||
ExperimentalFoundationApi::class,
|
||||
|
@ -120,7 +116,6 @@ private fun RecentBookmarkItem(
|
|||
menuItems: List<RecentBookmarksMenuItem>,
|
||||
backgroundColor: Color,
|
||||
onRecentBookmarkClick: (RecentBookmark) -> Unit = {},
|
||||
onRecentBookmarkLongClick: () -> Unit = {},
|
||||
) {
|
||||
var isMenuExpanded by remember { mutableStateOf(false) }
|
||||
|
||||
|
@ -130,10 +125,7 @@ private fun RecentBookmarkItem(
|
|||
.combinedClickable(
|
||||
enabled = true,
|
||||
onClick = { onRecentBookmarkClick(bookmark) },
|
||||
onLongClick = {
|
||||
onRecentBookmarkLongClick()
|
||||
isMenuExpanded = true
|
||||
},
|
||||
onLongClick = { isMenuExpanded = true },
|
||||
),
|
||||
shape = cardShape,
|
||||
backgroundColor = backgroundColor,
|
||||
|
|
|
@ -14,7 +14,6 @@ import androidx.compose.ui.platform.ComposeView
|
|||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.lifecycle.LifecycleOwner
|
||||
import androidx.navigation.findNavController
|
||||
import org.mozilla.fenix.R
|
||||
import org.mozilla.fenix.compose.ComposeViewHolder
|
||||
import org.mozilla.fenix.compose.home.HomeSectionHeader
|
||||
|
@ -38,13 +37,6 @@ class RecentBookmarksHeaderViewHolder(
|
|||
composeView.setPadding(horizontalPadding, 0, horizontalPadding, 0)
|
||||
}
|
||||
|
||||
private fun dismissSearchDialogIfDisplayed() {
|
||||
val navController = itemView.findNavController()
|
||||
if (navController.currentDestination?.id == R.id.searchDialogFragment) {
|
||||
navController.navigateUp()
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
override fun Content() {
|
||||
Column {
|
||||
|
@ -54,7 +46,6 @@ class RecentBookmarksHeaderViewHolder(
|
|||
headerText = stringResource(R.string.recently_saved_title),
|
||||
description = stringResource(R.string.recently_saved_show_all_content_description_2),
|
||||
onShowAllClick = {
|
||||
dismissSearchDialogIfDisplayed()
|
||||
interactor.onShowAllBookmarksClicked()
|
||||
},
|
||||
)
|
||||
|
|
|
@ -48,7 +48,6 @@ class RecentBookmarksViewHolder(
|
|||
onClick = { bookmark -> interactor.onRecentBookmarkRemoved(bookmark) },
|
||||
),
|
||||
),
|
||||
onRecentBookmarkLongClick = interactor::onRecentBookmarkLongClicked,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,11 +25,6 @@ interface RecentSyncedTabController {
|
|||
*/
|
||||
fun handleRecentSyncedTabClick(tab: RecentSyncedTab)
|
||||
|
||||
/**
|
||||
* @see [RecentSyncedTabInteractor.onRecentSyncedTabLongClick]
|
||||
*/
|
||||
fun handleRecentSyncedTabLongClick()
|
||||
|
||||
/**
|
||||
* @see [RecentSyncedTabInteractor.onRecentSyncedTabClicked]
|
||||
*/
|
||||
|
@ -71,12 +66,6 @@ class DefaultRecentSyncedTabController(
|
|||
)
|
||||
}
|
||||
|
||||
override fun handleRecentSyncedTabLongClick() {
|
||||
if (navController.currentDestination?.id == R.id.searchDialogFragment) {
|
||||
navController.navigateUp()
|
||||
}
|
||||
}
|
||||
|
||||
override fun handleRecentSyncedTabRemoved(tab: RecentSyncedTab) {
|
||||
appStore.dispatch(AppAction.RemoveRecentSyncedTab(tab))
|
||||
}
|
||||
|
|
|
@ -17,11 +17,6 @@ interface RecentSyncedTabInteractor {
|
|||
*/
|
||||
fun onRecentSyncedTabClicked(tab: RecentSyncedTab)
|
||||
|
||||
/**
|
||||
* Called when opening the dropdown menu on a recent synced tab by long press.
|
||||
*/
|
||||
fun onRecentSyncedTabLongClick()
|
||||
|
||||
/**
|
||||
* Opens the tabs tray to the synced tab page. Called when a user clicks on the "See all synced
|
||||
* tabs" button.
|
||||
|
|
|
@ -63,7 +63,6 @@ import org.mozilla.fenix.theme.FirefoxTheme
|
|||
* @param onRecentSyncedTabClick Invoked when the user clicks on the recent synced tab.
|
||||
* @param onSeeAllSyncedTabsButtonClick Invoked when user clicks on the "See all" button in the synced tab card.
|
||||
* @param onRemoveSyncedTab Invoked when user clicks on the "Remove" dropdown menu option.
|
||||
* @param onRecentSyncedTabLongClick Invoked when user long presses the recent synced tab.
|
||||
*/
|
||||
@OptIn(ExperimentalFoundationApi::class)
|
||||
@Suppress("LongMethod", "LongParameterList")
|
||||
|
@ -76,7 +75,6 @@ fun RecentSyncedTab(
|
|||
onRecentSyncedTabClick: (RecentSyncedTab) -> Unit,
|
||||
onSeeAllSyncedTabsButtonClick: () -> Unit,
|
||||
onRemoveSyncedTab: (RecentSyncedTab) -> Unit,
|
||||
onRecentSyncedTabLongClick: () -> Unit,
|
||||
) {
|
||||
var isDropdownExpanded by remember { mutableStateOf(false) }
|
||||
|
||||
|
@ -91,10 +89,7 @@ fun RecentSyncedTab(
|
|||
.height(180.dp)
|
||||
.combinedClickable(
|
||||
onClick = { tab?.let { onRecentSyncedTabClick(tab) } },
|
||||
onLongClick = {
|
||||
onRecentSyncedTabLongClick()
|
||||
isDropdownExpanded = true
|
||||
},
|
||||
onLongClick = { isDropdownExpanded = true },
|
||||
),
|
||||
shape = RoundedCornerShape(8.dp),
|
||||
backgroundColor = backgroundColor,
|
||||
|
@ -292,7 +287,6 @@ private fun LoadedRecentSyncedTab() {
|
|||
onRecentSyncedTabClick = {},
|
||||
onSeeAllSyncedTabsButtonClick = {},
|
||||
onRemoveSyncedTab = {},
|
||||
onRecentSyncedTabLongClick = {},
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -307,7 +301,6 @@ private fun LoadingRecentSyncedTab() {
|
|||
onRecentSyncedTabClick = {},
|
||||
onSeeAllSyncedTabsButtonClick = {},
|
||||
onRemoveSyncedTab = {},
|
||||
onRecentSyncedTabLongClick = {},
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -77,7 +77,6 @@ class RecentSyncedTabViewHolder(
|
|||
onRecentSyncedTabClick = recentSyncedTabInteractor::onRecentSyncedTabClicked,
|
||||
onSeeAllSyncedTabsButtonClick = recentSyncedTabInteractor::onSyncedTabShowAllClicked,
|
||||
onRemoveSyncedTab = recentSyncedTabInteractor::onRemovedRecentSyncedTab,
|
||||
onRecentSyncedTabLongClick = recentSyncedTabInteractor::onRecentSyncedTabLongClick,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
|
||||
package org.mozilla.fenix.home.recenttabs.controller
|
||||
|
||||
import androidx.annotation.VisibleForTesting
|
||||
import androidx.annotation.VisibleForTesting.Companion.PRIVATE
|
||||
import androidx.navigation.NavController
|
||||
import mozilla.components.browser.state.store.BrowserStore
|
||||
import mozilla.components.feature.tabs.TabsUseCases.SelectTabUseCase
|
||||
|
@ -29,11 +27,6 @@ interface RecentTabController {
|
|||
*/
|
||||
fun handleRecentTabClicked(tabId: String)
|
||||
|
||||
/**
|
||||
* @see [RecentTabInteractor.onRecentTabLongClicked]
|
||||
*/
|
||||
fun handleRecentTabLongClicked()
|
||||
|
||||
/**
|
||||
* @see [RecentTabInteractor.onRecentTabShowAllClicked]
|
||||
*/
|
||||
|
@ -69,12 +62,7 @@ class DefaultRecentTabsController(
|
|||
navController.navigate(R.id.browserFragment)
|
||||
}
|
||||
|
||||
override fun handleRecentTabLongClicked() {
|
||||
dismissSearchDialogIfDisplayed()
|
||||
}
|
||||
|
||||
override fun handleRecentTabShowAllClicked() {
|
||||
dismissSearchDialogIfDisplayed()
|
||||
RecentTabs.showAllClicked.record(NoExtras())
|
||||
navController.navigate(HomeFragmentDirections.actionGlobalTabsTrayFragment())
|
||||
}
|
||||
|
@ -82,11 +70,4 @@ class DefaultRecentTabsController(
|
|||
override fun handleRecentTabRemoved(tab: RecentTab.Tab) {
|
||||
appStore.dispatch(AppAction.RemoveRecentTab(tab))
|
||||
}
|
||||
|
||||
@VisibleForTesting(otherwise = PRIVATE)
|
||||
fun dismissSearchDialogIfDisplayed() {
|
||||
if (navController.currentDestination?.id == R.id.searchDialogFragment) {
|
||||
navController.navigateUp()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,11 +17,6 @@ interface RecentTabInteractor {
|
|||
*/
|
||||
fun onRecentTabClicked(tabId: String)
|
||||
|
||||
/**
|
||||
* Called when the user long clicks on a recent tab.
|
||||
*/
|
||||
fun onRecentTabLongClicked()
|
||||
|
||||
/**
|
||||
* Show the tabs tray. Called when a user clicks on the "Show all" button besides the recent
|
||||
* tabs.
|
||||
|
|
|
@ -50,7 +50,6 @@ class RecentTabViewHolder(
|
|||
recentTabs = recentTabs.value ?: emptyList(),
|
||||
backgroundColor = wallpaperState.wallpaperCardColor,
|
||||
onRecentTabClick = { recentTabInteractor.onRecentTabClicked(it) },
|
||||
onRecentTabLongClick = { recentTabInteractor.onRecentTabLongClicked() },
|
||||
menuItems = listOf(
|
||||
RecentTabMenuItem(
|
||||
title = stringResource(id = R.string.recent_tab_menu_item_remove),
|
||||
|
|
|
@ -81,7 +81,6 @@ fun RecentTabs(
|
|||
menuItems: List<RecentTabMenuItem>,
|
||||
backgroundColor: Color = FirefoxTheme.colors.layer2,
|
||||
onRecentTabClick: (String) -> Unit = {},
|
||||
onRecentTabLongClick: () -> Unit = {},
|
||||
) {
|
||||
Column(
|
||||
modifier = Modifier
|
||||
|
@ -100,7 +99,6 @@ fun RecentTabs(
|
|||
menuItems = menuItems,
|
||||
backgroundColor = backgroundColor,
|
||||
onRecentTabClick = onRecentTabClick,
|
||||
onRecentTabLongClick = onRecentTabLongClick,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -126,7 +124,6 @@ private fun RecentTabItem(
|
|||
menuItems: List<RecentTabMenuItem>,
|
||||
backgroundColor: Color,
|
||||
onRecentTabClick: (String) -> Unit = {},
|
||||
onRecentTabLongClick: () -> Unit = {},
|
||||
) {
|
||||
var isMenuExpanded by remember { mutableStateOf(false) }
|
||||
|
||||
|
@ -137,10 +134,7 @@ private fun RecentTabItem(
|
|||
.combinedClickable(
|
||||
enabled = true,
|
||||
onClick = { onRecentTabClick(tab.state.id) },
|
||||
onLongClick = {
|
||||
onRecentTabLongClick()
|
||||
isMenuExpanded = true
|
||||
},
|
||||
onLongClick = { isMenuExpanded = true },
|
||||
),
|
||||
shape = RoundedCornerShape(8.dp),
|
||||
backgroundColor = backgroundColor,
|
||||
|
|
|
@ -14,7 +14,6 @@ import androidx.compose.ui.platform.ComposeView
|
|||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.lifecycle.LifecycleOwner
|
||||
import androidx.navigation.findNavController
|
||||
import org.mozilla.fenix.R
|
||||
import org.mozilla.fenix.compose.ComposeViewHolder
|
||||
import org.mozilla.fenix.compose.home.HomeSectionHeader
|
||||
|
@ -37,13 +36,6 @@ class RecentTabsHeaderViewHolder(
|
|||
composeView.setPadding(horizontalPadding, 0, horizontalPadding, 0)
|
||||
}
|
||||
|
||||
private fun dismissSearchDialogIfDisplayed() {
|
||||
val navController = itemView.findNavController()
|
||||
if (navController.currentDestination?.id == R.id.searchDialogFragment) {
|
||||
navController.navigateUp()
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
override fun Content() {
|
||||
Column {
|
||||
|
@ -53,7 +45,6 @@ class RecentTabsHeaderViewHolder(
|
|||
headerText = stringResource(R.string.recent_tabs_header),
|
||||
description = stringResource(R.string.recent_tabs_show_all_content_description_2),
|
||||
onShowAllClick = {
|
||||
dismissSearchDialogIfDisplayed()
|
||||
interactor.onRecentTabShowAllClicked()
|
||||
},
|
||||
)
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
|
||||
package org.mozilla.fenix.home.recentvisits.controller
|
||||
|
||||
import androidx.annotation.VisibleForTesting
|
||||
import androidx.annotation.VisibleForTesting.Companion.PRIVATE
|
||||
import androidx.navigation.NavController
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.launch
|
||||
|
@ -60,11 +58,6 @@ interface RecentVisitsController {
|
|||
* @param highlightUrl Url of the [RecentHistoryHighlight] to remove.
|
||||
*/
|
||||
fun handleRemoveRecentHistoryHighlight(highlightUrl: String)
|
||||
|
||||
/**
|
||||
* Callback for when the user long clicks on a recent visit.
|
||||
*/
|
||||
fun handleRecentVisitLongClicked()
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -83,7 +76,6 @@ class DefaultRecentVisitsController(
|
|||
* Shows the history fragment.
|
||||
*/
|
||||
override fun handleHistoryShowAllClicked() {
|
||||
dismissSearchDialogIfDisplayed()
|
||||
navController.navigate(
|
||||
HomeFragmentDirections.actionGlobalHistoryFragment(),
|
||||
)
|
||||
|
@ -144,18 +136,4 @@ class DefaultRecentVisitsController(
|
|||
storage.deleteHistoryMetadataForUrl(highlightUrl)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Dismiss the search dialog if displayed.
|
||||
*/
|
||||
override fun handleRecentVisitLongClicked() {
|
||||
dismissSearchDialogIfDisplayed()
|
||||
}
|
||||
|
||||
@VisibleForTesting(otherwise = PRIVATE)
|
||||
fun dismissSearchDialogIfDisplayed() {
|
||||
if (navController.currentDestination?.id == R.id.searchDialogFragment) {
|
||||
navController.navigateUp()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,9 +44,4 @@ interface RecentVisitsInteractor {
|
|||
* @param highlightUrl [RecentHistoryHighlight.url] of the item to remove.
|
||||
*/
|
||||
fun onRemoveRecentHistoryHighlight(highlightUrl: String)
|
||||
|
||||
/**
|
||||
* Called when opening the dropdown menu on a recent visit by long press.
|
||||
*/
|
||||
fun onRecentVisitLongClicked()
|
||||
}
|
||||
|
|
|
@ -70,7 +70,6 @@ private const val VISITS_PER_COLUMN = 3
|
|||
* @param menuItems List of [RecentVisitMenuItem] shown long clicking a [RecentlyVisitedItem].
|
||||
* @param backgroundColor The background [Color] of each item.
|
||||
* @param onRecentVisitClick Invoked when the user clicks on a recent visit.
|
||||
* @param onRecentVisitLongClick Invoked when the user long clicks on a recent visit.
|
||||
*/
|
||||
@OptIn(ExperimentalComposeUiApi::class)
|
||||
@Composable
|
||||
|
@ -79,7 +78,6 @@ fun RecentlyVisited(
|
|||
menuItems: List<RecentVisitMenuItem>,
|
||||
backgroundColor: Color = FirefoxTheme.colors.layer2,
|
||||
onRecentVisitClick: (RecentlyVisitedItem, Int) -> Unit = { _, _ -> },
|
||||
onRecentVisitLongClick: () -> Unit = {},
|
||||
) {
|
||||
Card(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
|
@ -116,7 +114,6 @@ fun RecentlyVisited(
|
|||
onRecentVisitClick = {
|
||||
onRecentVisitClick(it, pageIndex + 1)
|
||||
},
|
||||
onRecentVisitLongClick = { onRecentVisitLongClick() },
|
||||
)
|
||||
is RecentHistoryGroup -> RecentlyVisitedHistoryGroup(
|
||||
recentVisit = recentVisit,
|
||||
|
@ -126,7 +123,6 @@ fun RecentlyVisited(
|
|||
onRecentVisitClick = {
|
||||
onRecentVisitClick(it, pageIndex + 1)
|
||||
},
|
||||
onRecentVisitLongClick = { onRecentVisitLongClick() },
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -144,13 +140,11 @@ fun RecentlyVisited(
|
|||
* @param clickableEnabled Whether click actions should be invoked or not.
|
||||
* @param showDividerLine Whether to show a divider line at the bottom.
|
||||
* @param onRecentVisitClick Invoked when the user clicks on a recent visit.
|
||||
* @param onRecentVisitClick Invoked when the user long clicks on a recently visited group.
|
||||
*/
|
||||
@OptIn(
|
||||
ExperimentalFoundationApi::class,
|
||||
ExperimentalComposeUiApi::class,
|
||||
)
|
||||
@Suppress("LongParameterList")
|
||||
@Composable
|
||||
private fun RecentlyVisitedHistoryGroup(
|
||||
recentVisit: RecentHistoryGroup,
|
||||
|
@ -158,7 +152,6 @@ private fun RecentlyVisitedHistoryGroup(
|
|||
clickableEnabled: Boolean,
|
||||
showDividerLine: Boolean,
|
||||
onRecentVisitClick: (RecentHistoryGroup) -> Unit = { _ -> },
|
||||
onRecentVisitLongClick: () -> Unit = {},
|
||||
) {
|
||||
var isMenuExpanded by remember { mutableStateOf(false) }
|
||||
|
||||
|
@ -167,10 +160,7 @@ private fun RecentlyVisitedHistoryGroup(
|
|||
.combinedClickable(
|
||||
enabled = clickableEnabled,
|
||||
onClick = { onRecentVisitClick(recentVisit) },
|
||||
onLongClick = {
|
||||
onRecentVisitLongClick()
|
||||
isMenuExpanded = true
|
||||
},
|
||||
onLongClick = { isMenuExpanded = true },
|
||||
)
|
||||
.size(268.dp, 56.dp)
|
||||
.semantics {
|
||||
|
@ -233,13 +223,11 @@ private fun RecentlyVisitedHistoryGroup(
|
|||
* @param clickableEnabled Whether click actions should be invoked or not.
|
||||
* @param showDividerLine Whether to show a divider line at the bottom.
|
||||
* @param onRecentVisitClick Invoked when the user clicks on a recent visit.
|
||||
* @param onRecentVisitLongClick Invoked when the user long clicks on a recent visit highlight.
|
||||
*/
|
||||
@OptIn(
|
||||
ExperimentalFoundationApi::class,
|
||||
ExperimentalComposeUiApi::class,
|
||||
)
|
||||
@Suppress("LongParameterList")
|
||||
@Composable
|
||||
private fun RecentlyVisitedHistoryHighlight(
|
||||
recentVisit: RecentHistoryHighlight,
|
||||
|
@ -247,7 +235,6 @@ private fun RecentlyVisitedHistoryHighlight(
|
|||
clickableEnabled: Boolean,
|
||||
showDividerLine: Boolean,
|
||||
onRecentVisitClick: (RecentHistoryHighlight) -> Unit = { _ -> },
|
||||
onRecentVisitLongClick: () -> Unit = {},
|
||||
) {
|
||||
var isMenuExpanded by remember { mutableStateOf(false) }
|
||||
|
||||
|
@ -256,10 +243,7 @@ private fun RecentlyVisitedHistoryHighlight(
|
|||
.combinedClickable(
|
||||
enabled = clickableEnabled,
|
||||
onClick = { onRecentVisitClick(recentVisit) },
|
||||
onLongClick = {
|
||||
onRecentVisitLongClick()
|
||||
isMenuExpanded = true
|
||||
},
|
||||
onLongClick = { isMenuExpanded = true },
|
||||
)
|
||||
.size(268.dp, 56.dp)
|
||||
.semantics {
|
||||
|
|
|
@ -80,7 +80,6 @@ class RecentlyVisitedViewHolder(
|
|||
}
|
||||
}
|
||||
},
|
||||
onRecentVisitLongClick = { interactor.onRecentVisitLongClicked() },
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -41,7 +41,6 @@ import org.mozilla.fenix.GleanMetrics.TopSites
|
|||
import org.mozilla.fenix.HomeActivity
|
||||
import org.mozilla.fenix.R
|
||||
import org.mozilla.fenix.browser.BrowserAnimator
|
||||
import org.mozilla.fenix.browser.BrowserFragmentDirections
|
||||
import org.mozilla.fenix.browser.browsingmode.BrowsingMode
|
||||
import org.mozilla.fenix.collections.SaveCollectionStep
|
||||
import org.mozilla.fenix.components.AppStore
|
||||
|
@ -178,11 +177,6 @@ interface SessionControlController {
|
|||
*/
|
||||
fun handleRemoveCollectionsPlaceholder()
|
||||
|
||||
/**
|
||||
* @see [CollectionInteractor.onCollectionMenuOpened] and [TopSiteInteractor.onTopSiteMenuOpened]
|
||||
*/
|
||||
fun handleMenuOpened()
|
||||
|
||||
/**
|
||||
* @see [MessageCardInteractor.onMessageClicked]
|
||||
*/
|
||||
|
@ -248,13 +242,7 @@ class DefaultSessionControlController(
|
|||
)
|
||||
}
|
||||
|
||||
override fun handleMenuOpened() {
|
||||
dismissSearchDialogIfDisplayed()
|
||||
}
|
||||
|
||||
override fun handleCollectionOpenTabClicked(tab: ComponentTab) {
|
||||
dismissSearchDialogIfDisplayed()
|
||||
|
||||
restoreUseCase.invoke(
|
||||
activity,
|
||||
engine,
|
||||
|
@ -307,7 +295,6 @@ class DefaultSessionControlController(
|
|||
}
|
||||
|
||||
override fun handleCollectionShareTabsClicked(collection: TabCollection) {
|
||||
dismissSearchDialogIfDisplayed()
|
||||
showShareFragment(
|
||||
collection.title,
|
||||
collection.tabs.map { ShareData(url = it.url, title = it.title) },
|
||||
|
@ -337,7 +324,6 @@ class DefaultSessionControlController(
|
|||
}
|
||||
|
||||
override fun handlePrivateBrowsingLearnMoreClicked() {
|
||||
dismissSearchDialogIfDisplayed()
|
||||
activity.openToBrowserAndLoad(
|
||||
searchTermOrURL = SupportUtils.getGenericSumoURLForTopic(PRIVATE_BROWSING_MYTHS),
|
||||
newTab = true,
|
||||
|
@ -403,8 +389,6 @@ class DefaultSessionControlController(
|
|||
}
|
||||
|
||||
override fun handleSelectTopSite(topSite: TopSite, position: Int) {
|
||||
dismissSearchDialogIfDisplayed()
|
||||
|
||||
TopSites.openInNewTab.record(NoExtras())
|
||||
|
||||
when (topSite) {
|
||||
|
@ -501,12 +485,6 @@ class DefaultSessionControlController(
|
|||
return url
|
||||
}
|
||||
|
||||
private fun dismissSearchDialogIfDisplayed() {
|
||||
if (navController.currentDestination?.id == R.id.searchDialogFragment) {
|
||||
navController.navigateUp()
|
||||
}
|
||||
}
|
||||
|
||||
override fun handleStartBrowsingClicked() {
|
||||
hideOnboarding()
|
||||
}
|
||||
|
@ -648,14 +626,6 @@ class DefaultSessionControlController(
|
|||
appStore.dispatch(
|
||||
AppAction.ModeChange(Mode.fromBrowsingMode(newMode)),
|
||||
)
|
||||
|
||||
if (navController.currentDestination?.id == R.id.searchDialogFragment) {
|
||||
navController.navigate(
|
||||
BrowserFragmentDirections.actionGlobalSearchDialog(
|
||||
sessionId = null,
|
||||
),
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -133,11 +133,6 @@ interface CollectionInteractor {
|
|||
* User has removed the collections placeholder from home.
|
||||
*/
|
||||
fun onRemoveCollectionsPlaceholder()
|
||||
|
||||
/**
|
||||
* User has opened collection 3 dot menu.
|
||||
*/
|
||||
fun onCollectionMenuOpened()
|
||||
}
|
||||
|
||||
interface ToolbarInteractor {
|
||||
|
@ -228,11 +223,6 @@ interface TopSiteInteractor {
|
|||
* "Our sponsors & your privacy" top site menu item.
|
||||
*/
|
||||
fun onSponsorPrivacyClicked()
|
||||
|
||||
/**
|
||||
* Called when top site menu is opened.
|
||||
*/
|
||||
fun onTopSiteMenuOpened()
|
||||
}
|
||||
|
||||
interface MessageCardInteractor {
|
||||
|
@ -367,14 +357,6 @@ class SessionControlInteractor(
|
|||
controller.handleRemoveCollectionsPlaceholder()
|
||||
}
|
||||
|
||||
override fun onCollectionMenuOpened() {
|
||||
controller.handleMenuOpened()
|
||||
}
|
||||
|
||||
override fun onTopSiteMenuOpened() {
|
||||
controller.handleMenuOpened()
|
||||
}
|
||||
|
||||
override fun onRecentTabClicked(tabId: String) {
|
||||
recentTabController.handleRecentTabClicked(tabId)
|
||||
}
|
||||
|
@ -383,10 +365,6 @@ class SessionControlInteractor(
|
|||
recentTabController.handleRecentTabShowAllClicked()
|
||||
}
|
||||
|
||||
override fun onRecentTabLongClicked() {
|
||||
recentTabController.handleRecentTabLongClicked()
|
||||
}
|
||||
|
||||
override fun onRemoveRecentTab(tab: RecentTab.Tab) {
|
||||
recentTabController.handleRecentTabRemoved(tab)
|
||||
}
|
||||
|
@ -395,10 +373,6 @@ class SessionControlInteractor(
|
|||
recentSyncedTabController.handleRecentSyncedTabClick(tab)
|
||||
}
|
||||
|
||||
override fun onRecentSyncedTabLongClick() {
|
||||
recentSyncedTabController.handleRecentSyncedTabLongClick()
|
||||
}
|
||||
|
||||
override fun onSyncedTabShowAllClicked() {
|
||||
recentSyncedTabController.handleSyncedTabShowAllClicked()
|
||||
}
|
||||
|
@ -419,10 +393,6 @@ class SessionControlInteractor(
|
|||
recentBookmarksController.handleBookmarkRemoved(bookmark)
|
||||
}
|
||||
|
||||
override fun onRecentBookmarkLongClicked() {
|
||||
recentBookmarksController.handleBookmarkLongClicked()
|
||||
}
|
||||
|
||||
override fun onHistoryShowAllClicked() {
|
||||
recentVisitsController.handleHistoryShowAllClicked()
|
||||
}
|
||||
|
@ -445,10 +415,6 @@ class SessionControlInteractor(
|
|||
recentVisitsController.handleRemoveRecentHistoryHighlight(highlightUrl)
|
||||
}
|
||||
|
||||
override fun onRecentVisitLongClicked() {
|
||||
recentVisitsController.handleRecentVisitLongClicked()
|
||||
}
|
||||
|
||||
override fun openCustomizeHomePage() {
|
||||
controller.handleCustomizeHomeTapped()
|
||||
}
|
||||
|
|
|
@ -54,7 +54,6 @@ class TopSiteItemViewHolder(
|
|||
|
||||
init {
|
||||
itemView.setOnLongClickListener {
|
||||
interactor.onTopSiteMenuOpened()
|
||||
TopSites.longPress.record(TopSites.LongPressExtra(topSite.name()))
|
||||
|
||||
val topSiteMenu = TopSiteItemMenu(
|
||||
|
|
|
@ -162,6 +162,7 @@ class SearchDialogFragment : AppCompatDialogFragment(), UserInteractionHandler {
|
|||
}
|
||||
|
||||
@SuppressWarnings("LongMethod")
|
||||
@SuppressLint("ClickableViewAccessibility")
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater,
|
||||
container: ViewGroup?,
|
||||
|
@ -266,7 +267,6 @@ class SearchDialogFragment : AppCompatDialogFragment(), UserInteractionHandler {
|
|||
binding.searchWrapper.background = ColorDrawable(Color.TRANSPARENT)
|
||||
dialog?.window?.decorView?.setOnTouchListener { _, event ->
|
||||
requireActivity().dispatchTouchEvent(event)
|
||||
// toolbarView.view.displayMode()
|
||||
false
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<!-- using an AppBarLayout to replace MotionLayout was done in order to improve Fenix
|
||||
start up performance. The use of a MotionLayout was worsening our layout measures, especially
|
||||
with the recycler view -->
|
||||
<androidx.coordinatorlayout.widget.CoordinatorLayout
|
||||
<org.mozilla.fenix.home.HomeFragmentLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
|
@ -202,4 +202,4 @@
|
|||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
</org.mozilla.fenix.home.HomeFragmentLayout>
|
||||
|
|
|
@ -43,7 +43,6 @@ import org.junit.Assert.assertNotNull
|
|||
import org.junit.Assert.assertNull
|
||||
import org.junit.Assert.assertTrue
|
||||
import org.junit.Before
|
||||
import org.junit.Ignore
|
||||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
|
@ -57,7 +56,6 @@ import org.mozilla.fenix.GleanMetrics.RecentTabs
|
|||
import org.mozilla.fenix.GleanMetrics.TopSites
|
||||
import org.mozilla.fenix.HomeActivity
|
||||
import org.mozilla.fenix.R
|
||||
import org.mozilla.fenix.browser.BrowserFragmentDirections
|
||||
import org.mozilla.fenix.browser.browsingmode.BrowsingMode
|
||||
import org.mozilla.fenix.components.Analytics
|
||||
import org.mozilla.fenix.components.AppStore
|
||||
|
@ -1046,33 +1044,6 @@ class DefaultSessionControlControllerTest {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore("Can't instantiate proxy for class kotlin.Function0")
|
||||
fun handleMenuOpenedWhileSearchShowing() {
|
||||
every { navController.currentDestination } returns mockk {
|
||||
every { id } returns R.id.searchDialogFragment
|
||||
}
|
||||
|
||||
createController().handleMenuOpened()
|
||||
|
||||
verify {
|
||||
navController.navigateUp()
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun handleMenuOpenedWhileSearchNotShowing() {
|
||||
every { navController.currentDestination } returns mockk {
|
||||
every { id } returns R.id.homeFragment
|
||||
}
|
||||
|
||||
createController().handleMenuOpened()
|
||||
|
||||
verify(exactly = 0) {
|
||||
navController.navigateUp()
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `WHEN private mode button is selected from home THEN handle mode change`() {
|
||||
every { navController.currentDestination } returns mockk {
|
||||
|
@ -1117,11 +1088,6 @@ class DefaultSessionControlControllerTest {
|
|||
verify {
|
||||
settings.incrementNumTimesPrivateModeOpened()
|
||||
AppAction.ModeChange(Mode.fromBrowsingMode(newMode))
|
||||
navController.navigate(
|
||||
BrowserFragmentDirections.actionGlobalSearchDialog(
|
||||
sessionId = null,
|
||||
),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1149,11 +1115,8 @@ class DefaultSessionControlControllerTest {
|
|||
settings.incrementNumTimesPrivateModeOpened()
|
||||
}
|
||||
verify {
|
||||
AppAction.ModeChange(Mode.fromBrowsingMode(newMode))
|
||||
navController.navigate(
|
||||
BrowserFragmentDirections.actionGlobalSearchDialog(
|
||||
sessionId = null,
|
||||
),
|
||||
appStore.dispatch(
|
||||
AppAction.ModeChange(Mode.fromBrowsingMode(newMode)),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -143,18 +143,6 @@ class SessionControlInteractorTest {
|
|||
verify { controller.handleRemoveCollectionsPlaceholder() }
|
||||
}
|
||||
|
||||
@Test
|
||||
fun onCollectionMenuOpened() {
|
||||
interactor.onCollectionMenuOpened()
|
||||
verify { controller.handleMenuOpened() }
|
||||
}
|
||||
|
||||
@Test
|
||||
fun onTopSiteMenuOpened() {
|
||||
interactor.onTopSiteMenuOpened()
|
||||
verify { controller.handleMenuOpened() }
|
||||
}
|
||||
|
||||
@Test
|
||||
fun onRecentTabClicked() {
|
||||
val tabId = "tabId"
|
||||
|
@ -162,12 +150,6 @@ class SessionControlInteractorTest {
|
|||
verify { recentTabController.handleRecentTabClicked(tabId) }
|
||||
}
|
||||
|
||||
@Test
|
||||
fun onRecentTabLongClicked() {
|
||||
interactor.onRecentTabLongClicked()
|
||||
verify { recentTabController.handleRecentTabLongClicked() }
|
||||
}
|
||||
|
||||
@Test
|
||||
fun onRecentTabShowAllClicked() {
|
||||
interactor.onRecentTabShowAllClicked()
|
||||
|
@ -197,12 +179,6 @@ class SessionControlInteractorTest {
|
|||
verify { recentBookmarksController.handleBookmarkClicked(bookmark) }
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `WHEN a recent bookmark is long clicked THEN the long click is handled`() {
|
||||
interactor.onRecentBookmarkLongClicked()
|
||||
verify { recentBookmarksController.handleBookmarkLongClicked() }
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `WHEN tapping on the customize home button THEN openCustomizeHomePage`() {
|
||||
interactor.openCustomizeHomePage()
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
|
||||
package org.mozilla.fenix.home.pocket
|
||||
|
||||
import androidx.navigation.NavController
|
||||
import io.mockk.every
|
||||
import io.mockk.mockk
|
||||
import io.mockk.mockkStatic
|
||||
|
@ -28,7 +27,6 @@ import org.mozilla.fenix.BrowserDirection
|
|||
import org.mozilla.fenix.GleanMetrics.Pings
|
||||
import org.mozilla.fenix.GleanMetrics.Pocket
|
||||
import org.mozilla.fenix.HomeActivity
|
||||
import org.mozilla.fenix.R
|
||||
import org.mozilla.fenix.components.AppStore
|
||||
import org.mozilla.fenix.components.appstate.AppAction
|
||||
import org.mozilla.fenix.components.appstate.AppState
|
||||
|
@ -53,7 +51,7 @@ class DefaultPocketStoriesControllerTest {
|
|||
),
|
||||
),
|
||||
)
|
||||
val controller = DefaultPocketStoriesController(mockk(), store, mockk())
|
||||
val controller = DefaultPocketStoriesController(mockk(), store)
|
||||
assertNull(Pocket.homeRecsCategoryClicked.testGetValue())
|
||||
|
||||
controller.handleCategoryClick(category2)
|
||||
|
@ -98,7 +96,7 @@ class DefaultPocketStoriesControllerTest {
|
|||
),
|
||||
),
|
||||
)
|
||||
val controller = DefaultPocketStoriesController(mockk(), store, mockk())
|
||||
val controller = DefaultPocketStoriesController(mockk(), store)
|
||||
assertNull(Pocket.homeRecsCategoryClicked.testGetValue())
|
||||
|
||||
controller.handleCategoryClick(PocketRecommendedStoriesCategory(newSelectedCategory.name))
|
||||
|
@ -142,7 +140,7 @@ class DefaultPocketStoriesControllerTest {
|
|||
),
|
||||
)
|
||||
val newSelectedCategoryName = "newSelectedCategory"
|
||||
val controller = DefaultPocketStoriesController(mockk(), store, mockk())
|
||||
val controller = DefaultPocketStoriesController(mockk(), store)
|
||||
|
||||
controller.handleCategoryClick(PocketRecommendedStoriesCategory(newSelectedCategoryName))
|
||||
|
||||
|
@ -163,7 +161,7 @@ class DefaultPocketStoriesControllerTest {
|
|||
@Test
|
||||
fun `WHEN a new recommended story is shown THEN update the State`() {
|
||||
val store = spyk(AppStore())
|
||||
val controller = DefaultPocketStoriesController(mockk(), store, mockk())
|
||||
val controller = DefaultPocketStoriesController(mockk(), store)
|
||||
val storyShown: PocketRecommendedStory = mockk()
|
||||
val storyGridLocation = 1 to 2
|
||||
|
||||
|
@ -175,7 +173,7 @@ class DefaultPocketStoriesControllerTest {
|
|||
@Test
|
||||
fun `WHEN a new sponsored story is shown THEN update the State and record telemetry`() {
|
||||
val store = spyk(AppStore())
|
||||
val controller = DefaultPocketStoriesController(mockk(), store, mockk())
|
||||
val controller = DefaultPocketStoriesController(mockk(), store)
|
||||
val storyShown: PocketSponsoredStory = mockk {
|
||||
every { shim.click } returns "testClickShim"
|
||||
every { shim.impression } returns "testImpressionShim"
|
||||
|
@ -206,7 +204,7 @@ class DefaultPocketStoriesControllerTest {
|
|||
@Test
|
||||
fun `WHEN new stories are shown THEN update the State and record telemetry`() {
|
||||
val store = spyk(AppStore())
|
||||
val controller = DefaultPocketStoriesController(mockk(), store, mockk())
|
||||
val controller = DefaultPocketStoriesController(mockk(), store)
|
||||
val storiesShown: List<PocketStory> = mockk()
|
||||
assertNull(Pocket.homeRecsShown.testGetValue())
|
||||
|
||||
|
@ -230,7 +228,7 @@ class DefaultPocketStoriesControllerTest {
|
|||
timesShown = 123,
|
||||
)
|
||||
val homeActivity: HomeActivity = mockk(relaxed = true)
|
||||
val controller = DefaultPocketStoriesController(homeActivity, mockk(), mockk(relaxed = true))
|
||||
val controller = DefaultPocketStoriesController(homeActivity, mockk())
|
||||
assertNull(Pocket.homeRecsStoryClicked.testGetValue())
|
||||
|
||||
controller.handleStoryClicked(story, 1 to 2)
|
||||
|
@ -262,7 +260,7 @@ class DefaultPocketStoriesControllerTest {
|
|||
caps = mockk(relaxed = true),
|
||||
)
|
||||
val homeActivity: HomeActivity = mockk(relaxed = true)
|
||||
val controller = DefaultPocketStoriesController(homeActivity, mockk(), mockk(relaxed = true))
|
||||
val controller = DefaultPocketStoriesController(homeActivity, mockk())
|
||||
var wasPingSent = false
|
||||
assertNull(Pocket.homeRecsSpocClicked.testGetValue())
|
||||
mockkStatic("mozilla.components.service.pocket.ext.PocketStoryKt") {
|
||||
|
@ -291,7 +289,7 @@ class DefaultPocketStoriesControllerTest {
|
|||
fun `WHEN discover more is clicked then open that using HomeActivity and record telemetry`() {
|
||||
val link = "http://getpocket.com/explore"
|
||||
val homeActivity: HomeActivity = mockk(relaxed = true)
|
||||
val controller = DefaultPocketStoriesController(homeActivity, mockk(), mockk(relaxed = true))
|
||||
val controller = DefaultPocketStoriesController(homeActivity, mockk())
|
||||
assertNull(Pocket.homeRecsDiscoverClicked.testGetValue())
|
||||
|
||||
controller.handleDiscoverMoreClicked(link)
|
||||
|
@ -306,7 +304,7 @@ class DefaultPocketStoriesControllerTest {
|
|||
fun `WHEN learn more is clicked then open that using HomeActivity and record telemetry`() {
|
||||
val link = "https://www.mozilla.org/en-US/firefox/pocket/"
|
||||
val homeActivity: HomeActivity = mockk(relaxed = true)
|
||||
val controller = DefaultPocketStoriesController(homeActivity, mockk(), mockk(relaxed = true))
|
||||
val controller = DefaultPocketStoriesController(homeActivity, mockk())
|
||||
assertNull(Pocket.homeRecsLearnMoreClicked.testGetValue())
|
||||
|
||||
controller.handleLearnMoreClicked(link)
|
||||
|
@ -317,79 +315,41 @@ class DefaultPocketStoriesControllerTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
fun `WHEN a story is clicked THEN search is dismissed and then its link opened`() {
|
||||
fun `WHEN a story is clicked THEN its link is opened`() {
|
||||
val story = PocketRecommendedStory("", "url", "", "", "", 0, 0)
|
||||
val homeActivity: HomeActivity = mockk(relaxed = true)
|
||||
val navController: NavController = mockk(relaxed = true)
|
||||
every { navController.currentDestination } returns mockk {
|
||||
every { id } returns R.id.searchDialogFragment
|
||||
}
|
||||
val controller = DefaultPocketStoriesController(homeActivity, mockk(), navController)
|
||||
val controller = DefaultPocketStoriesController(homeActivity, mockk())
|
||||
|
||||
controller.handleStoryClicked(story, 1 to 2)
|
||||
|
||||
verifyOrder {
|
||||
navController.navigateUp()
|
||||
homeActivity.openToBrowserAndLoad(story.url, true, BrowserDirection.FromHome)
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `WHEN discover more is clicked THEN search is dismissed and then its link opened`() {
|
||||
fun `WHEN discover more is clicked THEN its link is opened`() {
|
||||
val link = "https://discoverMore.link"
|
||||
val homeActivity: HomeActivity = mockk(relaxed = true)
|
||||
val navController: NavController = mockk(relaxed = true)
|
||||
every { navController.currentDestination } returns mockk {
|
||||
every { id } returns R.id.searchDialogFragment
|
||||
}
|
||||
val controller = DefaultPocketStoriesController(homeActivity, mockk(), navController)
|
||||
val controller = DefaultPocketStoriesController(homeActivity, mockk())
|
||||
|
||||
controller.handleDiscoverMoreClicked(link)
|
||||
|
||||
verifyOrder {
|
||||
navController.navigateUp()
|
||||
homeActivity.openToBrowserAndLoad(link, true, BrowserDirection.FromHome)
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `WHEN learn more link is clicked THEN search is dismissed and then that link is opened`() {
|
||||
fun `WHEN learn more link is clicked THEN that link is opened`() {
|
||||
val link = "https://learnMore.link"
|
||||
val homeActivity: HomeActivity = mockk(relaxed = true)
|
||||
val navController: NavController = mockk(relaxed = true)
|
||||
every { navController.currentDestination } returns mockk {
|
||||
every { id } returns R.id.searchDialogFragment
|
||||
}
|
||||
val controller = DefaultPocketStoriesController(homeActivity, mockk(), navController)
|
||||
val controller = DefaultPocketStoriesController(homeActivity, mockk())
|
||||
|
||||
controller.handleLearnMoreClicked(link)
|
||||
|
||||
verifyOrder {
|
||||
navController.navigateUp()
|
||||
homeActivity.openToBrowserAndLoad(link, true, BrowserDirection.FromHome)
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `GIVEN search dialog is currently focused WHEN dismissSearchDialogIfDisplayed is called THEN close the search dialog`() {
|
||||
val navController: NavController = mockk(relaxed = true)
|
||||
every { navController.currentDestination } returns mockk {
|
||||
every { id } returns R.id.searchDialogFragment
|
||||
}
|
||||
val controller = DefaultPocketStoriesController(mockk(), mockk(), navController)
|
||||
|
||||
controller.dismissSearchDialogIfDisplayed()
|
||||
|
||||
verify { navController.navigateUp() }
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `GIVEN search dialog is not currently focused WHEN dismissSearchDialogIfDisplayed is called THEN do nothing`() {
|
||||
val navController: NavController = mockk(relaxed = true)
|
||||
val controller = DefaultPocketStoriesController(mockk(), mockk(), navController)
|
||||
|
||||
controller.dismissSearchDialogIfDisplayed()
|
||||
|
||||
verify(exactly = 0) { navController.navigateUp() }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,7 +28,6 @@ import org.junit.runner.RunWith
|
|||
import org.mozilla.fenix.BrowserDirection
|
||||
import org.mozilla.fenix.GleanMetrics.RecentBookmarks
|
||||
import org.mozilla.fenix.HomeActivity
|
||||
import org.mozilla.fenix.R
|
||||
import org.mozilla.fenix.helpers.FenixRobolectricTestRunner
|
||||
import org.mozilla.fenix.home.HomeFragmentDirections
|
||||
import org.mozilla.fenix.home.recentbookmarks.controller.DefaultRecentBookmarksController
|
||||
|
@ -52,11 +51,6 @@ class DefaultRecentBookmarksControllerTest {
|
|||
fun setup() {
|
||||
every { activity.openToBrowserAndLoad(any(), any(), any()) } just Runs
|
||||
|
||||
every { navController.currentDestination } returns mockk {
|
||||
every { id } returns R.id.homeFragment
|
||||
}
|
||||
every { navController.navigateUp() } returns true
|
||||
|
||||
controller = spyk(
|
||||
DefaultRecentBookmarksController(
|
||||
activity = activity,
|
||||
|
@ -68,9 +62,6 @@ class DefaultRecentBookmarksControllerTest {
|
|||
|
||||
@Test
|
||||
fun `WHEN a recently saved bookmark is clicked THEN the selected bookmark is opened`() {
|
||||
every { navController.currentDestination } returns mockk {
|
||||
every { id } returns R.id.homeFragment
|
||||
}
|
||||
assertNull(RecentBookmarks.bookmarkClicked.testGetValue())
|
||||
|
||||
val bookmark = RecentBookmark(
|
||||
|
@ -81,7 +72,6 @@ class DefaultRecentBookmarksControllerTest {
|
|||
controller.handleBookmarkClicked(bookmark)
|
||||
|
||||
verify {
|
||||
controller.dismissSearchDialogIfDisplayed()
|
||||
activity.openToBrowserAndLoad(
|
||||
searchTermOrURL = bookmark.url!!,
|
||||
newTab = true,
|
||||
|
@ -90,16 +80,10 @@ class DefaultRecentBookmarksControllerTest {
|
|||
)
|
||||
}
|
||||
assertNotNull(RecentBookmarks.bookmarkClicked.testGetValue())
|
||||
verify(exactly = 0) {
|
||||
navController.navigateUp()
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `WHEN show all recently saved bookmark is clicked THEN the bookmarks root is opened`() = runTestOnMain {
|
||||
every { navController.currentDestination } returns mockk {
|
||||
every { id } returns R.id.homeFragment
|
||||
}
|
||||
assertNull(RecentBookmarks.showAllBookmarks.testGetValue())
|
||||
|
||||
controller.handleShowAllBookmarksClicked()
|
||||
|
@ -109,16 +93,10 @@ class DefaultRecentBookmarksControllerTest {
|
|||
navController.navigate(directions)
|
||||
}
|
||||
assertNotNull(RecentBookmarks.showAllBookmarks.testGetValue())
|
||||
verify(exactly = 0) {
|
||||
navController.navigateUp()
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `WHEN show all is clicked from behind search dialog THEN open bookmarks root`() {
|
||||
every { navController.currentDestination } returns mockk {
|
||||
every { id } returns R.id.searchDialogFragment
|
||||
}
|
||||
assertNull(RecentBookmarks.showAllBookmarks.testGetValue())
|
||||
|
||||
controller.handleShowAllBookmarksClicked()
|
||||
|
@ -126,24 +104,8 @@ class DefaultRecentBookmarksControllerTest {
|
|||
val directions = HomeFragmentDirections.actionGlobalBookmarkFragment(BookmarkRoot.Mobile.id)
|
||||
|
||||
verify {
|
||||
controller.dismissSearchDialogIfDisplayed()
|
||||
navController.navigateUp()
|
||||
navController.navigate(directions)
|
||||
}
|
||||
assertNotNull(RecentBookmarks.showAllBookmarks.testGetValue())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `GIVEN search dialog is displayed WHEN recent bookmark is long clicked THEN dismiss search dialog`() {
|
||||
every { navController.currentDestination } returns mockk {
|
||||
every { id } returns R.id.searchDialogFragment
|
||||
}
|
||||
|
||||
controller.handleBookmarkLongClicked()
|
||||
|
||||
verify {
|
||||
controller.dismissSearchDialogIfDisplayed()
|
||||
navController.navigateUp()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -150,20 +150,6 @@ class DefaultRecentSyncedTabControllerTest {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `GIVEN search dialog is displayed WHEN recent synced tab is long clicked THEN dismiss search dialog`() {
|
||||
every { navController.navigateUp() } returns true
|
||||
every { navController.currentDestination } returns mockk {
|
||||
every { id } returns R.id.searchDialogFragment
|
||||
}
|
||||
|
||||
controller.handleRecentSyncedTabLongClick()
|
||||
|
||||
verify {
|
||||
navController.navigateUp()
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `WHEN synced tab clicked THEN metric counter labeled by device type is incremented`() {
|
||||
val url = "https://mozilla.org"
|
||||
|
|
|
@ -63,7 +63,6 @@ class RecentTabControllerTest {
|
|||
appStore = appStore,
|
||||
),
|
||||
)
|
||||
every { navController.navigateUp() } returns true
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -124,21 +123,13 @@ class RecentTabControllerTest {
|
|||
fun handleRecentTabShowAllClickedFromHome() {
|
||||
assertNull(RecentTabs.showAllClicked.testGetValue())
|
||||
|
||||
every { navController.currentDestination } returns mockk {
|
||||
every { id } returns R.id.homeFragment
|
||||
}
|
||||
|
||||
controller.handleRecentTabShowAllClicked()
|
||||
|
||||
verify {
|
||||
controller.dismissSearchDialogIfDisplayed()
|
||||
navController.navigate(
|
||||
match<NavDirections> { it.actionId == R.id.action_global_tabsTrayFragment },
|
||||
)
|
||||
}
|
||||
verify(exactly = 0) {
|
||||
navController.navigateUp()
|
||||
}
|
||||
|
||||
assertNotNull(RecentTabs.showAllClicked.testGetValue())
|
||||
}
|
||||
|
@ -147,15 +138,9 @@ class RecentTabControllerTest {
|
|||
fun handleRecentTabShowAllClickedFromSearchDialog() {
|
||||
assertNull(RecentTabs.showAllClicked.testGetValue())
|
||||
|
||||
every { navController.currentDestination } returns mockk {
|
||||
every { id } returns R.id.searchDialogFragment
|
||||
}
|
||||
|
||||
controller.handleRecentTabShowAllClicked()
|
||||
|
||||
verify {
|
||||
controller.dismissSearchDialogIfDisplayed()
|
||||
navController.navigateUp()
|
||||
navController.navigate(
|
||||
match<NavDirections> { it.actionId == R.id.action_global_tabsTrayFragment },
|
||||
)
|
||||
|
@ -163,19 +148,4 @@ class RecentTabControllerTest {
|
|||
|
||||
assertNotNull(RecentTabs.showAllClicked.testGetValue())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `GIVEN search dialog is displayed WHEN long clicking a recent tab THEN search dialog is dismissed`() {
|
||||
every { navController.currentDestination } returns mockk {
|
||||
every { id } returns R.id.searchDialogFragment
|
||||
}
|
||||
every { navController.navigateUp() } returns true
|
||||
|
||||
controller.handleRecentTabLongClicked()
|
||||
|
||||
verify {
|
||||
controller.dismissSearchDialogIfDisplayed()
|
||||
navController.navigateUp()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -87,7 +87,6 @@ class RecentVisitsControllerTest {
|
|||
controller.handleHistoryShowAllClicked()
|
||||
|
||||
verify {
|
||||
controller.dismissSearchDialogIfDisplayed()
|
||||
navController.navigate(
|
||||
HomeFragmentDirections.actionGlobalHistoryFragment(),
|
||||
)
|
||||
|
@ -181,18 +180,4 @@ class RecentVisitsControllerTest {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `WHEN long clicking a recent visit THEN search dialog should be dismissed `() = runTestOnMain {
|
||||
every { navController.currentDestination } returns mockk {
|
||||
every { id } returns R.id.searchDialogFragment
|
||||
}
|
||||
|
||||
controller.handleRecentVisitLongClicked()
|
||||
|
||||
verify {
|
||||
controller.dismissSearchDialogIfDisplayed()
|
||||
navController.navigateUp()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -120,11 +120,4 @@ class RecentVisitsInteractorTest {
|
|||
|
||||
verify { recentVisitsController.handleRemoveRecentHistoryHighlight("url") }
|
||||
}
|
||||
|
||||
@Test
|
||||
fun onRecentVisitLongClicked() {
|
||||
interactor.onRecentVisitLongClicked()
|
||||
|
||||
verify { recentVisitsController.handleRecentVisitLongClicked() }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -65,15 +65,6 @@ class TopSiteItemViewHolderTest {
|
|||
verify { interactor.onSelectTopSite(pocket, position = 0) }
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `calls interactor on long click`() {
|
||||
every { testContext.components.analytics } returns mockk(relaxed = true)
|
||||
TopSiteItemViewHolder(binding.root, appStore, lifecycleOwner, interactor).bind(pocket, position = 0)
|
||||
|
||||
binding.root.performLongClick()
|
||||
verify { interactor.onTopSiteMenuOpened() }
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `GIVEN a default top site WHEN bind is called THEN the title has a pin indicator`() {
|
||||
val defaultTopSite = TopSite.Default(
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<baseline version="1.0">
|
||||
<file name="app/src/main/java/org/mozilla/fenix/home/topsites/TopSiteItemViewHolder.kt">
|
||||
<error line="66" column="35" source="annotation" />
|
||||
<error line="65" column="35" source="annotation" />
|
||||
</file>
|
||||
</baseline>
|
||||
|
|
Loading…
Reference in New Issue