Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android: Remove pixels for Indonesia message #5186

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ class IndonesiaNewTabSectionView @JvmOverloads constructor(
viewModel.onMessageDismissed()
}
show()
viewModel.onMessageShown()
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ import androidx.lifecycle.LifecycleOwner
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.duckduckgo.anvil.annotations.ContributesViewModel
import com.duckduckgo.app.pixels.AppPixelName
import com.duckduckgo.app.statistics.pixels.Pixel
import com.duckduckgo.common.utils.DispatcherProvider
import com.duckduckgo.di.scopes.ViewScope
import javax.inject.Inject
Expand All @@ -40,7 +38,6 @@ class IndonesiaNewTabSectionViewModel @Inject constructor(
private val indonesiaNewTabSectionDataStore: IndonesiaNewTabSectionDataStore,
private val dispatchers: DispatcherProvider,
private val applicationContext: Context,
private val pixel: Pixel,
) : ViewModel(), DefaultLifecycleObserver {

data class ViewState(val showMessage: Boolean = false)
Expand Down Expand Up @@ -77,14 +74,9 @@ class IndonesiaNewTabSectionViewModel @Inject constructor(
fun onMessageDismissed() {
viewModelScope.launch(dispatchers.io()) {
indonesiaNewTabSectionDataStore.dismissMessage()
pixel.fire(AppPixelName.INDONESIA_MESSAGE_DISMISSED)
}
}

fun onMessageShown() {
pixel.fire(AppPixelName.INDONESIA_MESSAGE_SHOWN, type = Pixel.PixelType.Daily())
}

companion object {
internal const val MCC_INDONESIA = 510
internal const val MCC_UNDEFINED = 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,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.INDONESIA_MESSAGE_SHOWN.pixelName to PixelParameter.removeAtb(),
AppPixelName.INDONESIA_MESSAGE_DISMISSED.pixelName to PixelParameter.removeAtb(),
)
}
}
3 changes: 0 additions & 3 deletions app/src/main/java/com/duckduckgo/app/pixels/AppPixelName.kt
Original file line number Diff line number Diff line change
Expand Up @@ -363,9 +363,6 @@ enum class AppPixelName(override val pixelName: String) : Pixel.PixelName {

REFERRAL_INSTALL_UTM_CAMPAIGN("m_android_install"),

INDONESIA_MESSAGE_SHOWN("m_indonesia_message_shown_d"),
INDONESIA_MESSAGE_DISMISSED("m_indonesia_message_dismissed"),

REFRESH_ACTION_DAILY_PIXEL("m_refresh_action_daily"),
RELOAD_TWICE_WITHIN_12_SECONDS("m_reload_twice_within_12_seconds"),
RELOAD_THREE_TIMES_WITHIN_20_SECONDS("m_reload_three_times_within_20_seconds"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import com.duckduckgo.app.browser.indonesiamessage.IndonesiaNewTabSectionViewMod
import com.duckduckgo.app.browser.indonesiamessage.IndonesiaNewTabSectionViewModel.Companion.MCC_INDONESIA
import com.duckduckgo.app.browser.indonesiamessage.IndonesiaNewTabSectionViewModel.Companion.MCC_UNDEFINED
import com.duckduckgo.app.browser.indonesiamessage.IndonesiaNewTabSectionViewModel.ViewState
import com.duckduckgo.app.pixels.AppPixelName
import com.duckduckgo.app.statistics.pixels.Pixel
import com.duckduckgo.common.test.CoroutineTestRule
import kotlinx.coroutines.flow.flowOf
import kotlinx.coroutines.test.runTest
Expand All @@ -34,7 +32,6 @@ class IndonesiaNewTabSectionViewModelTest {

private val mockIndonesiaNewTabSectionDataStore: IndonesiaNewTabSectionDataStore = mock()
private val mockApplicationContext: Context = InstrumentationRegistry.getInstrumentation().targetContext
private val mockPixel: Pixel = mock()

private lateinit var testee: IndonesiaNewTabSectionViewModel

Expand All @@ -44,7 +41,6 @@ class IndonesiaNewTabSectionViewModelTest {
mockIndonesiaNewTabSectionDataStore,
coroutinesTestRule.testDispatcherProvider,
mockApplicationContext,
mockPixel,
)
}

Expand Down Expand Up @@ -77,17 +73,9 @@ class IndonesiaNewTabSectionViewModelTest {
}

@Test
fun whenOnMessageDismissedThenDismissMessageCalledOnDataStoreAndPixelFired() = runTest {
fun whenOnMessageDismissedThenDismissMessageCalledOnDataStore() = runTest {
testee.onMessageDismissed()

verify(mockIndonesiaNewTabSectionDataStore).dismissMessage()
verify(mockPixel).fire(AppPixelName.INDONESIA_MESSAGE_DISMISSED)
}

@Test
fun whenOnMessageShownThenDailyPixelFired() = runTest {
testee.onMessageShown()

verify(mockPixel).fire(AppPixelName.INDONESIA_MESSAGE_SHOWN, type = Pixel.PixelType.Daily())
}
}
Loading