2
0
mirror of https://github.com/fork-maintainers/iceraven-browser synced 2024-11-03 23:15:31 +00:00

Bug 1830304 - Set browsing mode when redesigned onboarding is enabled

This commit is contained in:
rahulsainani 2023-05-11 10:49:59 +02:00 committed by mergify[bot]
parent 2b1fae8ada
commit 8bf1aeeca8
2 changed files with 11 additions and 1 deletions

View File

@ -40,8 +40,9 @@ class CurrentMode(
) : AccountObserver {
private val accountManager by lazy { context.components.backgroundServices.accountManager }
private val settings by lazy { context.components.settings }
fun getCurrentMode() = if (onboarding.userHasBeenOnboarded()) {
fun getCurrentMode() = if (onboarding.userHasBeenOnboarded() || settings.junoOnboardingEnabled) {
Mode.fromBrowsingMode(browsingModeManager.mode)
} else {
val account = accountManager.authenticatedAccount()

View File

@ -67,6 +67,15 @@ class ModeTest {
assertEquals(Mode.Private, currentMode.getCurrentMode())
}
@Test
fun `get current browsing mode when userHasBeenOnboarded is false and juno onboarding is enabled`() {
every { onboarding.userHasBeenOnboarded() } returns false
every { context.components.settings.junoOnboardingEnabled } returns true
every { browsingModeManager.mode } returns BrowsingMode.Normal
assertEquals(Mode.Normal, currentMode.getCurrentMode())
}
@Test
fun `get current onboarding mode when signed in`() {
every { onboarding.userHasBeenOnboarded() } returns false