From 859e8768bdfd0bd43f82d562f9be4550cb4f5d80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Gonz=C3=A1lez?= Date: Wed, 20 Nov 2024 15:50:21 +0100 Subject: [PATCH] remove temporary features sender pixel --- .../AndroidFeaturesPixelSender.kt | 62 ------------------ .../api/PixelParamRemovalInterceptor.kt | 1 - .../com/duckduckgo/app/pixels/AppPixelName.kt | 2 - .../AndroidFeaturesPixelSenderTest.kt | 64 ------------------- 4 files changed, 129 deletions(-) delete mode 100644 app/src/main/java/com/duckduckgo/app/browser/trafficquality/AndroidFeaturesPixelSender.kt delete mode 100644 app/src/test/java/com/duckduckgo/app/browser/trafficquality/AndroidFeaturesPixelSenderTest.kt diff --git a/app/src/main/java/com/duckduckgo/app/browser/trafficquality/AndroidFeaturesPixelSender.kt b/app/src/main/java/com/duckduckgo/app/browser/trafficquality/AndroidFeaturesPixelSender.kt deleted file mode 100644 index 30c8af2f3085..000000000000 --- a/app/src/main/java/com/duckduckgo/app/browser/trafficquality/AndroidFeaturesPixelSender.kt +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2024 DuckDuckGo - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.duckduckgo.app.browser.trafficquality - -import com.duckduckgo.app.di.AppCoroutineScope -import com.duckduckgo.app.pixels.AppPixelName -import com.duckduckgo.app.statistics.api.AtbLifecyclePlugin -import com.duckduckgo.app.statistics.pixels.Pixel -import com.duckduckgo.autoconsent.api.Autoconsent -import com.duckduckgo.common.utils.DispatcherProvider -import com.duckduckgo.di.scopes.AppScope -import com.duckduckgo.mobile.android.app.tracking.AppTrackingProtection -import com.duckduckgo.networkprotection.api.NetworkProtectionState -import com.duckduckgo.privacy.config.api.Gpc -import com.squareup.anvil.annotations.ContributesMultibinding -import javax.inject.Inject -import kotlinx.coroutines.CoroutineScope -import kotlinx.coroutines.launch - -@ContributesMultibinding(AppScope::class) -class AndroidFeaturesPixelSender @Inject constructor( - private val autoconsent: Autoconsent, - private val gpc: Gpc, - private val appTrackingProtection: AppTrackingProtection, - private val networkProtectionState: NetworkProtectionState, - private val pixel: Pixel, - @AppCoroutineScope private val coroutineScope: CoroutineScope, - private val dispatcherProvider: DispatcherProvider, -) : AtbLifecyclePlugin { - - override fun onSearchRetentionAtbRefreshed(oldAtb: String, newAtb: String) { - coroutineScope.launch(dispatcherProvider.io()) { - val params = mutableMapOf() - params[PARAM_COOKIE_POP_UP_MANAGEMENT_ENABLED] = autoconsent.isAutoconsentEnabled().toString() - params[PARAM_GLOBAL_PRIVACY_CONTROL_ENABLED] = gpc.isEnabled().toString() - params[PARAM_APP_TRACKING_PROTECTION_ENABLED] = appTrackingProtection.isEnabled().toString() - params[PARAM_PRIVACY_PRO_VPN_ENABLED] = networkProtectionState.isEnabled().toString() - pixel.fire(AppPixelName.FEATURES_ENABLED_AT_SEARCH_TIME, params) - } - } - - companion object { - internal const val PARAM_COOKIE_POP_UP_MANAGEMENT_ENABLED = "cookie_pop_up_management_enabled" - internal const val PARAM_GLOBAL_PRIVACY_CONTROL_ENABLED = "global_privacy_control_enabled" - internal const val PARAM_APP_TRACKING_PROTECTION_ENABLED = "app_tracking_protection_enabled" - internal const val PARAM_PRIVACY_PRO_VPN_ENABLED = "privacy_pro_vpn_enabled" - } -} diff --git a/app/src/main/java/com/duckduckgo/app/global/api/PixelParamRemovalInterceptor.kt b/app/src/main/java/com/duckduckgo/app/global/api/PixelParamRemovalInterceptor.kt index da800dbaa11e..900b4be5d4f9 100644 --- a/app/src/main/java/com/duckduckgo/app/global/api/PixelParamRemovalInterceptor.kt +++ b/app/src/main/java/com/duckduckgo/app/global/api/PixelParamRemovalInterceptor.kt @@ -89,7 +89,6 @@ object PixelInterceptorPixelsRequiringDataCleaning : PixelParamRemovalPlugin { HttpErrorPixelName.WEBVIEW_RECEIVED_HTTP_ERROR_400_DAILY.pixelName to PixelParameter.removeAtb(), HttpErrorPixelName.WEBVIEW_RECEIVED_HTTP_ERROR_4XX_DAILY.pixelName to PixelParameter.removeAtb(), HttpErrorPixelName.WEBVIEW_RECEIVED_HTTP_ERROR_5XX_DAILY.pixelName to PixelParameter.removeAtb(), - AppPixelName.FEATURES_ENABLED_AT_SEARCH_TIME.pixelName to PixelParameter.removeAll(), SitePermissionsPixelName.PERMISSION_DIALOG_CLICK.pixelName to PixelParameter.removeAtb(), SitePermissionsPixelName.PERMISSION_DIALOG_IMPRESSION.pixelName to PixelParameter.removeAtb(), SITE_NOT_WORKING_SHOWN.pixelName to PixelParameter.removeAtb(), 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 475c598c3d23..f071652ff980 100644 --- a/app/src/main/java/com/duckduckgo/app/pixels/AppPixelName.kt +++ b/app/src/main/java/com/duckduckgo/app/pixels/AppPixelName.kt @@ -371,6 +371,4 @@ enum class AppPixelName(override val pixelName: String) : Pixel.PixelName { URI_LOADED("m_uri_loaded"), ERROR_PAGE_SHOWN("m_errorpageshown"), - - FEATURES_ENABLED_AT_SEARCH_TIME("features"), } diff --git a/app/src/test/java/com/duckduckgo/app/browser/trafficquality/AndroidFeaturesPixelSenderTest.kt b/app/src/test/java/com/duckduckgo/app/browser/trafficquality/AndroidFeaturesPixelSenderTest.kt deleted file mode 100644 index b959c98f3315..000000000000 --- a/app/src/test/java/com/duckduckgo/app/browser/trafficquality/AndroidFeaturesPixelSenderTest.kt +++ /dev/null @@ -1,64 +0,0 @@ -package com.duckduckgo.app.browser.trafficquality - -import com.duckduckgo.app.pixels.AppPixelName -import com.duckduckgo.app.statistics.pixels.Pixel -import com.duckduckgo.autoconsent.api.Autoconsent -import com.duckduckgo.common.test.CoroutineTestRule -import com.duckduckgo.mobile.android.app.tracking.AppTrackingProtection -import com.duckduckgo.networkprotection.api.NetworkProtectionState -import com.duckduckgo.privacy.config.api.Gpc -import kotlinx.coroutines.test.runTest -import org.junit.Before -import org.junit.Rule -import org.junit.Test -import org.mockito.kotlin.mock -import org.mockito.kotlin.verify -import org.mockito.kotlin.verifyNoMoreInteractions -import org.mockito.kotlin.whenever - -class AndroidFeaturesPixelSenderTest { - @get:Rule - var coroutineRule = CoroutineTestRule() - - private val mockAutoconsent = mock() - private val mockGpc = mock() - private val mockAppTrackingProtection = mock() - private val mockNetworkProtectionState = mock() - private val mockPixel = mock() - - private lateinit var pixelSender: AndroidFeaturesPixelSender - - @Before - fun setup() { - pixelSender = AndroidFeaturesPixelSender( - mockAutoconsent, - mockGpc, - mockAppTrackingProtection, - mockNetworkProtectionState, - mockPixel, - coroutineRule.testScope, - coroutineRule.testDispatcherProvider, - ) - } - - @Test - fun reportFeaturesEnabledOrDisabledWhenEnabledOrDisabled() = runTest { - whenever(mockAutoconsent.isAutoconsentEnabled()).thenReturn(false) - whenever(mockGpc.isEnabled()).thenReturn(true) - whenever(mockAppTrackingProtection.isEnabled()).thenReturn(false) - whenever(mockNetworkProtectionState.isEnabled()).thenReturn(true) - - pixelSender.onSearchRetentionAtbRefreshed("v123-1", "v123-2") - - verify(mockPixel).fire( - AppPixelName.FEATURES_ENABLED_AT_SEARCH_TIME, - mapOf( - AndroidFeaturesPixelSender.PARAM_COOKIE_POP_UP_MANAGEMENT_ENABLED to "false", - AndroidFeaturesPixelSender.PARAM_GLOBAL_PRIVACY_CONTROL_ENABLED to "true", - AndroidFeaturesPixelSender.PARAM_APP_TRACKING_PROTECTION_ENABLED to "false", - AndroidFeaturesPixelSender.PARAM_PRIVACY_PRO_VPN_ENABLED to "true", - ), - ) - verifyNoMoreInteractions(mockPixel) - } -}