Skip to content
This repository has been archived by the owner on Feb 20, 2023. It is now read-only.

Commit

Permalink
For #6441 - Only enable experiments for Beta/Prod
Browse files Browse the repository at this point in the history
  • Loading branch information
ekager committed Nov 5, 2019
1 parent fa780f6 commit 1ee0703
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
7 changes: 7 additions & 0 deletions app/src/main/java/org/mozilla/fenix/Config.kt
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/org/mozilla/fenix/FenixApplication.kt
Expand Up @@ -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(
Expand Down
Expand Up @@ -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
Expand Down Expand Up @@ -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()
}
}
Expand Down

0 comments on commit 1ee0703

Please sign in to comment.