For #6441 - Only enable experiments for Beta/Prod
parent
fa780f6790
commit
1ee0703bc3
|
@ -12,6 +12,13 @@ enum class ReleaseChannel {
|
||||||
Debug -> false
|
Debug -> false
|
||||||
else -> true
|
else -> true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val isReleaseOrBeta: Boolean
|
||||||
|
get() = when (this) {
|
||||||
|
Production -> true
|
||||||
|
Beta -> true
|
||||||
|
else -> false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
object Config {
|
object Config {
|
||||||
|
|
|
@ -82,7 +82,7 @@ open class FenixApplication : Application() {
|
||||||
experimentLoader = loadExperiments()
|
experimentLoader = loadExperiments()
|
||||||
|
|
||||||
// Enable the service-experiments component
|
// Enable the service-experiments component
|
||||||
if (settings().isExperimentationEnabled) {
|
if (settings().isExperimentationEnabled && Config.channel.isReleaseOrBeta) {
|
||||||
Experiments.initialize(
|
Experiments.initialize(
|
||||||
applicationContext,
|
applicationContext,
|
||||||
mozilla.components.service.experiments.Configuration(
|
mozilla.components.service.experiments.Configuration(
|
||||||
|
|
|
@ -9,6 +9,7 @@ import android.os.Bundle
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import androidx.preference.PreferenceFragmentCompat
|
import androidx.preference.PreferenceFragmentCompat
|
||||||
import androidx.preference.SwitchPreference
|
import androidx.preference.SwitchPreference
|
||||||
|
import org.mozilla.fenix.Config
|
||||||
import org.mozilla.fenix.R
|
import org.mozilla.fenix.R
|
||||||
import org.mozilla.fenix.ext.components
|
import org.mozilla.fenix.ext.components
|
||||||
import org.mozilla.fenix.ext.getPreferenceKey
|
import org.mozilla.fenix.ext.getPreferenceKey
|
||||||
|
@ -66,6 +67,7 @@ class DataChoicesFragment : PreferenceFragmentCompat() {
|
||||||
|
|
||||||
findPreference<SwitchPreference>(getPreferenceKey(R.string.pref_key_experimentation))?.apply {
|
findPreference<SwitchPreference>(getPreferenceKey(R.string.pref_key_experimentation))?.apply {
|
||||||
isChecked = context.settings().isExperimentationEnabled
|
isChecked = context.settings().isExperimentationEnabled
|
||||||
|
isVisible = Config.channel.isReleaseOrBeta
|
||||||
onPreferenceChangeListener = SharedPreferenceUpdater()
|
onPreferenceChangeListener = SharedPreferenceUpdater()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue