diff --git a/app/src/androidTest/java/com/duckduckgo/app/browser/BrowserTabViewModelTest.kt b/app/src/androidTest/java/com/duckduckgo/app/browser/BrowserTabViewModelTest.kt index 39c70d155479..b03d717baead 100644 --- a/app/src/androidTest/java/com/duckduckgo/app/browser/BrowserTabViewModelTest.kt +++ b/app/src/androidTest/java/com/duckduckgo/app/browser/BrowserTabViewModelTest.kt @@ -5783,7 +5783,7 @@ class BrowserTabViewModelTest { } @Test - fun whenOnRemoveSearchSuggestionConfirmedForHistorySuggestionThenPixelFiredAndHistoryEntryRemoved() = runBlocking { + fun whenOnRemoveSearchSuggestionConfirmedForHistorySuggestionThenPixelsFiredAndHistoryEntryRemoved() = runBlocking { val suggestion = AutoCompleteHistorySuggestion(phrase = "phrase", title = "title", url = "url", isAllowedInTopHits = false) val omnibarText = "foo" @@ -5793,13 +5793,14 @@ class BrowserTabViewModelTest { testee.onRemoveSearchSuggestionConfirmed(suggestion, omnibarText) verify(mockPixel).fire(AppPixelName.AUTOCOMPLETE_RESULT_DELETED) + verify(mockPixel).fire(AppPixelName.AUTOCOMPLETE_RESULT_DELETED_DAILY, type = Daily()) verify(mockNavigationHistory).removeHistoryEntryByUrl(suggestion.url) testObserver.assertValue(omnibarText) assertCommandIssued() } @Test - fun whenOnRemoveSearchSuggestionConfirmedForHistorySearchSuggestionThenPixelFiredAndHistoryEntryRemoved() = runBlocking { + fun whenOnRemoveSearchSuggestionConfirmedForHistorySearchSuggestionThenPixelsFiredAndHistoryEntryRemoved() = runBlocking { val suggestion = AutoCompleteHistorySearchSuggestion(phrase = "phrase", isAllowedInTopHits = false) val omnibarText = "foo" @@ -5809,6 +5810,7 @@ class BrowserTabViewModelTest { testee.onRemoveSearchSuggestionConfirmed(suggestion, omnibarText) verify(mockPixel).fire(AppPixelName.AUTOCOMPLETE_RESULT_DELETED) + verify(mockPixel).fire(AppPixelName.AUTOCOMPLETE_RESULT_DELETED_DAILY, type = Daily()) verify(mockNavigationHistory).removeHistoryEntryByQuery(suggestion.phrase) testObserver.assertValue(omnibarText) assertCommandIssued() diff --git a/app/src/main/java/com/duckduckgo/app/browser/BrowserTabViewModel.kt b/app/src/main/java/com/duckduckgo/app/browser/BrowserTabViewModel.kt index 80eddb37b874..fbf303ba0edb 100644 --- a/app/src/main/java/com/duckduckgo/app/browser/BrowserTabViewModel.kt +++ b/app/src/main/java/com/duckduckgo/app/browser/BrowserTabViewModel.kt @@ -222,6 +222,7 @@ import com.duckduckgo.app.pixels.AppPixelName.AUTOCOMPLETE_BANNER_SHOWN import com.duckduckgo.app.pixels.AppPixelName.AUTOCOMPLETE_HISTORY_SEARCH_SELECTION import com.duckduckgo.app.pixels.AppPixelName.AUTOCOMPLETE_HISTORY_SITE_SELECTION import com.duckduckgo.app.pixels.AppPixelName.AUTOCOMPLETE_RESULT_DELETED +import com.duckduckgo.app.pixels.AppPixelName.AUTOCOMPLETE_RESULT_DELETED_DAILY import com.duckduckgo.app.pixels.AppPixelName.AUTOCOMPLETE_SEARCH_PHRASE_SELECTION import com.duckduckgo.app.pixels.AppPixelName.AUTOCOMPLETE_SEARCH_WEBSITE_SELECTION import com.duckduckgo.app.pixels.AppPixelName.ONBOARDING_SEARCH_CUSTOM @@ -899,6 +900,8 @@ class BrowserTabViewModel @Inject constructor( fun onRemoveSearchSuggestionConfirmed(suggestion: AutoCompleteSuggestion, omnibarText: String) { appCoroutineScope.launch(dispatchers.io()) { pixel.fire(AUTOCOMPLETE_RESULT_DELETED) + pixel.fire(AUTOCOMPLETE_RESULT_DELETED_DAILY, type = Daily()) + when (suggestion) { is AutoCompleteHistorySuggestion -> { history.removeHistoryEntryByUrl(suggestion.url) diff --git a/app/src/main/java/com/duckduckgo/app/pixels/AppPixelName.kt b/app/src/main/java/com/duckduckgo/app/pixels/AppPixelName.kt index 8be0a197711e..737422bcc7bf 100644 --- a/app/src/main/java/com/duckduckgo/app/pixels/AppPixelName.kt +++ b/app/src/main/java/com/duckduckgo/app/pixels/AppPixelName.kt @@ -218,6 +218,7 @@ enum class AppPixelName(override val pixelName: String) : Pixel.PixelName { AUTOCOMPLETE_DISPLAYED_LOCAL_HISTORY_SEARCH("m_autocomplete_displayed_history_search"), AUTOCOMPLETE_RESULT_DELETED("m_autocomplete_result_deleted"), + AUTOCOMPLETE_RESULT_DELETED_DAILY("m_autocomplete_result_deleted_daily"), SERP_REQUERY("rq_%s"), diff --git a/app/src/main/java/com/duckduckgo/app/systemsearch/SystemSearchViewModel.kt b/app/src/main/java/com/duckduckgo/app/systemsearch/SystemSearchViewModel.kt index c8011fabe14e..4fa9f01abee0 100644 --- a/app/src/main/java/com/duckduckgo/app/systemsearch/SystemSearchViewModel.kt +++ b/app/src/main/java/com/duckduckgo/app/systemsearch/SystemSearchViewModel.kt @@ -316,6 +316,8 @@ class SystemSearchViewModel @Inject constructor( fun onRemoveSearchSuggestionConfirmed(suggestion: AutoCompleteSuggestion, omnibarText: String) { appCoroutineScope.launch(dispatchers.io()) { pixel.fire(AUTOCOMPLETE_RESULT_DELETED) + pixel.fire(AUTOCOMPLETE_RESULT_DELETED_DAILY, type = Daily()) + when (suggestion) { is AutoCompleteHistorySuggestion -> { history.removeHistoryEntryByUrl(suggestion.url) diff --git a/app/src/test/java/com/duckduckgo/app/systemsearch/SystemSearchViewModelTest.kt b/app/src/test/java/com/duckduckgo/app/systemsearch/SystemSearchViewModelTest.kt index 5d4532c5e65e..4f46aa2b2b61 100644 --- a/app/src/test/java/com/duckduckgo/app/systemsearch/SystemSearchViewModelTest.kt +++ b/app/src/test/java/com/duckduckgo/app/systemsearch/SystemSearchViewModelTest.kt @@ -30,6 +30,7 @@ import com.duckduckgo.app.onboarding.store.* import com.duckduckgo.app.pixels.AppPixelName.* import com.duckduckgo.app.settings.db.SettingsDataStore import com.duckduckgo.app.statistics.pixels.Pixel +import com.duckduckgo.app.statistics.pixels.Pixel.PixelType.Daily import com.duckduckgo.app.systemsearch.SystemSearchViewModel.Command import com.duckduckgo.app.systemsearch.SystemSearchViewModel.Command.AutocompleteItemRemoved import com.duckduckgo.app.systemsearch.SystemSearchViewModel.Command.LaunchDuckDuckGo @@ -510,7 +511,7 @@ class SystemSearchViewModelTest { } @Test - fun whenOnRemoveSearchSuggestionConfirmedForHistorySuggestionThenPixelFiredAndHistoryEntryRemoved() = runBlocking { + fun whenOnRemoveSearchSuggestionConfirmedForHistorySuggestionThenPixelsFiredAndHistoryEntryRemoved() = runBlocking { val suggestion = AutoCompleteHistorySuggestion(phrase = "phrase", title = "title", url = "url", isAllowedInTopHits = false) val omnibarText = "foo" @@ -520,13 +521,14 @@ class SystemSearchViewModelTest { testee.onRemoveSearchSuggestionConfirmed(suggestion, omnibarText) verify(mockPixel).fire(AUTOCOMPLETE_RESULT_DELETED) + verify(mockPixel).fire(AUTOCOMPLETE_RESULT_DELETED_DAILY, type = Daily()) verify(mockHistory).removeHistoryEntryByUrl(suggestion.url) testObserver.assertValue(omnibarText) assertCommandIssued() } @Test - fun whenOnRemoveSearchSuggestionConfirmedForHistorySearchSuggestionThenPixelFiredAndHistoryEntryRemoved() = runBlocking { + fun whenOnRemoveSearchSuggestionConfirmedForHistorySearchSuggestionThenPixelsFiredAndHistoryEntryRemoved() = runBlocking { val suggestion = AutoCompleteHistorySearchSuggestion(phrase = "phrase", isAllowedInTopHits = false) val omnibarText = "foo" @@ -536,6 +538,7 @@ class SystemSearchViewModelTest { testee.onRemoveSearchSuggestionConfirmed(suggestion, omnibarText) verify(mockPixel).fire(AUTOCOMPLETE_RESULT_DELETED) + verify(mockPixel).fire(AUTOCOMPLETE_RESULT_DELETED_DAILY, type = Daily()) verify(mockHistory).removeHistoryEntryByQuery(suggestion.phrase) testObserver.assertValue(omnibarText) assertCommandIssued()