Revert "For #26511: Avoid waiting to set no wallpaper"
This reverts commit 4a88dbf1f1
.
This commit is contained in:
parent
a4692a67f0
commit
d39759e7ea
|
@ -115,7 +115,6 @@ import org.mozilla.fenix.tabstray.TabsTrayAccessPoint
|
|||
import org.mozilla.fenix.utils.Settings.Companion.TOP_SITES_PROVIDER_MAX_THRESHOLD
|
||||
import org.mozilla.fenix.utils.ToolbarPopupWindow
|
||||
import org.mozilla.fenix.utils.allowUndo
|
||||
import org.mozilla.fenix.wallpapers.WallpaperManager
|
||||
import java.lang.ref.WeakReference
|
||||
import kotlin.math.min
|
||||
|
||||
|
@ -419,8 +418,7 @@ class HomeFragment : Fragment() {
|
|||
|
||||
getMenuButton()?.dismissMenu()
|
||||
|
||||
val isDefaultTheCurrentWallpaper = WallpaperManager.isDefaultTheCurrentWallpaper(requireContext().settings())
|
||||
if (shouldEnableWallpaper() && !isDefaultTheCurrentWallpaper) {
|
||||
if (shouldEnableWallpaper()) {
|
||||
// Running this on the Main thread helps to ensure that the just updated configuration
|
||||
// will be used when the wallpaper is scaled to match.
|
||||
// Otherwise the portrait wallpaper may remain shown on landscape,
|
||||
|
@ -768,8 +766,7 @@ class HomeFragment : Fragment() {
|
|||
requireComponents.reviewPromptController.promptReview(requireActivity())
|
||||
}
|
||||
|
||||
val isDefaultTheCurrentWallpaper = WallpaperManager.isDefaultTheCurrentWallpaper(requireContext().settings())
|
||||
if (shouldEnableWallpaper() && !isDefaultTheCurrentWallpaper) {
|
||||
if (shouldEnableWallpaper()) {
|
||||
runBlockingIncrement {
|
||||
wallpapersObserver?.applyCurrentWallpaper()
|
||||
}
|
||||
|
|
|
@ -8,7 +8,6 @@ import android.content.Context
|
|||
import io.mockk.coVerify
|
||||
import io.mockk.every
|
||||
import io.mockk.mockk
|
||||
import io.mockk.mockkObject
|
||||
import io.mockk.mockkStatic
|
||||
import io.mockk.spyk
|
||||
import io.mockk.verify
|
||||
|
@ -32,8 +31,6 @@ import org.mozilla.fenix.ext.components
|
|||
import org.mozilla.fenix.home.HomeFragment.Companion.AMAZON_SPONSORED_TITLE
|
||||
import org.mozilla.fenix.home.HomeFragment.Companion.EBAY_SPONSORED_TITLE
|
||||
import org.mozilla.fenix.utils.Settings
|
||||
import org.mozilla.fenix.wallpapers.WallpaperManager
|
||||
import org.mozilla.fenix.wallpapers.WallpaperManager.Companion.isDefaultTheCurrentWallpaper
|
||||
|
||||
class HomeFragmentTest {
|
||||
|
||||
|
@ -112,7 +109,7 @@ class HomeFragmentTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
fun `GIVEN the user is in normal mode and has a custom wallpaper chosen WHEN configuration changes THEN the wallpaper is reapplied`() = runTest {
|
||||
fun `GIVEN the user is in normal mode WHEN configuration changes THEN the wallpaper is reapplied`() = runTest {
|
||||
homeFragment.getMenuButton = { null }
|
||||
val observer: WallpapersObserver = mockk(relaxed = true)
|
||||
homeFragment.wallpapersObserver = observer
|
||||
|
@ -120,31 +117,10 @@ class HomeFragmentTest {
|
|||
every { themeManager.currentTheme.isPrivate } returns false
|
||||
}
|
||||
every { homeFragment.activity } returns activity
|
||||
mockkObject(WallpaperManager.Companion) {
|
||||
every { isDefaultTheCurrentWallpaper(any()) } returns false
|
||||
|
||||
homeFragment.onConfigurationChanged(mockk(relaxed = true))
|
||||
homeFragment.onConfigurationChanged(mockk(relaxed = true))
|
||||
|
||||
coVerify { observer.applyCurrentWallpaper() }
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `GIVEN the user is in normal mode and has no custom wallpaper chosen WHEN configuration changes THEN do no try to apply a wallpaper`() = runTest {
|
||||
homeFragment.getMenuButton = { null }
|
||||
val observer: WallpapersObserver = mockk(relaxed = true)
|
||||
homeFragment.wallpapersObserver = observer
|
||||
val activity: HomeActivity = mockk {
|
||||
every { themeManager.currentTheme.isPrivate } returns false
|
||||
}
|
||||
every { homeFragment.activity } returns activity
|
||||
mockkObject(WallpaperManager.Companion) {
|
||||
every { isDefaultTheCurrentWallpaper(any()) } returns true
|
||||
|
||||
homeFragment.onConfigurationChanged(mockk(relaxed = true))
|
||||
|
||||
coVerify(exactly = 0) { observer.applyCurrentWallpaper() }
|
||||
}
|
||||
coVerify { observer.applyCurrentWallpaper() }
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
Loading…
Reference in New Issue