No issue: Improve rendering of jump back in

upstream-sync
Roger Yang 3 years ago committed by Christian Sadilek
parent 37e342fd92
commit ddd472d143

@ -40,6 +40,8 @@ class CollectionTest {
@Before
fun setUp() {
activityTestRule.activity.applicationContext.settings().hasShownHomeOnboardingDialog = true
mockWebServer = MockWebServer().apply {
dispatcher = AndroidAssetDispatcher()
start()
@ -54,8 +56,6 @@ class CollectionTest {
@Test
// open a webpage, and add currently opened tab to existing collection
fun mainMenuSaveToExistingCollection() {
val settings = activityTestRule.activity.applicationContext.settings()
settings.hasShownHomeOnboardingDialog = true
val firstWebPage = getGenericAsset(mockWebServer, 1)
val secondWebPage = getGenericAsset(mockWebServer, 2)
@ -83,8 +83,6 @@ class CollectionTest {
@Test
@Ignore("https://github.com/mozilla-mobile/fenix/issues/21397")
fun verifyAddTabButtonOfCollectionMenu() {
val settings = activityTestRule.activity.applicationContext.settings()
settings.hasShownHomeOnboardingDialog = true
val firstWebPage = getGenericAsset(mockWebServer, 1)
val secondWebPage = getGenericAsset(mockWebServer, 2)
@ -112,8 +110,6 @@ class CollectionTest {
@Test
@Ignore("https://github.com/mozilla-mobile/fenix/issues/21397")
fun renameCollectionTest() {
val settings = activityTestRule.activity.applicationContext.settings()
settings.hasShownHomeOnboardingDialog = true
val webPage = getGenericAsset(mockWebServer, 1)
navigationToolbar {
@ -135,8 +131,6 @@ class CollectionTest {
@Test
fun createSecondCollectionTest() {
val settings = activityTestRule.activity.applicationContext.settings()
settings.hasShownHomeOnboardingDialog = true
val webPage = getGenericAsset(mockWebServer, 1)
navigationToolbar {
@ -216,8 +210,6 @@ class CollectionTest {
@Test
fun selectTabOnLongTapTest() {
val settings = activityTestRule.activity.applicationContext.settings()
settings.hasShownHomeOnboardingDialog = true
val firstWebPage = getGenericAsset(mockWebServer, 1)
val secondWebPage = getGenericAsset(mockWebServer, 2)

@ -42,6 +42,9 @@ class HistoryTest {
@Before
fun setUp() {
InstrumentationRegistry.getInstrumentation().targetContext.settings()
.hasShownHomeOnboardingDialog = true
mockWebServer = MockWebServer().apply {
dispatcher = AndroidAssetDispatcher()
start()
@ -221,8 +224,6 @@ class HistoryTest {
fun deleteMultipleSelectionTest() {
val firstWebPage = TestAssetHelper.getGenericAsset(mockWebServer, 1)
val secondWebPage = TestAssetHelper.getGenericAsset(mockWebServer, 2)
val settings = InstrumentationRegistry.getInstrumentation().targetContext.settings()
settings.hasShownHomeOnboardingDialog = true
navigationToolbar {
}.enterURLAndEnterToBrowser(firstWebPage.url) {

@ -108,6 +108,7 @@ class SmokeTest {
// So we are initializing this here instead of in all related tests.
browserStore = activityTestRule.activity.components.core.store
activityTestRule.activity.applicationContext.settings().hasShownHomeOnboardingDialog = true
mockWebServer = MockWebServer().apply {
dispatcher = AndroidAssetDispatcher()
start()

@ -48,6 +48,7 @@ class TabbedBrowsingTest {
@Before
fun setUp() {
activityTestRule.activity.applicationContext.settings().hasShownHomeOnboardingDialog = true
mockWebServer = MockWebServer().apply {
dispatcher = AndroidAssetDispatcher()
start()

@ -9,6 +9,7 @@ import org.junit.After
import org.junit.Before
import org.junit.Rule
import org.junit.Test
import org.mozilla.fenix.ext.settings
import org.mozilla.fenix.helpers.AndroidAssetDispatcher
import org.mozilla.fenix.helpers.HomeActivityTestRule
import org.mozilla.fenix.ui.robots.homeScreen
@ -28,6 +29,7 @@ class ThreeDotMenuMainTest {
@Before
fun setUp() {
activityTestRule.activity.applicationContext.settings().hasShownHomeOnboardingDialog = true
mockWebServer = MockWebServer().apply {
dispatcher = AndroidAssetDispatcher()
start()

@ -80,6 +80,7 @@ import org.mozilla.fenix.R
import org.mozilla.fenix.browser.BrowserAnimator.Companion.getToolbarNavOptions
import org.mozilla.fenix.browser.BrowserFragmentDirections
import org.mozilla.fenix.browser.browsingmode.BrowsingMode
import org.mozilla.fenix.components.Components
import org.mozilla.fenix.components.FenixSnackbar
import org.mozilla.fenix.components.PrivateShortcutCreateManager
import org.mozilla.fenix.components.StoreProvider
@ -92,6 +93,7 @@ import org.mozilla.fenix.components.tips.providers.MasterPasswordTipProvider
import org.mozilla.fenix.components.toolbar.FenixTabCounterMenu
import org.mozilla.fenix.components.toolbar.ToolbarPosition
import org.mozilla.fenix.databinding.FragmentHomeBinding
import org.mozilla.fenix.ext.asRecentTabs
import org.mozilla.fenix.ext.components
import org.mozilla.fenix.ext.hideToolbar
import org.mozilla.fenix.ext.metrics
@ -104,6 +106,7 @@ import org.mozilla.fenix.historymetadata.controller.DefaultHistoryMetadataContro
import org.mozilla.fenix.home.mozonline.showPrivacyPopWindow
import org.mozilla.fenix.home.recentbookmarks.RecentBookmarksFeature
import org.mozilla.fenix.home.recentbookmarks.controller.DefaultRecentBookmarksController
import org.mozilla.fenix.home.recenttabs.RecentTab
import org.mozilla.fenix.home.recenttabs.RecentTabsListFeature
import org.mozilla.fenix.home.recenttabs.controller.DefaultRecentTabsController
import org.mozilla.fenix.home.sessioncontrol.DefaultSessionControlController
@ -235,7 +238,10 @@ class HomeFragment : Fragment() {
recentBookmarks = emptyList(),
showCollectionPlaceholder = components.settings.showCollectionsPlaceholderOnHome,
showSetAsDefaultBrowserCard = components.settings.shouldShowSetAsDefaultBrowserCard(),
recentTabs = emptyList(),
// Provide an initial state for recent tabs to prevent re-rendering on the home screen.
// This will otherwise cause a visual jump as the section gets rendered from no state
// to some state.
recentTabs = getRecentTabs(components),
historyMetadata = emptyList()
),
listOf(
@ -650,7 +656,10 @@ class HomeFragment : Fragment() {
).getTip()
},
showCollectionPlaceholder = components.settings.showCollectionsPlaceholderOnHome,
recentTabs = emptyList(),
// Provide an initial state for recent tabs to prevent re-rendering on the home screen.
// This will otherwise cause a visual jump as the section gets rendered from no state
// to some state.
recentTabs = getRecentTabs(components),
recentBookmarks = emptyList(),
historyMetadata = emptyList()
)
@ -1136,6 +1145,14 @@ class HomeFragment : Fragment() {
binding.sessionControlRecyclerView.adapter?.notifyDataSetChanged()
}
private fun getRecentTabs(components: Components): List<RecentTab> {
return if (components.settings.showRecentTabsFeature) {
components.core.store.state.asRecentTabs()
} else {
emptyList()
}
}
companion object {
const val ALL_NORMAL_TABS = "all_normal"
const val ALL_PRIVATE_TABS = "all_private"

Loading…
Cancel
Save