Skip to content
This repository was archived by the owner on Apr 17, 2021. It is now read-only.

Commit e8108f1

Browse files
committed
Issue #2320 - Address experiment options nits.
1 parent e69665e commit e8108f1

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
77
## [4.0]
88
### Added
99
- Various channels containing bundled links to various video-friendly websites (#2195)
10+
- Added options to choose experiments for QA (#2320)
1011

1112
## Fixed
1213
- Fixed a bug that caused Pocket onboarding to be shown to users that don't see Pocket content (#2293)

app/src/main/java/org/mozilla/tv/firefox/IntentValidator.kt

+7-7
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ import org.mozilla.tv.firefox.ext.serviceLocator
1616
import org.mozilla.tv.firefox.telemetry.TelemetryIntegration
1717
import org.mozilla.tv.firefox.utils.UrlUtils
1818

19+
private const val EXTRA_ACTIVE_EXPERIMENTS = "qaActiveExperiments"
20+
1921
data class ValidatedIntentData(val url: String, val source: Session.Source)
2022

2123
/**
@@ -29,7 +31,6 @@ data class ValidatedIntentData(val url: String, val source: Session.Source)
2931
*/
3032
object IntentValidator {
3133
@VisibleForTesting const val DIAL_PARAMS_KEY = "com.amazon.extra.DIAL_PARAM"
32-
private const val ACTIVE_EXPERIMENTS_KEY = "activeExperiments"
3334

3435
/**
3536
* Validate that [intent] contains all expected parameters.
@@ -86,13 +87,12 @@ object IntentValidator {
8687
}
8788

8889
private fun setExperimentOverrides(intent: SafeIntent, context: Context) {
89-
intent.extras?.getStringArray(ACTIVE_EXPERIMENTS_KEY)?.let { strArray ->
90-
val fretboard = context.serviceLocator.fretboardProvider.fretboard
91-
fretboard.clearAllOverrides(context)
90+
val experimentsArray = intent.extras?.getStringArray(EXTRA_ACTIVE_EXPERIMENTS) ?: return
91+
val fretboard = context.serviceLocator.fretboardProvider.fretboard
92+
fretboard.clearAllOverrides(context)
9293

93-
strArray.forEach {
94-
fretboard.setOverride(context, ExperimentDescriptor(it), true)
95-
}
94+
experimentsArray.forEach {
95+
fretboard.setOverride(context, ExperimentDescriptor(it), true)
9696
}
9797
}
9898
}

app/src/main/java/org/mozilla/tv/firefox/experiments/ExperimentsProvider.kt

+1-2
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,7 @@ class ExperimentsProvider(private val fretboard: Fretboard, private val context:
6868

6969
val expDescriptor = checkBranchVariants(ExperimentConfig.TV_GUIDE_CHANNELS)
7070
return when {
71-
// The user is currently not part of the experiment
72-
expDescriptor == null -> false
71+
expDescriptor == null -> false // Experiment unknown, or overridden to be false.
7372
expDescriptor.name.endsWith(ExperimentSuffix.A.value) -> false
7473
expDescriptor.name.endsWith(ExperimentSuffix.B.value) -> true
7574
else -> {

0 commit comments

Comments
 (0)