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

Inject larger autoconsent bundle containing cosmetic filters #5517

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

dharb
Copy link
Collaborator

@dharb dharb commented Jan 22, 2025

Task/Issue URL: https://app.asana.com/0/0/1208811874906681/f

Description

This PR is the first step in expanding CPM coverage on mobile by way of using easylist cookie filterlists. There are no user facing changes in this PR: all that's happening here is we are adding a new autoconsent subfeature called filterlist, and injecting a different autoconsent bundle if that feature flag is enabled via privacy configuration. The corresponding Privacy Configuration PR can be found here: duckduckgo/privacy-configuration#2659.

Steps to test this PR

  1. Checkout this branch, build locally
  2. Point app at this config: https://jsonblob.com/api/1331752608628662272.
    The only change here is the added filterlist autoconsent subfeature:
"filterlist": {
    "state": "enabled"
}
  1. Ensure that CPM is on, then visit a website that we have an existing CPM rule for (eg ecosia.org). Confirm that the cookie popup is hidden.
  2. Visit a website that we don't have an existing CPM rule for, but there is an easylist rule for (eg rijksmuseum.nl). Confirm that the cookie popup is not hidden.
    To fully confirm that the larger bundle is being injected when the feature flag is enabled, you may do so by enabling the feature as follows:
  3. On https://github.com/duckduckgo/Android/blob/dharb/autoconsent-filterlist-test/autoconsent/autoconsent-impl/src/main/java/com/duckduckgo/autoconsent/impl/handlers/InitMessageHandlerPlugin.kt#L76, add enableFilterList = true to list of params
  4. On https://github.com/duckduckgo/Android/blob/dharb/autoconsent-filterlist-test/autoconsent/autoconsent-impl/src/main/java/com/duckduckgo/autoconsent/impl/handlers/InitMessageHandlerPlugin.kt#L115, add val enableFilterList: Boolean to the list of params
  5. Rebuild app
  6. Double check that config is still pointed at the jsonblob url above
  7. Ensure that CPM is on, then visit a website that we have an existing CPM rule for (eg ecosia.org). Confirm that the cookie popup is hidden.
  8. Visit a website that we don't have an existing CPM rule for, but there is an easylist rule for (eg rijksmuseum.nl). Confirm that the cookie popup is hidden.
  9. As a final check, use the fire button to clear all local data, then point privacy config back at the production endpoint where this feature isn't enabled. Then visit ecosia.org and rijksmuseum.nl again and confirm that the cookie pop is hidden on ecosia.org, and is not hidden on rijksmuseum.nl

@@ -47,6 +52,7 @@ class RealAutoconsent @Inject constructor(
private val settingsRepository: AutoconsentSettingsRepository,
private val autoconsentExceptionsRepository: AutoconsentExceptionsRepository,
private val autoconsent: AutoconsentFeature,
private val pixel: Pixel,
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suspect I'm not doing this correctly because it's causing unit tests to fail. How should I do this differently?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are doing it right but you didn't change the tests to also inject pixel as a parameter.

e: file:///home/runner/work/Android/Android/autoconsent/autoconsent-impl/src/test/java/com/duckduckgo/autoconsent/impl/RealAutoconsentTest.kt:60:13 Type mismatch: inferred type is FakeUserAllowlist but Pixel was expected
e: file:///home/runner/work/Android/Android/autoconsent/autoconsent-impl/src/test/java/com/duckduckgo/autoconsent/impl/RealAutoconsentTest.kt:61:13 Type mismatch: inferred type is FakeUnprotected but UserAllowListRepository was expected
e: file:///home/runner/work/Android/Android/autoconsent/autoconsent-impl/src/test/java/com/duckduckgo/autoconsent/impl/RealAutoconsentTest.kt:61:13 No value passed for parameter 'unprotectedTemporary'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants