mirror of
https://github.com/fork-maintainers/iceraven-browser
synced 2024-11-19 09:25:34 +00:00
[fenix] For https://github.com/mozilla-mobile/fenix/issues/6313 - Set session ClearColor through Engine DefaultSettings
This commit is contained in:
parent
18012e4cfc
commit
f3d03c5e73
@ -26,11 +26,6 @@ object FeatureFlags {
|
|||||||
*/
|
*/
|
||||||
val showGridViewInTabsSettings = Config.channel.isNightlyOrDebug
|
val showGridViewInTabsSettings = Config.channel.isNightlyOrDebug
|
||||||
|
|
||||||
/**
|
|
||||||
* Enables wait til first contentful paint
|
|
||||||
*/
|
|
||||||
val waitUntilPaintToDraw = Config.channel.isNightlyOrDebug
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enables downloads with external download managers.
|
* Enables downloads with external download managers.
|
||||||
*/
|
*/
|
||||||
|
@ -247,9 +247,7 @@ abstract class BaseBrowserFragment : Fragment(), UserInteractionHandler, Session
|
|||||||
fragment = WeakReference(this),
|
fragment = WeakReference(this),
|
||||||
engineView = WeakReference(engineView),
|
engineView = WeakReference(engineView),
|
||||||
swipeRefresh = WeakReference(swipeRefresh),
|
swipeRefresh = WeakReference(swipeRefresh),
|
||||||
viewLifecycleScope = WeakReference(viewLifecycleOwner.lifecycleScope),
|
viewLifecycleScope = WeakReference(viewLifecycleOwner.lifecycleScope)
|
||||||
settings = context.components.settings,
|
|
||||||
firstContentfulHappened = ::didFirstContentfulHappen
|
|
||||||
).apply {
|
).apply {
|
||||||
beginAnimateInIfNecessary()
|
beginAnimateInIfNecessary()
|
||||||
}
|
}
|
||||||
@ -659,28 +657,6 @@ abstract class BaseBrowserFragment : Fragment(), UserInteractionHandler, Session
|
|||||||
.collect { tab -> pipModeChanged(tab) }
|
.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 =
|
view.swipeRefresh.isEnabled =
|
||||||
FeatureFlags.pullToRefreshEnabled && context.settings().isPullToRefreshEnabledInBrowser
|
FeatureFlags.pullToRefreshEnabled && context.settings().isPullToRefreshEnabledInBrowser
|
||||||
if (view.swipeRefresh.isEnabled) {
|
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
|
* Dereference these views when the fragment view is destroyed to prevent memory leaks
|
||||||
*/
|
*/
|
||||||
|
@ -18,7 +18,6 @@ import mozilla.components.concept.engine.EngineView
|
|||||||
import org.mozilla.fenix.R
|
import org.mozilla.fenix.R
|
||||||
import org.mozilla.fenix.components.toolbar.ToolbarPosition
|
import org.mozilla.fenix.components.toolbar.ToolbarPosition
|
||||||
import org.mozilla.fenix.ext.settings
|
import org.mozilla.fenix.ext.settings
|
||||||
import org.mozilla.fenix.utils.Settings
|
|
||||||
import java.lang.ref.WeakReference
|
import java.lang.ref.WeakReference
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -29,9 +28,7 @@ class BrowserAnimator(
|
|||||||
private val fragment: WeakReference<Fragment>,
|
private val fragment: WeakReference<Fragment>,
|
||||||
private val engineView: WeakReference<EngineView>,
|
private val engineView: WeakReference<EngineView>,
|
||||||
private val swipeRefresh: WeakReference<View>,
|
private val swipeRefresh: WeakReference<View>,
|
||||||
private val viewLifecycleScope: WeakReference<LifecycleCoroutineScope>,
|
private val viewLifecycleScope: WeakReference<LifecycleCoroutineScope>
|
||||||
private val settings: Settings,
|
|
||||||
private val firstContentfulHappened: () -> Boolean
|
|
||||||
) {
|
) {
|
||||||
|
|
||||||
private val unwrappedEngineView: EngineView?
|
private val unwrappedEngineView: EngineView?
|
||||||
@ -41,17 +38,8 @@ class BrowserAnimator(
|
|||||||
get() = swipeRefresh.get()
|
get() = swipeRefresh.get()
|
||||||
|
|
||||||
fun beginAnimateInIfNecessary() {
|
fun beginAnimateInIfNecessary() {
|
||||||
if (settings.waitToShowPageUntilFirstPaint) {
|
viewLifecycleScope.get()?.launch {
|
||||||
if (firstContentfulHappened()) {
|
delay(ANIMATION_DELAY)
|
||||||
viewLifecycleScope.get()?.launch {
|
|
||||||
delay(ANIMATION_DELAY)
|
|
||||||
unwrappedEngineView?.asView()?.visibility = View.VISIBLE
|
|
||||||
unwrappedSwipeRefresh?.background = null
|
|
||||||
unwrappedSwipeRefresh?.alpha = 1f
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
unwrappedSwipeRefresh?.alpha = 1f
|
|
||||||
unwrappedEngineView?.asView()?.visibility = View.VISIBLE
|
unwrappedEngineView?.asView()?.visibility = View.VISIBLE
|
||||||
unwrappedSwipeRefresh?.background = null
|
unwrappedSwipeRefresh?.background = null
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,7 @@ import GeckoProvider
|
|||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.res.Configuration
|
import android.content.res.Configuration
|
||||||
import android.os.StrictMode
|
import android.os.StrictMode
|
||||||
|
import androidx.core.content.ContextCompat
|
||||||
import io.sentry.Sentry
|
import io.sentry.Sentry
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.GlobalScope
|
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.engine.EngineMiddleware
|
||||||
import mozilla.components.browser.session.storage.SessionStorage
|
import mozilla.components.browser.session.storage.SessionStorage
|
||||||
import mozilla.components.browser.session.undo.UndoMiddleware
|
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.RecentlyClosedAction
|
||||||
|
import mozilla.components.browser.state.action.RestoreCompleteAction
|
||||||
import mozilla.components.browser.state.state.BrowserState
|
import mozilla.components.browser.state.state.BrowserState
|
||||||
import mozilla.components.browser.state.store.BrowserStore
|
import mozilla.components.browser.state.store.BrowserStore
|
||||||
import mozilla.components.browser.storage.sync.PlacesBookmarksStorage
|
import mozilla.components.browser.storage.sync.PlacesBookmarksStorage
|
||||||
@ -101,7 +102,11 @@ class Core(
|
|||||||
fontInflationEnabled = context.settings().shouldUseAutoSize,
|
fontInflationEnabled = context.settings().shouldUseAutoSize,
|
||||||
suspendMediaWhenInactive = false,
|
suspendMediaWhenInactive = false,
|
||||||
forceUserScalableContent = context.settings().forceEnableZoom,
|
forceUserScalableContent = context.settings().forceEnableZoom,
|
||||||
loginAutofillEnabled = context.settings().shouldAutofillLogins
|
loginAutofillEnabled = context.settings().shouldAutofillLogins,
|
||||||
|
clearColor = ContextCompat.getColor(
|
||||||
|
context,
|
||||||
|
R.color.foundation_normal_theme
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
GeckoEngine(
|
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
|
// Now that we have restored our previous state (if there's one) let's remove timed out tabs
|
||||||
if (!context.settings().manuallyCloseTabs) {
|
if (!context.settings().manuallyCloseTabs) {
|
||||||
store.state.tabs.filter {
|
store.state.tabs.filter {
|
||||||
(System.currentTimeMillis() - it.lastAccess) > context.settings().getTabTimeout()
|
(System.currentTimeMillis() - it.lastAccess) > context.settings()
|
||||||
|
.getTabTimeout()
|
||||||
}.forEach {
|
}.forEach {
|
||||||
val session = sessionManager.findSessionById(it.id)
|
val session = sessionManager.findSessionById(it.id)
|
||||||
if (session != null) {
|
if (session != null) {
|
||||||
|
@ -31,12 +31,6 @@ class SecretSettingsFragment : PreferenceFragmentCompat() {
|
|||||||
onPreferenceChangeListener = SharedPreferenceUpdater()
|
onPreferenceChangeListener = SharedPreferenceUpdater()
|
||||||
}
|
}
|
||||||
|
|
||||||
requirePreference<SwitchPreference>(R.string.pref_key_wait_first_paint).apply {
|
|
||||||
isVisible = FeatureFlags.waitUntilPaintToDraw
|
|
||||||
isChecked = context.settings().waitToShowPageUntilFirstPaint
|
|
||||||
onPreferenceChangeListener = SharedPreferenceUpdater()
|
|
||||||
}
|
|
||||||
|
|
||||||
requirePreference<SwitchPreference>(R.string.pref_key_synced_tabs_tabs_tray).apply {
|
requirePreference<SwitchPreference>(R.string.pref_key_synced_tabs_tabs_tray).apply {
|
||||||
isVisible = FeatureFlags.syncedTabsInTabsTray
|
isVisible = FeatureFlags.syncedTabsInTabsTray
|
||||||
isChecked = context.settings().syncedTabsInTabsTray
|
isChecked = context.settings().syncedTabsInTabsTray
|
||||||
|
@ -129,12 +129,6 @@ class Settings(private val appContext: Context) : PreferencesHolder {
|
|||||||
featureFlag = FeatureFlags.showGridViewInTabsSettings
|
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(
|
var syncedTabsInTabsTray by featureFlagPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_synced_tabs_tabs_tray),
|
appContext.getPreferenceKey(R.string.pref_key_synced_tabs_tabs_tray),
|
||||||
default = false,
|
default = false,
|
||||||
|
@ -26,7 +26,6 @@
|
|||||||
android:id="@+id/swipeRefresh"
|
android:id="@+id/swipeRefresh"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:alpha="0"
|
|
||||||
app:layout_behavior="@string/appbar_scrolling_view_behavior">
|
app:layout_behavior="@string/appbar_scrolling_view_behavior">
|
||||||
|
|
||||||
<mozilla.components.concept.engine.EngineView
|
<mozilla.components.concept.engine.EngineView
|
||||||
|
@ -202,8 +202,6 @@
|
|||||||
<string name="pref_key_migrating_from_fenix_tip" translatable="false">pref_key_migrating_from_fenix_tip</string>
|
<string name="pref_key_migrating_from_fenix_tip" translatable="false">pref_key_migrating_from_fenix_tip</string>
|
||||||
<string name="pref_key_master_password_tip" translatable="false">pref_key_master_password_tip</string>
|
<string name="pref_key_master_password_tip" translatable="false">pref_key_master_password_tip</string>
|
||||||
|
|
||||||
<string name="pref_key_wait_first_paint" translatable="false">pref_key_wait_first_paint</string>
|
|
||||||
|
|
||||||
<string name="pref_key_synced_tabs_tabs_tray" translatable="false">pref_key_synced_tabs_tabs_tray</string>
|
<string name="pref_key_synced_tabs_tabs_tray" translatable="false">pref_key_synced_tabs_tabs_tray</string>
|
||||||
|
|
||||||
<string name="pref_key_debug_settings" translatable="false">pref_key_debug_settings</string>
|
<string name="pref_key_debug_settings" translatable="false">pref_key_debug_settings</string>
|
||||||
|
@ -34,8 +34,6 @@
|
|||||||
<string name="preferences_debug_settings">Secret Settings</string>
|
<string name="preferences_debug_settings">Secret Settings</string>
|
||||||
<!-- Label for the show grid view in tabs setting preference -->
|
<!-- Label for the show grid view in tabs setting preference -->
|
||||||
<string name="preferences_debug_settings_show_grid_view_tabs_settings">Show Grid View in Tabs Settings</string>
|
<string name="preferences_debug_settings_show_grid_view_tabs_settings">Show Grid View in Tabs Settings</string>
|
||||||
<!-- Label for the wait until first paint preference -->
|
|
||||||
<string name="preferences_debug_settings_wait_first_paint">Wait Until First Paint To Show Page Content</string>
|
|
||||||
<!-- Label for showing Synced Tabs in the tabs tray -->
|
<!-- Label for showing Synced Tabs in the tabs tray -->
|
||||||
<string name="preferences_debug_synced_tabs_tabs_tray">Show Synced Tabs in the tabs tray</string>
|
<string name="preferences_debug_synced_tabs_tabs_tray">Show Synced Tabs in the tabs tray</string>
|
||||||
|
|
||||||
|
@ -9,11 +9,6 @@
|
|||||||
android:key="@string/pref_key_show_grid_view_tabs_settings"
|
android:key="@string/pref_key_show_grid_view_tabs_settings"
|
||||||
android:title="@string/preferences_debug_settings_show_grid_view_tabs_settings"
|
android:title="@string/preferences_debug_settings_show_grid_view_tabs_settings"
|
||||||
app:iconSpaceReserved="false" />
|
app:iconSpaceReserved="false" />
|
||||||
<SwitchPreference
|
|
||||||
android:defaultValue="false"
|
|
||||||
android:key="@string/pref_key_wait_first_paint"
|
|
||||||
android:title="@string/preferences_debug_settings_wait_first_paint"
|
|
||||||
app:iconSpaceReserved="false" />
|
|
||||||
<SwitchPreference
|
<SwitchPreference
|
||||||
android:defaultValue="false"
|
android:defaultValue="false"
|
||||||
android:key="@string/pref_key_synced_tabs_tabs_tray"
|
android:key="@string/pref_key_synced_tabs_tabs_tray"
|
||||||
|
Loading…
Reference in New Issue
Block a user