1
0
Fork 0

For #6441 - Only enable experiments for Beta/Prod

master
Emily Kager 2019-11-04 15:47:46 -08:00 committed by Emily Kager
parent fa780f6790
commit 1ee0703bc3
3 changed files with 10 additions and 1 deletions

View File

@ -12,6 +12,13 @@ enum class ReleaseChannel {
Debug -> false
else -> true
}
val isReleaseOrBeta: Boolean
get() = when (this) {
Production -> true
Beta -> true
else -> false
}
}
object Config {

View File

@ -82,7 +82,7 @@ open class FenixApplication : Application() {
experimentLoader = loadExperiments()
// Enable the service-experiments component
if (settings().isExperimentationEnabled) {
if (settings().isExperimentationEnabled && Config.channel.isReleaseOrBeta) {
Experiments.initialize(
applicationContext,
mozilla.components.service.experiments.Configuration(

View File

@ -9,6 +9,7 @@ import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import androidx.preference.PreferenceFragmentCompat
import androidx.preference.SwitchPreference
import org.mozilla.fenix.Config
import org.mozilla.fenix.R
import org.mozilla.fenix.ext.components
import org.mozilla.fenix.ext.getPreferenceKey
@ -66,6 +67,7 @@ class DataChoicesFragment : PreferenceFragmentCompat() {
findPreference<SwitchPreference>(getPreferenceKey(R.string.pref_key_experimentation))?.apply {
isChecked = context.settings().isExperimentationEnabled
isVisible = Config.channel.isReleaseOrBeta
onPreferenceChangeListener = SharedPreferenceUpdater()
}
}