mirror of
https://github.com/fork-maintainers/iceraven-browser
synced 2024-11-19 09:25:34 +00:00
[fenix] Closes https://github.com/mozilla-mobile/fenix/issues/16603: Disable pull down when in fullscreen (https://github.com/mozilla-mobile/fenix/pull/17314)
This commit is contained in:
parent
06b2366f85
commit
4e1f40b41b
@ -668,7 +668,7 @@ abstract class BaseBrowserFragment : Fragment(), UserInteractionHandler,
|
||||
.collect { tab -> pipModeChanged(tab) }
|
||||
}
|
||||
|
||||
view.swipeRefresh.isEnabled = shouldPullToRefreshBeEnabled()
|
||||
view.swipeRefresh.isEnabled = shouldPullToRefreshBeEnabled(false)
|
||||
|
||||
if (view.swipeRefresh.isEnabled) {
|
||||
val primaryTextColor =
|
||||
@ -798,10 +798,10 @@ abstract class BaseBrowserFragment : Fragment(), UserInteractionHandler,
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
internal fun shouldPullToRefreshBeEnabled(): Boolean {
|
||||
internal fun shouldPullToRefreshBeEnabled(inFullScreen: Boolean): Boolean {
|
||||
return FeatureFlags.pullToRefreshEnabled &&
|
||||
requireContext().settings().isPullToRefreshEnabledInBrowser &&
|
||||
!(requireActivity() as HomeActivity).isImmersive
|
||||
!inFullScreen
|
||||
}
|
||||
|
||||
private fun initializeEngineView(toolbarHeight: Int) {
|
||||
@ -1229,6 +1229,8 @@ abstract class BaseBrowserFragment : Fragment(), UserInteractionHandler,
|
||||
initializeEngineView(toolbarHeight)
|
||||
}
|
||||
}
|
||||
|
||||
activity?.swipeRefresh?.isEnabled = shouldPullToRefreshBeEnabled(inFullScreen)
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -287,22 +287,18 @@ class BrowserFragmentTest {
|
||||
|
||||
@Test
|
||||
fun `WHEN isPullToRefreshEnabledInBrowser is disabled THEN pull down refresh is disabled`() {
|
||||
every { homeActivity.isImmersive } returns false
|
||||
every { context.settings().isPullToRefreshEnabledInBrowser } returns true
|
||||
assert(browserFragment.shouldPullToRefreshBeEnabled())
|
||||
assert(browserFragment.shouldPullToRefreshBeEnabled(false))
|
||||
|
||||
every { context.settings().isPullToRefreshEnabledInBrowser } returns false
|
||||
assert(!browserFragment.shouldPullToRefreshBeEnabled())
|
||||
assert(!browserFragment.shouldPullToRefreshBeEnabled(false))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `WHEN in immersive mode THEN pull down refresh is disabled`() {
|
||||
every { homeActivity.isImmersive } returns false
|
||||
fun `WHEN in fullscreen THEN pull down refresh is disabled`() {
|
||||
every { context.settings().isPullToRefreshEnabledInBrowser } returns true
|
||||
assert(browserFragment.shouldPullToRefreshBeEnabled())
|
||||
|
||||
every { homeActivity.isImmersive } returns true
|
||||
assert(!browserFragment.shouldPullToRefreshBeEnabled())
|
||||
assert(browserFragment.shouldPullToRefreshBeEnabled(false))
|
||||
assert(!browserFragment.shouldPullToRefreshBeEnabled(true))
|
||||
}
|
||||
|
||||
private fun addAndSelectTab(tab: TabSessionState) {
|
||||
|
Loading…
Reference in New Issue
Block a user