Prepare nimbus features default values for release 95

This commit is contained in:
Arturo Mejia 2021-10-07 16:15:21 -04:00 committed by mergify[bot]
parent a77091dc5b
commit 3f9d277566

View File

@ -6,7 +6,6 @@ package org.mozilla.fenix.experiments
import android.content.Context import android.content.Context
import org.mozilla.experiments.nimbus.mapKeysAsEnums import org.mozilla.experiments.nimbus.mapKeysAsEnums
import org.mozilla.fenix.Config
import org.mozilla.fenix.FeatureFlags import org.mozilla.fenix.FeatureFlags
import org.mozilla.fenix.ext.components import org.mozilla.fenix.ext.components
import org.mozilla.fenix.ext.getVariables import org.mozilla.fenix.ext.getVariables
@ -51,10 +50,10 @@ class NimbusFeatures(private val context: Context) {
@Suppress("EnumNaming") @Suppress("EnumNaming")
private enum class HomeScreenSection(val default: Boolean) { private enum class HomeScreenSection(val default: Boolean) {
topSites(true), topSites(true),
recentlySaved(false), recentlySaved(true),
jumpBackIn(false), jumpBackIn(true),
pocket(false), pocket(true),
recentExplorations(false); recentExplorations(true);
companion object { companion object {
/** /**
@ -62,12 +61,12 @@ class NimbusFeatures(private val context: Context) {
*/ */
fun toMap(context: Context): Map<HomeScreenSection, Boolean> { fun toMap(context: Context): Map<HomeScreenSection, Boolean> {
return values().associate { section -> return values().associate { section ->
val channelDefault = if (section == pocket && Config.channel.isNightlyOrDebug) { val value = if (section == pocket) {
FeatureFlags.isPocketRecommendationsFeatureEnabled(context) FeatureFlags.isPocketRecommendationsFeatureEnabled(context)
} else { } else {
Config.channel.isNightlyOrDebug section.default
} }
section to (channelDefault || section.default) section to value
} }
} }
} }