Skip to content

Commit a90a3fd

Browse files
authored
Show on App Launch: Remove temporary pixels (#5625)
Task/Issue URL: https://app.asana.com/0/1207908166761516/1208302992661645 ### Description Removes pixel tracking for app launch settings options. This includes removing the pixel firing logic from the ShowOnAppLaunchViewModel and deleting the associated pixel names from AppPixelName. ### Steps to test this PR _App Launch Settings_ - [x] Navigate to Settings > App Launch - [x] Change between different launch options (Last Opened Tab, New Tab Page, Specific Page) - [x] Verify the functionality continues to work as expected - [x] Verify no pixel tracking events are being sent when changing options ### UI changes No UI changes
1 parent 63f8702 commit a90a3fd

File tree

4 files changed

+1
-54
lines changed

4 files changed

+1
-54
lines changed

app/src/main/java/com/duckduckgo/app/generalsettings/showonapplaunch/ShowOnAppLaunchViewModel.kt

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import androidx.lifecycle.viewModelScope
2121
import com.duckduckgo.anvil.annotations.ContributesViewModel
2222
import com.duckduckgo.app.generalsettings.showonapplaunch.model.ShowOnAppLaunchOption
2323
import com.duckduckgo.app.generalsettings.showonapplaunch.store.ShowOnAppLaunchOptionDataStore
24-
import com.duckduckgo.app.statistics.pixels.Pixel
2524
import com.duckduckgo.common.utils.DispatcherProvider
2625
import com.duckduckgo.di.scopes.ActivityScope
2726
import javax.inject.Inject
@@ -32,14 +31,12 @@ import kotlinx.coroutines.flow.filterNotNull
3231
import kotlinx.coroutines.flow.flowOn
3332
import kotlinx.coroutines.flow.launchIn
3433
import kotlinx.coroutines.launch
35-
import timber.log.Timber
3634

3735
@ContributesViewModel(ActivityScope::class)
3836
class ShowOnAppLaunchViewModel @Inject constructor(
3937
private val dispatcherProvider: DispatcherProvider,
4038
private val showOnAppLaunchOptionDataStore: ShowOnAppLaunchOptionDataStore,
4139
private val urlConverter: UrlConverter,
42-
private val pixel: Pixel,
4340
) : ViewModel() {
4441

4542
data class ViewState(
@@ -65,23 +62,15 @@ class ShowOnAppLaunchViewModel @Inject constructor(
6562
}
6663

6764
fun onShowOnAppLaunchOptionChanged(option: ShowOnAppLaunchOption) {
68-
Timber.i("User changed show on app launch option to $option")
6965
viewModelScope.launch(dispatcherProvider.io()) {
70-
firePixel(option)
7166
showOnAppLaunchOptionDataStore.setShowOnAppLaunchOption(option)
7267
}
7368
}
7469

7570
fun setSpecificPageUrl(url: String) {
76-
Timber.i("Setting specific page url to $url")
7771
viewModelScope.launch(dispatcherProvider.io()) {
7872
val convertedUrl = urlConverter.convertUrl(url)
7973
showOnAppLaunchOptionDataStore.setSpecificPageUrl(convertedUrl)
8074
}
8175
}
82-
83-
private fun firePixel(option: ShowOnAppLaunchOption) {
84-
val pixelName = ShowOnAppLaunchOption.getPixelName(option)
85-
pixel.fire(pixelName)
86-
}
8776
}

app/src/main/java/com/duckduckgo/app/generalsettings/showonapplaunch/model/ShowOnAppLaunchOption.kt

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,6 @@
1616

1717
package com.duckduckgo.app.generalsettings.showonapplaunch.model
1818

19-
import com.duckduckgo.app.pixels.AppPixelName.SETTINGS_GENERAL_APP_LAUNCH_LAST_OPENED_TAB_SELECTED
20-
import com.duckduckgo.app.pixels.AppPixelName.SETTINGS_GENERAL_APP_LAUNCH_NEW_TAB_PAGE_SELECTED
21-
import com.duckduckgo.app.pixels.AppPixelName.SETTINGS_GENERAL_APP_LAUNCH_SPECIFIC_PAGE_SELECTED
22-
2319
sealed class ShowOnAppLaunchOption(val id: Int) {
2420

2521
data object LastOpenedTab : ShowOnAppLaunchOption(1)
@@ -35,12 +31,6 @@ sealed class ShowOnAppLaunchOption(val id: Int) {
3531
else -> throw IllegalArgumentException("Unknown id: $id")
3632
}
3733

38-
fun getPixelName(option: ShowOnAppLaunchOption) = when (option) {
39-
LastOpenedTab -> SETTINGS_GENERAL_APP_LAUNCH_LAST_OPENED_TAB_SELECTED
40-
NewTabPage -> SETTINGS_GENERAL_APP_LAUNCH_NEW_TAB_PAGE_SELECTED
41-
is SpecificPage -> SETTINGS_GENERAL_APP_LAUNCH_SPECIFIC_PAGE_SELECTED
42-
}
43-
4434
fun getDailyPixelValue(option: ShowOnAppLaunchOption) = when (option) {
4535
LastOpenedTab -> "last_opened_tab"
4636
NewTabPage -> "new_tab_page"

app/src/main/java/com/duckduckgo/app/pixels/AppPixelName.kt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,6 @@ enum class AppPixelName(override val pixelName: String) : Pixel.PixelName {
148148
SETTINGS_COOKIE_POPUP_PROTECTION_PRESSED("ms_cookie_popup_protection_setting_pressed"),
149149
SETTINGS_FIRE_BUTTON_PRESSED("ms_fire_button_setting_pressed"),
150150
SETTINGS_GENERAL_APP_LAUNCH_PRESSED("m_settings_general_app_launch_pressed"),
151-
SETTINGS_GENERAL_APP_LAUNCH_LAST_OPENED_TAB_SELECTED("m_settings_general_app_launch_last_opened_tab_selected"),
152-
SETTINGS_GENERAL_APP_LAUNCH_NEW_TAB_PAGE_SELECTED("m_settings_general_app_launch_new_tab_page_selected"),
153-
SETTINGS_GENERAL_APP_LAUNCH_SPECIFIC_PAGE_SELECTED("m_settings_general_app_launch_specific_page_selected"),
154151

155152
SURVEY_CTA_SHOWN(pixelName = "mus_cs"),
156153
SURVEY_CTA_DISMISSED(pixelName = "mus_cd"),

app/src/test/java/com/duckduckgo/app/generalsettings/showonapplaunch/ShowOnAppLaunchViewModelTest.kt

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,9 @@ package com.duckduckgo.app.generalsettings.showonapplaunch
1919
import app.cash.turbine.test
2020
import com.duckduckgo.app.generalsettings.showonapplaunch.model.ShowOnAppLaunchOption.LastOpenedTab
2121
import com.duckduckgo.app.generalsettings.showonapplaunch.model.ShowOnAppLaunchOption.NewTabPage
22-
import com.duckduckgo.app.generalsettings.showonapplaunch.model.ShowOnAppLaunchOption.SpecificPage
2322
import com.duckduckgo.app.generalsettings.showonapplaunch.store.FakeShowOnAppLaunchOptionDataStore
24-
import com.duckduckgo.app.pixels.AppPixelName.SETTINGS_GENERAL_APP_LAUNCH_LAST_OPENED_TAB_SELECTED
25-
import com.duckduckgo.app.pixels.AppPixelName.SETTINGS_GENERAL_APP_LAUNCH_NEW_TAB_PAGE_SELECTED
26-
import com.duckduckgo.app.pixels.AppPixelName.SETTINGS_GENERAL_APP_LAUNCH_SPECIFIC_PAGE_SELECTED
2723
import com.duckduckgo.common.test.CoroutineTestRule
2824
import com.duckduckgo.common.utils.DispatcherProvider
29-
import com.duckduckgo.fakes.FakePixel
3025
import kotlinx.coroutines.test.runTest
3126
import org.junit.Assert.assertEquals
3227
import org.junit.Before
@@ -40,14 +35,12 @@ class ShowOnAppLaunchViewModelTest {
4035

4136
private lateinit var testee: ShowOnAppLaunchViewModel
4237
private lateinit var fakeDataStore: FakeShowOnAppLaunchOptionDataStore
43-
private lateinit var fakePixel: FakePixel
4438
private val dispatcherProvider: DispatcherProvider = coroutineTestRule.testDispatcherProvider
4539

4640
@Before
4741
fun setup() {
4842
fakeDataStore = FakeShowOnAppLaunchOptionDataStore(LastOpenedTab)
49-
fakePixel = FakePixel()
50-
testee = ShowOnAppLaunchViewModel(dispatcherProvider, fakeDataStore, FakeUrlConverter(), fakePixel)
43+
testee = ShowOnAppLaunchViewModel(dispatcherProvider, fakeDataStore, FakeUrlConverter())
5144
}
5245

5346
@Test
@@ -89,28 +82,6 @@ class ShowOnAppLaunchViewModelTest {
8982
}
9083
}
9184

92-
@Test
93-
fun whenOptionChangedToLastOpenedPageThenLastOpenedPageIsFired() = runTest {
94-
testee.onShowOnAppLaunchOptionChanged(NewTabPage)
95-
testee.onShowOnAppLaunchOptionChanged(LastOpenedTab)
96-
assertEquals(2, fakePixel.firedPixels.size)
97-
assertEquals(SETTINGS_GENERAL_APP_LAUNCH_LAST_OPENED_TAB_SELECTED.pixelName, fakePixel.firedPixels.last())
98-
}
99-
100-
@Test
101-
fun whenOptionChangedToNewTabPageThenNewTabPagePixelIsFired() = runTest {
102-
testee.onShowOnAppLaunchOptionChanged(NewTabPage)
103-
assertEquals(1, fakePixel.firedPixels.size)
104-
assertEquals(SETTINGS_GENERAL_APP_LAUNCH_NEW_TAB_PAGE_SELECTED.pixelName, fakePixel.firedPixels[0])
105-
}
106-
107-
@Test
108-
fun whenOptionChangedToSpecificPageThenSpecificPixelIsFired() = runTest {
109-
testee.onShowOnAppLaunchOptionChanged(SpecificPage("https://example.com"))
110-
assertEquals(1, fakePixel.firedPixels.size)
111-
assertEquals(SETTINGS_GENERAL_APP_LAUNCH_SPECIFIC_PAGE_SELECTED.pixelName, fakePixel.firedPixels[0])
112-
}
113-
11485
private class FakeUrlConverter : UrlConverter {
11586

11687
override fun convertUrl(url: String?): String {

0 commit comments

Comments
 (0)