Skip to content

Commit b563594

Browse files
authored
Add Duck.ai address bar settings pixels (#5970)
Task/Issue URL: https://app.asana.com/1/137249556945/project/1200204095367872/task/1210081600357643?focus=true ### Description - Adds pixels when toggling "Show Duck.ai in Address Bar”. ### Steps to test this PR - [ ] Go to Duck.ai settings - [ ] Toggle the "Show Duck.ai in Address Bar” setting off - [ ] Verify that `aichat_searchbar_setting_off` is sent - [ ] Toggle the "Show Duck.ai in Address Bar” setting on - [ ] Verify that `aichat_searchbar_setting_on` is sent --- - To see the specific tasks where the Asana app for GitHub is being used, see below: - https://app.asana.com/0/0/1210084233810306
1 parent a2f8902 commit b563594

File tree

3 files changed

+27
-3
lines changed

3 files changed

+27
-3
lines changed

duckchat/duckchat-impl/src/main/java/com/duckduckgo/duckchat/impl/RealDuckChat.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,12 +147,16 @@ class RealDuckChat @Inject constructor(
147147
} else {
148148
pixel.fire(DuckChatPixelName.DUCK_CHAT_MENU_SETTING_OFF)
149149
}
150-
151150
duckChatFeatureRepository.setShowInBrowserMenu(showDuckChat)
152151
cacheUserSettings()
153152
}
154153

155154
override suspend fun setShowInAddressBarUserSetting(showDuckChat: Boolean) = withContext(dispatchers.io()) {
155+
if (showDuckChat) {
156+
pixel.fire(DuckChatPixelName.DUCK_CHAT_SEARCHBAR_SETTING_ON)
157+
} else {
158+
pixel.fire(DuckChatPixelName.DUCK_CHAT_SEARCHBAR_SETTING_OFF)
159+
}
156160
duckChatFeatureRepository.setShowInAddressBar(showDuckChat)
157161
cacheUserSettings()
158162
}

duckchat/duckchat-impl/src/main/java/com/duckduckgo/duckchat/impl/pixel/DuckChatPixels.kt

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ import com.duckduckgo.duckchat.impl.pixel.DuckChatPixelName.DUCK_CHAT_MENU_SETTI
2525
import com.duckduckgo.duckchat.impl.pixel.DuckChatPixelName.DUCK_CHAT_OPEN
2626
import com.duckduckgo.duckchat.impl.pixel.DuckChatPixelName.DUCK_CHAT_OPEN_BROWSER_MENU
2727
import com.duckduckgo.duckchat.impl.pixel.DuckChatPixelName.DUCK_CHAT_OPEN_NEW_TAB_MENU
28+
import com.duckduckgo.duckchat.impl.pixel.DuckChatPixelName.DUCK_CHAT_SEARCHBAR_BUTTON_OPEN
29+
import com.duckduckgo.duckchat.impl.pixel.DuckChatPixelName.DUCK_CHAT_SEARCHBAR_SETTING_OFF
30+
import com.duckduckgo.duckchat.impl.pixel.DuckChatPixelName.DUCK_CHAT_SEARCHBAR_SETTING_ON
2831
import com.duckduckgo.duckchat.impl.pixel.DuckChatPixelName.DUCK_CHAT_SETTINGS_DISPLAYED
2932
import com.duckduckgo.duckchat.impl.pixel.DuckChatPixelName.DUCK_CHAT_SETTINGS_PRESSED
3033
import com.squareup.anvil.annotations.ContributesMultibinding
@@ -36,6 +39,8 @@ enum class DuckChatPixelName(override val pixelName: String) : Pixel.PixelName {
3639
DUCK_CHAT_OPEN_NEW_TAB_MENU("aichat_open_new_tab_menu"),
3740
DUCK_CHAT_MENU_SETTING_OFF("aichat_menu_setting_off"),
3841
DUCK_CHAT_MENU_SETTING_ON("aichat_menu_setting_on"),
42+
DUCK_CHAT_SEARCHBAR_SETTING_OFF("aichat_searchbar_setting_off"),
43+
DUCK_CHAT_SEARCHBAR_SETTING_ON("aichat_searchbar_setting_on"),
3944
DUCK_CHAT_SETTINGS_PRESSED("settings_aichat_pressed"),
4045
DUCK_CHAT_SETTINGS_DISPLAYED("m_aichat_settings_displayed"),
4146
DUCK_CHAT_SEARCHBAR_BUTTON_OPEN("aichat_searchbar_button_open"),
@@ -46,12 +51,15 @@ class DuckChatParamRemovalPlugin @Inject constructor() : PixelParamRemovalPlugin
4651
override fun names(): List<Pair<String, Set<PixelParameter>>> {
4752
return listOf(
4853
DUCK_CHAT_OPEN.pixelName to PixelParameter.removeAtb(),
49-
DUCK_CHAT_MENU_SETTING_OFF.pixelName to PixelParameter.removeAtb(),
50-
DUCK_CHAT_MENU_SETTING_ON.pixelName to PixelParameter.removeAtb(),
5154
DUCK_CHAT_OPEN_BROWSER_MENU.pixelName to PixelParameter.removeAtb(),
5255
DUCK_CHAT_OPEN_NEW_TAB_MENU.pixelName to PixelParameter.removeAtb(),
56+
DUCK_CHAT_MENU_SETTING_OFF.pixelName to PixelParameter.removeAtb(),
57+
DUCK_CHAT_MENU_SETTING_ON.pixelName to PixelParameter.removeAtb(),
58+
DUCK_CHAT_SEARCHBAR_SETTING_OFF.pixelName to PixelParameter.removeAtb(),
59+
DUCK_CHAT_SEARCHBAR_SETTING_ON.pixelName to PixelParameter.removeAtb(),
5360
DUCK_CHAT_SETTINGS_PRESSED.pixelName to PixelParameter.removeAtb(),
5461
DUCK_CHAT_SETTINGS_DISPLAYED.pixelName to PixelParameter.removeAtb(),
62+
DUCK_CHAT_SEARCHBAR_BUTTON_OPEN.pixelName to PixelParameter.removeAtb(),
5563
)
5664
}
5765
}

duckchat/duckchat-impl/src/test/kotlin/com/duckduckgo/duckchat/impl/RealDuckChatTest.kt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,18 @@ class RealDuckChatTest {
118118
verify(mockDuckChatFeatureRepository).setShowInBrowserMenu(true)
119119
}
120120

121+
@Test
122+
fun whenSetShowInAddressBarSetTrueThenPixelOnIsSent() = runTest {
123+
testee.setShowInAddressBarUserSetting(true)
124+
verify(mockPixel).fire(DuckChatPixelName.DUCK_CHAT_SEARCHBAR_SETTING_ON)
125+
}
126+
127+
@Test
128+
fun whenSetShowInAddressBarSetFalseThenPixelOffIsSent() = runTest {
129+
testee.setShowInAddressBarUserSetting(false)
130+
verify(mockPixel).fire(DuckChatPixelName.DUCK_CHAT_SEARCHBAR_SETTING_OFF)
131+
}
132+
121133
@Test
122134
fun whenSetShowInAddressBarUserSettingThenRepositorySetCalled() = runTest {
123135
testee.setShowInAddressBarUserSetting(true)

0 commit comments

Comments
 (0)