diff --git a/app/src/main/java/org/mozilla/fenix/FeatureFlags.kt b/app/src/main/java/org/mozilla/fenix/FeatureFlags.kt index 4cbe1ac30c..b0a6d9cc61 100644 --- a/app/src/main/java/org/mozilla/fenix/FeatureFlags.kt +++ b/app/src/main/java/org/mozilla/fenix/FeatureFlags.kt @@ -26,11 +26,6 @@ object FeatureFlags { */ val showGridViewInTabsSettings = Config.channel.isNightlyOrDebug - /** - * Enables wait til first contentful paint - */ - val waitUntilPaintToDraw = Config.channel.isNightlyOrDebug - /** * Enables downloads with external download managers. */ diff --git a/app/src/main/java/org/mozilla/fenix/browser/BaseBrowserFragment.kt b/app/src/main/java/org/mozilla/fenix/browser/BaseBrowserFragment.kt index 17997e65ae..5323c35f08 100644 --- a/app/src/main/java/org/mozilla/fenix/browser/BaseBrowserFragment.kt +++ b/app/src/main/java/org/mozilla/fenix/browser/BaseBrowserFragment.kt @@ -247,9 +247,7 @@ abstract class BaseBrowserFragment : Fragment(), UserInteractionHandler, Session fragment = WeakReference(this), engineView = WeakReference(engineView), swipeRefresh = WeakReference(swipeRefresh), - viewLifecycleScope = WeakReference(viewLifecycleOwner.lifecycleScope), - settings = context.components.settings, - firstContentfulHappened = ::didFirstContentfulHappen + viewLifecycleScope = WeakReference(viewLifecycleOwner.lifecycleScope) ).apply { beginAnimateInIfNecessary() } @@ -659,28 +657,6 @@ abstract class BaseBrowserFragment : Fragment(), UserInteractionHandler, Session .collect { tab -> pipModeChanged(tab) } } - if (context.settings().waitToShowPageUntilFirstPaint) { - store.flowScoped(viewLifecycleOwner) { flow -> - flow.mapNotNull { state -> - state.findTabOrCustomTabOrSelectedTab( - customTabSessionId - ) - } - .ifChanged { it.content.firstContentfulPaint } - .collect { - val showEngineView = - it.content.firstContentfulPaint || it.content.progress == LOADING_PROGRESS_COMPLETE - - if (showEngineView) { - engineView?.asView()?.isVisible = true - swipeRefresh?.alpha = 1f - } else { - engineView?.asView()?.isVisible = false - } - } - } - } - view.swipeRefresh.isEnabled = FeatureFlags.pullToRefreshEnabled && context.settings().isPullToRefreshEnabledInBrowser if (view.swipeRefresh.isEnabled) { @@ -1153,15 +1129,6 @@ abstract class BaseBrowserFragment : Fragment(), UserInteractionHandler, Session } } - private fun didFirstContentfulHappen() = - if (components.settings.waitToShowPageUntilFirstPaint) { - val tab = - components.core.store.state.findTabOrCustomTabOrSelectedTab(customTabSessionId) - tab?.content?.firstContentfulPaint ?: false - } else { - true - } - /* * Dereference these views when the fragment view is destroyed to prevent memory leaks */ diff --git a/app/src/main/java/org/mozilla/fenix/browser/BrowserAnimator.kt b/app/src/main/java/org/mozilla/fenix/browser/BrowserAnimator.kt index fcaaadde1d..31827f2369 100644 --- a/app/src/main/java/org/mozilla/fenix/browser/BrowserAnimator.kt +++ b/app/src/main/java/org/mozilla/fenix/browser/BrowserAnimator.kt @@ -18,7 +18,6 @@ import mozilla.components.concept.engine.EngineView import org.mozilla.fenix.R import org.mozilla.fenix.components.toolbar.ToolbarPosition import org.mozilla.fenix.ext.settings -import org.mozilla.fenix.utils.Settings import java.lang.ref.WeakReference /** @@ -29,9 +28,7 @@ class BrowserAnimator( private val fragment: WeakReference, private val engineView: WeakReference, private val swipeRefresh: WeakReference, - private val viewLifecycleScope: WeakReference, - private val settings: Settings, - private val firstContentfulHappened: () -> Boolean + private val viewLifecycleScope: WeakReference ) { private val unwrappedEngineView: EngineView? @@ -41,17 +38,8 @@ class BrowserAnimator( get() = swipeRefresh.get() fun beginAnimateInIfNecessary() { - if (settings.waitToShowPageUntilFirstPaint) { - if (firstContentfulHappened()) { - viewLifecycleScope.get()?.launch { - delay(ANIMATION_DELAY) - unwrappedEngineView?.asView()?.visibility = View.VISIBLE - unwrappedSwipeRefresh?.background = null - unwrappedSwipeRefresh?.alpha = 1f - } - } - } else { - unwrappedSwipeRefresh?.alpha = 1f + viewLifecycleScope.get()?.launch { + delay(ANIMATION_DELAY) unwrappedEngineView?.asView()?.visibility = View.VISIBLE unwrappedSwipeRefresh?.background = null } diff --git a/app/src/main/java/org/mozilla/fenix/components/Core.kt b/app/src/main/java/org/mozilla/fenix/components/Core.kt index 692625567d..d3db961b8b 100644 --- a/app/src/main/java/org/mozilla/fenix/components/Core.kt +++ b/app/src/main/java/org/mozilla/fenix/components/Core.kt @@ -8,6 +8,7 @@ import GeckoProvider import android.content.Context import android.content.res.Configuration import android.os.StrictMode +import androidx.core.content.ContextCompat import io.sentry.Sentry import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.GlobalScope @@ -21,8 +22,8 @@ import mozilla.components.browser.session.SessionManager import mozilla.components.browser.session.engine.EngineMiddleware import mozilla.components.browser.session.storage.SessionStorage import mozilla.components.browser.session.undo.UndoMiddleware -import mozilla.components.browser.state.action.RestoreCompleteAction import mozilla.components.browser.state.action.RecentlyClosedAction +import mozilla.components.browser.state.action.RestoreCompleteAction import mozilla.components.browser.state.state.BrowserState import mozilla.components.browser.state.store.BrowserStore import mozilla.components.browser.storage.sync.PlacesBookmarksStorage @@ -101,7 +102,11 @@ class Core( fontInflationEnabled = context.settings().shouldUseAutoSize, suspendMediaWhenInactive = false, forceUserScalableContent = context.settings().forceEnableZoom, - loginAutofillEnabled = context.settings().shouldAutofillLogins + loginAutofillEnabled = context.settings().shouldAutofillLogins, + clearColor = ContextCompat.getColor( + context, + R.color.foundation_normal_theme + ) ) GeckoEngine( @@ -230,7 +235,8 @@ class Core( // Now that we have restored our previous state (if there's one) let's remove timed out tabs if (!context.settings().manuallyCloseTabs) { store.state.tabs.filter { - (System.currentTimeMillis() - it.lastAccess) > context.settings().getTabTimeout() + (System.currentTimeMillis() - it.lastAccess) > context.settings() + .getTabTimeout() }.forEach { val session = sessionManager.findSessionById(it.id) if (session != null) { diff --git a/app/src/main/java/org/mozilla/fenix/settings/SecretSettingsFragment.kt b/app/src/main/java/org/mozilla/fenix/settings/SecretSettingsFragment.kt index aa4c7503d8..88e1232914 100644 --- a/app/src/main/java/org/mozilla/fenix/settings/SecretSettingsFragment.kt +++ b/app/src/main/java/org/mozilla/fenix/settings/SecretSettingsFragment.kt @@ -31,12 +31,6 @@ class SecretSettingsFragment : PreferenceFragmentCompat() { onPreferenceChangeListener = SharedPreferenceUpdater() } - requirePreference(R.string.pref_key_wait_first_paint).apply { - isVisible = FeatureFlags.waitUntilPaintToDraw - isChecked = context.settings().waitToShowPageUntilFirstPaint - onPreferenceChangeListener = SharedPreferenceUpdater() - } - requirePreference(R.string.pref_key_synced_tabs_tabs_tray).apply { isVisible = FeatureFlags.syncedTabsInTabsTray isChecked = context.settings().syncedTabsInTabsTray diff --git a/app/src/main/java/org/mozilla/fenix/utils/Settings.kt b/app/src/main/java/org/mozilla/fenix/utils/Settings.kt index f1a50f454d..d9fd08908f 100644 --- a/app/src/main/java/org/mozilla/fenix/utils/Settings.kt +++ b/app/src/main/java/org/mozilla/fenix/utils/Settings.kt @@ -129,12 +129,6 @@ class Settings(private val appContext: Context) : PreferencesHolder { featureFlag = FeatureFlags.showGridViewInTabsSettings ) - var waitToShowPageUntilFirstPaint by featureFlagPreference( - appContext.getPreferenceKey(R.string.pref_key_wait_first_paint), - default = false, - featureFlag = FeatureFlags.waitUntilPaintToDraw - ) - var syncedTabsInTabsTray by featureFlagPreference( appContext.getPreferenceKey(R.string.pref_key_synced_tabs_tabs_tray), default = false, diff --git a/app/src/main/res/layout/fragment_browser.xml b/app/src/main/res/layout/fragment_browser.xml index 93fa18f61b..63150e569b 100644 --- a/app/src/main/res/layout/fragment_browser.xml +++ b/app/src/main/res/layout/fragment_browser.xml @@ -26,7 +26,6 @@ android:id="@+id/swipeRefresh" android:layout_width="match_parent" android:layout_height="match_parent" - android:alpha="0" app:layout_behavior="@string/appbar_scrolling_view_behavior"> pref_key_migrating_from_fenix_tip pref_key_master_password_tip - pref_key_wait_first_paint - pref_key_synced_tabs_tabs_tray pref_key_debug_settings diff --git a/app/src/main/res/values/static_strings.xml b/app/src/main/res/values/static_strings.xml index 51c58369f0..6acb14828c 100644 --- a/app/src/main/res/values/static_strings.xml +++ b/app/src/main/res/values/static_strings.xml @@ -34,8 +34,6 @@ Secret Settings Show Grid View in Tabs Settings - - Wait Until First Paint To Show Page Content Show Synced Tabs in the tabs tray diff --git a/app/src/main/res/xml/secret_settings_preferences.xml b/app/src/main/res/xml/secret_settings_preferences.xml index 8b53b5e22d..a0c531b5b5 100644 --- a/app/src/main/res/xml/secret_settings_preferences.xml +++ b/app/src/main/res/xml/secret_settings_preferences.xml @@ -9,11 +9,6 @@ android:key="@string/pref_key_show_grid_view_tabs_settings" android:title="@string/preferences_debug_settings_show_grid_view_tabs_settings" app:iconSpaceReserved="false" /> -