Skip to content

Commit 381c117

Browse files
authored
Sense of Protection Experiment: Add new experiments (#6071)
Task/Issue URL: https://app.asana.com/1/137249556945/project/1207908166761516/task/1210235542874003 ### Description Update the Sense of Protection experiment toggle names from April to May, changing all references from `senseOfProtectionNewUserExperimentApr25()` to `senseOfProtectionNewUserExperimentMay25()` and `senseOfProtectionExistingUserExperimentApr25()` to `senseOfProtectionExistingUserExperimentMay25()`. ### Steps to test this PR _Sense of Protection Experiment_ - [ ] Verify that the experiment toggles work correctly in the internal app - [ ] Check that the experiment enrollment works as expected for both new and existing users - [ ] Confirm that the survey parameters still function properly with the updated toggle names ### UI changes No UI changes in this PR.
1 parent cc11a20 commit 381c117

File tree

7 files changed

+51
-51
lines changed

7 files changed

+51
-51
lines changed

app/src/internal/java/experiments/trackersblocking/TrackersBlockingExperimentViewModel.kt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class TrackersBlockingExperimentViewModel @Inject constructor(
5858
viewModelScope.launch(dispatchers.io()) {
5959
val enrollmentDateET = ZonedDateTime.now(ZoneId.of("America/New_York")).toString()
6060
if (checked) {
61-
senseOfProtectionToggles.senseOfProtectionExistingUserExperimentApr25().setRawStoredState(
61+
senseOfProtectionToggles.senseOfProtectionExistingUserExperimentMay25().setRawStoredState(
6262
State(
6363
remoteEnableState = true,
6464
enable = true,
@@ -71,7 +71,7 @@ class TrackersBlockingExperimentViewModel @Inject constructor(
7171
),
7272
)
7373
} else {
74-
senseOfProtectionToggles.senseOfProtectionExistingUserExperimentApr25().setRawStoredState(
74+
senseOfProtectionToggles.senseOfProtectionExistingUserExperimentMay25().setRawStoredState(
7575
State(
7676
remoteEnableState = false,
7777
enable = false,
@@ -93,7 +93,7 @@ class TrackersBlockingExperimentViewModel @Inject constructor(
9393
viewModelScope.launch(dispatchers.io()) {
9494
val enrollmentDateET = ZonedDateTime.now(ZoneId.of("America/New_York")).toString()
9595
if (checked) {
96-
senseOfProtectionToggles.senseOfProtectionExistingUserExperimentApr25().setRawStoredState(
96+
senseOfProtectionToggles.senseOfProtectionExistingUserExperimentMay25().setRawStoredState(
9797
State(
9898
remoteEnableState = true,
9999
enable = true,
@@ -106,7 +106,7 @@ class TrackersBlockingExperimentViewModel @Inject constructor(
106106
),
107107
)
108108
} else {
109-
senseOfProtectionToggles.senseOfProtectionExistingUserExperimentApr25().setRawStoredState(
109+
senseOfProtectionToggles.senseOfProtectionExistingUserExperimentMay25().setRawStoredState(
110110
State(
111111
remoteEnableState = false,
112112
enable = false,
@@ -128,7 +128,7 @@ class TrackersBlockingExperimentViewModel @Inject constructor(
128128
viewModelScope.launch(dispatchers.io()) {
129129
val enrollmentDateET = ZonedDateTime.now(ZoneId.of("America/New_York")).toString()
130130
if (checked) {
131-
senseOfProtectionToggles.senseOfProtectionExistingUserExperimentApr25().setRawStoredState(
131+
senseOfProtectionToggles.senseOfProtectionExistingUserExperimentMay25().setRawStoredState(
132132
State(
133133
remoteEnableState = true,
134134
enable = true,
@@ -141,7 +141,7 @@ class TrackersBlockingExperimentViewModel @Inject constructor(
141141
),
142142
)
143143
} else {
144-
senseOfProtectionToggles.senseOfProtectionExistingUserExperimentApr25().setRawStoredState(
144+
senseOfProtectionToggles.senseOfProtectionExistingUserExperimentMay25().setRawStoredState(
145145
State(
146146
remoteEnableState = false,
147147
enable = false,

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -132,11 +132,11 @@ class SenseOfProtectionExperimentImpl @Inject constructor(
132132
}
133133

134134
private fun enrollInNewUserExperiment(cohortName: CohortName): Boolean {
135-
return senseOfProtectionToggles.senseOfProtectionNewUserExperimentApr25().isEnabled(cohortName)
135+
return senseOfProtectionToggles.senseOfProtectionNewUserExperimentMay25().isEnabled(cohortName)
136136
}
137137

138138
private fun enrollInExistingUserExperiment(cohortName: CohortName): Boolean {
139-
return senseOfProtectionToggles.senseOfProtectionExistingUserExperimentApr25().isEnabled(cohortName)
139+
return senseOfProtectionToggles.senseOfProtectionExistingUserExperimentMay25().isEnabled(cohortName)
140140
}
141141

142142
private fun isUserEnrolledInNewUserExperimentModifiedControlCohortAndExperimentEnabled(): Boolean =
@@ -172,22 +172,22 @@ class SenseOfProtectionExperimentImpl @Inject constructor(
172172
}
173173

174174
private fun isNewUserExperimentEnabled(cohortName: CohortName): Boolean =
175-
senseOfProtectionToggles.senseOfProtectionNewUserExperimentApr25().isEnrolledAndEnabled(cohortName)
175+
senseOfProtectionToggles.senseOfProtectionNewUserExperimentMay25().isEnrolledAndEnabled(cohortName)
176176

177177
private fun isExistingUserExperimentEnabled(cohortName: CohortName): Boolean =
178-
senseOfProtectionToggles.senseOfProtectionExistingUserExperimentApr25().isEnrolledAndEnabled(cohortName)
178+
senseOfProtectionToggles.senseOfProtectionExistingUserExperimentMay25().isEnrolledAndEnabled(cohortName)
179179

180180
private fun getNewUserExperimentCohortName(): String? =
181-
senseOfProtectionToggles.senseOfProtectionNewUserExperimentApr25().getCohort()?.name
181+
senseOfProtectionToggles.senseOfProtectionNewUserExperimentMay25().getCohort()?.name
182182

183183
private fun getNewUserExperimentName(): String =
184-
senseOfProtectionToggles.senseOfProtectionNewUserExperimentApr25().featureName().name
184+
senseOfProtectionToggles.senseOfProtectionNewUserExperimentMay25().featureName().name
185185

186186
private fun getExistingUserExperimentCohortName(): String? =
187-
senseOfProtectionToggles.senseOfProtectionExistingUserExperimentApr25().getCohort()?.name
187+
senseOfProtectionToggles.senseOfProtectionExistingUserExperimentMay25().getCohort()?.name
188188

189189
private fun getExistingUserExperimentName(): String =
190-
senseOfProtectionToggles.senseOfProtectionExistingUserExperimentApr25().featureName().name
190+
senseOfProtectionToggles.senseOfProtectionExistingUserExperimentMay25().featureName().name
191191

192192
private fun MetricsPixel.fire() = getPixelDefinitions().forEach {
193193
pixel.fire(it.pixelName, it.params)

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ interface SenseOfProtectionToggles {
4040
fun self(): Toggle
4141

4242
@Toggle.DefaultValue(DefaultFeatureValue.FALSE)
43-
fun senseOfProtectionNewUserExperimentApr25(): Toggle
43+
fun senseOfProtectionNewUserExperimentMay25(): Toggle
4444

4545
@Toggle.DefaultValue(DefaultFeatureValue.FALSE)
46-
fun senseOfProtectionExistingUserExperimentApr25(): Toggle
46+
fun senseOfProtectionExistingUserExperimentMay25(): Toggle
4747

4848
enum class Cohorts(override val cohortName: String) : CohortName {
4949
MODIFIED_CONTROL("modifiedControl"), // without grey tracker logos from original animation

app/src/main/java/com/duckduckgo/app/survey/rmf/TemporaryDefaultSurveyParameters.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,5 @@ class SenseOfProtectionCohortSurveyParameterPlugin @Inject constructor(
2929
) : SurveyParameterPlugin {
3030
override val surveyParamKey: String = "senseProtectionCohort"
3131

32-
override suspend fun evaluate(): String = senseOfProtectionToggles.senseOfProtectionNewUserExperimentApr25().getCohort()?.name.orEmpty()
32+
override suspend fun evaluate(): String = senseOfProtectionToggles.senseOfProtectionNewUserExperimentMay25().getCohort()?.name.orEmpty()
3333
}

app/src/test/java/com/duckduckgo/app/browser/senseofprotection/SenseOfProtectionExperimentImplTest.kt

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ class SenseOfProtectionExperimentImplTest {
7777
@Test
7878
fun `when user is new and enrolUserInNewExperimentIfEligible then user is in enrolled`() {
7979
fakeUserBrowserProperties.setDaysSinceInstalled(28)
80-
fakeSenseOfProtectionToggles.senseOfProtectionNewUserExperimentApr25().setRawStoredState(
80+
fakeSenseOfProtectionToggles.senseOfProtectionNewUserExperimentMay25().setRawStoredState(
8181
State(
8282
remoteEnableState = true,
8383
enable = true,
@@ -94,7 +94,7 @@ class SenseOfProtectionExperimentImplTest {
9494
@Test
9595
fun `when user is new and experiment is enabled but for different cohort then isEnabled returns false`() {
9696
fakeUserBrowserProperties.setDaysSinceInstalled(20)
97-
fakeSenseOfProtectionToggles.senseOfProtectionNewUserExperimentApr25().setRawStoredState(
97+
fakeSenseOfProtectionToggles.senseOfProtectionNewUserExperimentMay25().setRawStoredState(
9898
State(
9999
remoteEnableState = true,
100100
enable = true,
@@ -109,7 +109,7 @@ class SenseOfProtectionExperimentImplTest {
109109
@Test
110110
fun `when user is new and experiment is disabled then isEnabled returns false`() {
111111
fakeUserBrowserProperties.setDaysSinceInstalled(10)
112-
fakeSenseOfProtectionToggles.senseOfProtectionNewUserExperimentApr25().setRawStoredState(
112+
fakeSenseOfProtectionToggles.senseOfProtectionNewUserExperimentMay25().setRawStoredState(
113113
State(
114114
remoteEnableState = false,
115115
enable = false,
@@ -123,7 +123,7 @@ class SenseOfProtectionExperimentImplTest {
123123

124124
@Test
125125
fun `when user is enrolled in new user experiment then getTabManagerPixelParams returns new user experiment params`() {
126-
fakeSenseOfProtectionToggles.senseOfProtectionNewUserExperimentApr25().setRawStoredState(
126+
fakeSenseOfProtectionToggles.senseOfProtectionNewUserExperimentMay25().setRawStoredState(
127127
State(
128128
remoteEnableState = true,
129129
enable = true,
@@ -135,12 +135,12 @@ class SenseOfProtectionExperimentImplTest {
135135
val params = testee.getTabManagerPixelParams()
136136

137137
assertEquals(VARIANT_1.cohortName, params["cohort"])
138-
assertEquals(fakeSenseOfProtectionToggles.senseOfProtectionNewUserExperimentApr25().featureName().name, params["experiment"])
138+
assertEquals(fakeSenseOfProtectionToggles.senseOfProtectionNewUserExperimentMay25().featureName().name, params["experiment"])
139139
}
140140

141141
@Test
142142
fun `when user is enrolled in new user experiment but experiment is disabled then getTabManagerPixelParams returns empty map`() {
143-
fakeSenseOfProtectionToggles.senseOfProtectionNewUserExperimentApr25().setRawStoredState(
143+
fakeSenseOfProtectionToggles.senseOfProtectionNewUserExperimentMay25().setRawStoredState(
144144
State(
145145
remoteEnableState = false,
146146
enable = false,
@@ -156,7 +156,7 @@ class SenseOfProtectionExperimentImplTest {
156156

157157
@Test
158158
fun `when user is enrolled in existing user experiment then getTabManagerPixelParams returns existing user experiment params`() {
159-
fakeSenseOfProtectionToggles.senseOfProtectionExistingUserExperimentApr25().setRawStoredState(
159+
fakeSenseOfProtectionToggles.senseOfProtectionExistingUserExperimentMay25().setRawStoredState(
160160
State(
161161
remoteEnableState = true,
162162
enable = true,
@@ -168,12 +168,12 @@ class SenseOfProtectionExperimentImplTest {
168168
val params = testee.getTabManagerPixelParams()
169169

170170
assertEquals(VARIANT_2.cohortName, params["cohort"])
171-
assertEquals(fakeSenseOfProtectionToggles.senseOfProtectionExistingUserExperimentApr25().featureName().name, params["experiment"])
171+
assertEquals(fakeSenseOfProtectionToggles.senseOfProtectionExistingUserExperimentMay25().featureName().name, params["experiment"])
172172
}
173173

174174
@Test
175175
fun `when user is enrolled in existing user experiment but experiment is disabled then getTabManagerPixelParams returns empty map`() {
176-
fakeSenseOfProtectionToggles.senseOfProtectionExistingUserExperimentApr25().setRawStoredState(
176+
fakeSenseOfProtectionToggles.senseOfProtectionExistingUserExperimentMay25().setRawStoredState(
177177
State(
178178
remoteEnableState = false,
179179
enable = false,
@@ -190,15 +190,15 @@ class SenseOfProtectionExperimentImplTest {
190190
@Test
191191
fun `when user is not enrolled in any experiment then getTabManagerPixelParams returns empty map`() {
192192
fakeUserBrowserProperties.setDaysSinceInstalled(30)
193-
fakeSenseOfProtectionToggles.senseOfProtectionNewUserExperimentApr25().setRawStoredState(
193+
fakeSenseOfProtectionToggles.senseOfProtectionNewUserExperimentMay25().setRawStoredState(
194194
State(
195195
remoteEnableState = false,
196196
enable = false,
197197
assignedCohort = null,
198198
cohorts = emptyList(),
199199
),
200200
)
201-
fakeSenseOfProtectionToggles.senseOfProtectionExistingUserExperimentApr25().setRawStoredState(
201+
fakeSenseOfProtectionToggles.senseOfProtectionExistingUserExperimentMay25().setRawStoredState(
202202
State(
203203
remoteEnableState = false,
204204
enable = false,
@@ -214,7 +214,7 @@ class SenseOfProtectionExperimentImplTest {
214214

215215
@Test
216216
fun `when user is enrolled in modified control variant then we can detect it`() {
217-
fakeSenseOfProtectionToggles.senseOfProtectionNewUserExperimentApr25().setRawStoredState(
217+
fakeSenseOfProtectionToggles.senseOfProtectionNewUserExperimentMay25().setRawStoredState(
218218
State(
219219
remoteEnableState = true,
220220
enable = true,
@@ -232,7 +232,7 @@ class SenseOfProtectionExperimentImplTest {
232232

233233
@Test
234234
fun `when user is enrolled in variant 1 then other variants are not enabled`() {
235-
fakeSenseOfProtectionToggles.senseOfProtectionNewUserExperimentApr25().setRawStoredState(
235+
fakeSenseOfProtectionToggles.senseOfProtectionNewUserExperimentMay25().setRawStoredState(
236236
State(
237237
remoteEnableState = true,
238238
enable = true,
@@ -250,7 +250,7 @@ class SenseOfProtectionExperimentImplTest {
250250

251251
@Test
252252
fun `when user is enrolled in variant 2 then other variants are not enabled`() {
253-
fakeSenseOfProtectionToggles.senseOfProtectionNewUserExperimentApr25().setRawStoredState(
253+
fakeSenseOfProtectionToggles.senseOfProtectionNewUserExperimentMay25().setRawStoredState(
254254
State(
255255
remoteEnableState = true,
256256
enable = true,
@@ -269,7 +269,7 @@ class SenseOfProtectionExperimentImplTest {
269269
@Test
270270
fun `when user is enrolled in modified control then legacy privacy shield is shown`() {
271271
fakeUserBrowserProperties.setDaysSinceInstalled(20)
272-
fakeSenseOfProtectionToggles.senseOfProtectionNewUserExperimentApr25().setRawStoredState(
272+
fakeSenseOfProtectionToggles.senseOfProtectionNewUserExperimentMay25().setRawStoredState(
273273
State(
274274
remoteEnableState = true,
275275
enable = true,
@@ -284,7 +284,7 @@ class SenseOfProtectionExperimentImplTest {
284284
@Test
285285
fun `when user is not enrolled in any variant`() {
286286
fakeUserBrowserProperties.setDaysSinceInstalled(20)
287-
fakeSenseOfProtectionToggles.senseOfProtectionNewUserExperimentApr25().setRawStoredState(
287+
fakeSenseOfProtectionToggles.senseOfProtectionNewUserExperimentMay25().setRawStoredState(
288288
State(
289289
remoteEnableState = true,
290290
enable = true,
@@ -298,7 +298,7 @@ class SenseOfProtectionExperimentImplTest {
298298
@Test
299299
fun `when user is enrolled in variant 1 then new privacy shield is shown`() {
300300
fakeUserBrowserProperties.setDaysSinceInstalled(20)
301-
fakeSenseOfProtectionToggles.senseOfProtectionNewUserExperimentApr25().setRawStoredState(
301+
fakeSenseOfProtectionToggles.senseOfProtectionNewUserExperimentMay25().setRawStoredState(
302302
State(
303303
remoteEnableState = true,
304304
enable = true,
@@ -313,7 +313,7 @@ class SenseOfProtectionExperimentImplTest {
313313
@Test
314314
fun `when user is enrolled in variant 2 then new privacy shield is shown`() {
315315
fakeUserBrowserProperties.setDaysSinceInstalled(20)
316-
fakeSenseOfProtectionToggles.senseOfProtectionNewUserExperimentApr25().setRawStoredState(
316+
fakeSenseOfProtectionToggles.senseOfProtectionNewUserExperimentMay25().setRawStoredState(
317317
State(
318318
remoteEnableState = true,
319319
enable = true,

app/src/test/java/com/duckduckgo/app/survey/rmf/TemporaryDefaultSurveyParametersPluginTest.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class TemporaryDefaultSurveyParametersPluginTest {
2222
on { it.isEnabled() } doReturn true
2323
on { it.getCohort() } doReturn modifiedControlCohort
2424
}
25-
whenever(mockSenseOfProtectionToggles.senseOfProtectionNewUserExperimentApr25()).thenReturn(mockToggle)
25+
whenever(mockSenseOfProtectionToggles.senseOfProtectionNewUserExperimentMay25()).thenReturn(mockToggle)
2626

2727
val plugin = SenseOfProtectionCohortSurveyParameterPlugin(mockSenseOfProtectionToggles)
2828

@@ -36,7 +36,7 @@ class TemporaryDefaultSurveyParametersPluginTest {
3636
on { it.isEnabled() } doReturn true
3737
on { it.getCohort() } doReturn modifiedControlCohort
3838
}
39-
whenever(mockSenseOfProtectionToggles.senseOfProtectionNewUserExperimentApr25()).thenReturn(mockToggle)
39+
whenever(mockSenseOfProtectionToggles.senseOfProtectionNewUserExperimentMay25()).thenReturn(mockToggle)
4040

4141
val plugin = SenseOfProtectionCohortSurveyParameterPlugin(mockSenseOfProtectionToggles)
4242

@@ -50,7 +50,7 @@ class TemporaryDefaultSurveyParametersPluginTest {
5050
on { it.isEnabled() } doReturn true
5151
on { it.getCohort() } doReturn modifiedControlCohort
5252
}
53-
whenever(mockSenseOfProtectionToggles.senseOfProtectionNewUserExperimentApr25()).thenReturn(mockToggle)
53+
whenever(mockSenseOfProtectionToggles.senseOfProtectionNewUserExperimentMay25()).thenReturn(mockToggle)
5454

5555
val plugin = SenseOfProtectionCohortSurveyParameterPlugin(mockSenseOfProtectionToggles)
5656

@@ -63,7 +63,7 @@ class TemporaryDefaultSurveyParametersPluginTest {
6363
on { it.isEnabled() } doReturn false
6464
on { it.getCohort() } doReturn null
6565
}
66-
whenever(mockSenseOfProtectionToggles.senseOfProtectionNewUserExperimentApr25()).thenReturn(mockToggle)
66+
whenever(mockSenseOfProtectionToggles.senseOfProtectionNewUserExperimentMay25()).thenReturn(mockToggle)
6767

6868
val plugin = SenseOfProtectionCohortSurveyParameterPlugin(mockSenseOfProtectionToggles)
6969

0 commit comments

Comments
 (0)