For #27127: do not display wallpaper onboarding in private browsing mode
This commit is contained in:
parent
189b22fb69
commit
521f1485e6
|
@ -510,17 +510,21 @@ class DefaultSessionControlController(
|
|||
}
|
||||
|
||||
override fun handleShowWallpapersOnboardingDialog(state: WallpaperState): Boolean {
|
||||
return state.availableWallpapers.filter { wallpaper ->
|
||||
wallpaper.thumbnailFileState == Wallpaper.ImageFileState.Downloaded
|
||||
}.size.let { downloadedCount ->
|
||||
// We only display the dialog if enough thumbnails have been downloaded for it.
|
||||
downloadedCount >= THUMBNAILS_SELECTION_COUNT
|
||||
}.also { showOnboarding ->
|
||||
if (showOnboarding) {
|
||||
navController.nav(
|
||||
R.id.homeFragment,
|
||||
HomeFragmentDirections.actionGlobalWallpaperOnboardingDialog(),
|
||||
)
|
||||
return if (activity.browsingModeManager.mode.isPrivate) {
|
||||
false
|
||||
} else {
|
||||
state.availableWallpapers.filter { wallpaper ->
|
||||
wallpaper.thumbnailFileState == Wallpaper.ImageFileState.Downloaded
|
||||
}.size.let { downloadedCount ->
|
||||
// We only display the dialog if enough thumbnails have been downloaded for it.
|
||||
downloadedCount >= THUMBNAILS_SELECTION_COUNT
|
||||
}.also { showOnboarding ->
|
||||
if (showOnboarding) {
|
||||
navController.nav(
|
||||
R.id.homeFragment,
|
||||
HomeFragmentDirections.actionGlobalWallpaperOnboardingDialog(),
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -889,7 +889,7 @@ class DefaultSessionControlControllerTest {
|
|||
false,
|
||||
),
|
||||
)
|
||||
assert(createController().handleShowWallpapersOnboardingDialog(wallpaperState))
|
||||
assertTrue(createController().handleShowWallpapersOnboardingDialog(wallpaperState))
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -900,7 +900,7 @@ class DefaultSessionControlControllerTest {
|
|||
false,
|
||||
),
|
||||
)
|
||||
assert(createController().handleShowWallpapersOnboardingDialog(wallpaperState))
|
||||
assertTrue(createController().handleShowWallpapersOnboardingDialog(wallpaperState))
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -911,7 +911,7 @@ class DefaultSessionControlControllerTest {
|
|||
true,
|
||||
),
|
||||
)
|
||||
assert(createController().handleShowWallpapersOnboardingDialog(wallpaperState))
|
||||
assertTrue(createController().handleShowWallpapersOnboardingDialog(wallpaperState))
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -922,7 +922,7 @@ class DefaultSessionControlControllerTest {
|
|||
false,
|
||||
),
|
||||
)
|
||||
assert(!createController().handleShowWallpapersOnboardingDialog(wallpaperState))
|
||||
assertFalse(createController().handleShowWallpapersOnboardingDialog(wallpaperState))
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -933,7 +933,24 @@ class DefaultSessionControlControllerTest {
|
|||
true,
|
||||
),
|
||||
)
|
||||
assert(!createController().handleShowWallpapersOnboardingDialog(wallpaperState))
|
||||
assertFalse(createController().handleShowWallpapersOnboardingDialog(wallpaperState))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `GIVEN app is in private browsing mode WHEN handling wallpaper dialog THEN the dialog is not shown`() {
|
||||
every { activity.browsingModeManager } returns mockk {
|
||||
every { mode } returns mockk {
|
||||
every { isPrivate } returns true
|
||||
}
|
||||
}
|
||||
val wallpaperState = WallpaperState.default.copy(
|
||||
availableWallpapers = makeFakeRemoteWallpapers(
|
||||
THUMBNAILS_SELECTION_COUNT,
|
||||
true,
|
||||
),
|
||||
)
|
||||
|
||||
assertFalse(createController().handleShowWallpapersOnboardingDialog(wallpaperState))
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
Loading…
Reference in New Issue