2
0
mirror of https://github.com/fork-maintainers/iceraven-browser synced 2024-11-19 09:25:34 +00:00
This commit is contained in:
Roger Yang 2021-01-05 15:34:44 -05:00 committed by GitHub
parent 06b2366f85
commit 4e1f40b41b
2 changed files with 10 additions and 12 deletions

View File

@ -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)
}
/*

View File

@ -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) {