Skip to content

Commit 24aea31

Browse files
mikescamellmalmstein
authored andcommitted
Add method to check membership in variant 2 cohort for tab switcher
We don't want to enrol people when checking if they should see this animation. They should already have been enrolled by this point.
1 parent 809a8ca commit 24aea31

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

app/src/main/java/com/duckduckgo/app/browser/senseofprotection/SenseOfProtectionExperimentImpl.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ interface SenseOfProtectionExperiment {
4141
fun isUserEnrolledInAVariantAndExperimentEnabled(): Boolean
4242
fun isUserEnrolledInVariant2CohortAndExperimentEnabled(): Boolean
4343
fun isUserEnrolledInModifiedControlCohortAndExperimentEnabled(): Boolean
44+
fun isMemberOfVariant2Cohort(): Boolean
4445
}
4546

4647
@ContributesBinding(
@@ -78,6 +79,10 @@ class SenseOfProtectionExperimentImpl @Inject constructor(
7879
getNewUserExperimentCohortName() == VARIANT_2.cohortName && isNewUserExperimentEnabled(VARIANT_2) ||
7980
getExistingUserExperimentCohortName() == VARIANT_2.cohortName && isExistingUserExperimentEnabled(VARIANT_2)
8081

82+
override fun isMemberOfVariant2Cohort(): Boolean =
83+
senseOfProtectionToggles.senseOfProtectionNewUserExperimentApr25().getCohort()?.name == SenseOfProtectionToggles.Cohorts.VARIANT_2.cohortName ||
84+
senseOfProtectionToggles.senseOfProtectionExistingUserExperimentApr25().getCohort()?.name == SenseOfProtectionToggles.Cohorts.VARIANT_2.cohortName
85+
8186
override fun getTabManagerPixelParams(): Map<String, String> {
8287
return when {
8388
isEnrolledInNewUserExperiment() -> {

app/src/main/java/com/duckduckgo/app/tabs/ui/TabSwitcherViewModel.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -609,7 +609,7 @@ class TabSwitcherViewModel @Inject constructor(
609609
}
610610

611611
suspend fun getNormalTabItemsWithOptionalAnimationTile(): List<TabSwitcherItem> {
612-
return if (senseOfProtectionExperiment.isUserEnrolledInVariant2CohortAndExperimentEnabled()) {
612+
return if (senseOfProtectionExperiment.isMemberOfVariant2Cohort()) {
613613
if (!isAnimationTileDismissed) {
614614
val trackerCountForLast7Days = webTrackersBlockedAppRepository.getTrackerCountForLast7Days()
615615

0 commit comments

Comments
 (0)