Bug 1827030 - Enable juno onboarding in nightly for new users

fenix/114.1.0
rahulsainani 1 year ago committed by mergify[bot]
parent f560701bd0
commit 18d2815cd2

@ -316,6 +316,9 @@ features:
- channel: developer
value:
enabled: false
- channel: nightly
value:
enabled: true
onboarding:
description: "A feature that configures the new user onboarding page.

@ -33,7 +33,7 @@ import org.mozilla.fenix.helpers.HomeActivityTestRule
*
* Say no to main thread IO! 🙅
*/
private const val EXPECTED_SUPPRESSION_COUNT = 17
private const val EXPECTED_SUPPRESSION_COUNT = 19
/**
* The number of times we call the `runBlocking` coroutine method on the main thread during this

@ -271,7 +271,11 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity {
it.start()
}
if (settings().shouldShowJunoOnboarding(intent.toSafeIntent().isLauncherIntent)) {
if (settings().shouldShowJunoOnboarding(
hasUserBeenOnboarded = onboarding.userHasBeenOnboarded(),
isLauncherIntent = intent.toSafeIntent().isLauncherIntent,
)
) {
// Unless activity is recreated due to config change, navigate to onboarding
if (savedInstanceState == null) {
navHost.navController.navigate(NavGraphDirections.actionGlobalHomeJunoOnboarding())

@ -26,7 +26,6 @@ import org.mozilla.fenix.ext.hideToolbar
import org.mozilla.fenix.ext.nav
import org.mozilla.fenix.ext.openSetDefaultBrowserOption
import org.mozilla.fenix.ext.requireComponents
import org.mozilla.fenix.ext.settings
import org.mozilla.fenix.onboarding.view.JunoOnboardingPageType
import org.mozilla.fenix.onboarding.view.JunoOnboardingScreen
import org.mozilla.fenix.onboarding.view.telemetrySequenceId
@ -149,7 +148,6 @@ class JunoOnboardingFragment : Fragment() {
}
private fun onFinish(sequenceId: String, pageType: JunoOnboardingPageType) {
context?.settings()?.isJunoOnboardingShown = true
fenixOnboarding.finish()
findNavController().nav(
id = R.id.junoOnboardingFragment,

@ -1595,21 +1595,13 @@ class Settings(private val appContext: Context) : PreferencesHolder {
val junoOnboardingEnabled: Boolean
get() = FxNimbus.features.junoOnboarding.value().enabled
/**
* Indicates if the juno onboarding has been shown to the user.
*/
var isJunoOnboardingShown by booleanPreference(
key = appContext.getPreferenceKey(R.string.pref_key_is_juno_onboarding_shown),
default = false,
)
/**
* Returns whether juno onboarding should be shown to the user.
* @param isLauncherIntent Boolean to indicate whether the app was launched on tapping on the
* app icon.
*/
fun shouldShowJunoOnboarding(isLauncherIntent: Boolean): Boolean {
return if (!isJunoOnboardingShown && isLauncherIntent) {
fun shouldShowJunoOnboarding(hasUserBeenOnboarded: Boolean, isLauncherIntent: Boolean): Boolean {
return if (!hasUserBeenOnboarded && isLauncherIntent) {
FxNimbus.features.junoOnboarding.recordExposure()
junoOnboardingEnabled
} else {

@ -342,7 +342,4 @@
<!-- Notification Pre Permission Prompt -->
<string name="pref_key_notification_pre_permission_prompt_enabled">pref_key_notification_pre_permission_prompt_enabled</string>
<string name="pref_key_is_notification_pre_permission_prompt_shown">pref_key_is_notification_pre_permission_prompt_shown</string>
<!-- Juno Onboarding -->
<string name="pref_key_is_juno_onboarding_shown">pref_key_is_juno_onboarding_shown</string>
</resources>

@ -829,42 +829,50 @@ class SettingsTest {
fun `GIVEN junoOnboarding is disabled THEN shouldShowJunoOnboarding returns false`() {
val settings = spyk(settings)
every { settings.junoOnboardingEnabled } returns false
every { settings.isJunoOnboardingShown } returns false
val actual = settings.shouldShowJunoOnboarding(true)
val actual = settings.shouldShowJunoOnboarding(
hasUserBeenOnboarded = false,
isLauncherIntent = true,
)
assertFalse(actual)
}
@Test
fun `GIVEN junoOnboarding is enabled, isOnboardingShown is false and isLauncherIntent is false THEN shouldShowJunoOnboarding returns false`() {
fun `GIVEN junoOnboarding is enabled, hasUserBeenOnboarded is false and isLauncherIntent is false THEN shouldShowJunoOnboarding returns false`() {
val settings = spyk(settings)
every { settings.junoOnboardingEnabled } returns true
every { settings.isJunoOnboardingShown } returns false
val actual = settings.shouldShowJunoOnboarding(false)
val actual = settings.shouldShowJunoOnboarding(
hasUserBeenOnboarded = false,
isLauncherIntent = false,
)
assertFalse(actual)
}
@Test
fun `GIVEN junoOnboarding is enabled and isOnboardingShown is true THEN shouldShowJunoOnboarding returns false`() {
fun `GIVEN junoOnboarding is enabled and hasUserBeenOnboarded is true THEN shouldShowJunoOnboarding returns false`() {
val settings = spyk(settings)
every { settings.junoOnboardingEnabled } returns true
every { settings.isJunoOnboardingShown } returns true
val actual = settings.shouldShowJunoOnboarding(true)
val actual = settings.shouldShowJunoOnboarding(
hasUserBeenOnboarded = true,
isLauncherIntent = true,
)
assertFalse(actual)
}
@Test
fun `GIVEN junoOnboarding is enabled, isOnboardingShown is false and isLauncherIntent is true THEN shouldShowJunoOnboarding returns true`() {
fun `GIVEN junoOnboarding is enabled, hasUserBeenOnboarded is false and isLauncherIntent is true THEN shouldShowJunoOnboarding returns true`() {
val settings = spyk(settings)
every { settings.junoOnboardingEnabled } returns true
every { settings.isJunoOnboardingShown } returns false
val actual = settings.shouldShowJunoOnboarding(true)
val actual = settings.shouldShowJunoOnboarding(
hasUserBeenOnboarded = false,
isLauncherIntent = true,
)
assertTrue(actual)
}

Loading…
Cancel
Save