feat: block ad and tracker hosts in Edition WebViews, hide newsletter sign-ups #190
No reviewers
Labels
No labels
area/architecture
area/build-ci
area/bytecode
area/code-quality
area/docs
area/extension
area/fingerprint
area/security
area/tests
Bug report
Feature request
review
sev/low
sev/medium
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
midas/midas-patches!190
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat/169-edition-webview-blocking"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #169
What the app has (Het Parool 7.55.0 decompile; class names checked in the dex of Volkskrant 7.54.0/7.55.0 and Trouw 7.55.0)
nl.persgroep.edition.component.web.ui.DefaultWebViewClient(extendsWebViewClient): the in-app browser (WebViewContent->InjectWebView: links, "Kijk verder", "Mijn omgeving").nl.persgroep.edition.embed.webview.ui.EmbedWebViewViewModel$EmbedWebViewClient(extendsandroidx.webkit.WebViewClientCompat): article embeds (YouTube, X, Instagram, Facebook, other HTML/iframes).shouldInterceptRequest(nor doesWebViewClientCompat). Both are unobfuscated.SubscriptionWebViewClient(purchase), TemptationPaywallWebView, the privacy gate SDK's WebView, games, year review, the ad SDKs' own WebViews.Change
shared/util/WebViewClients.kt:hookShouldInterceptRequest(clientType, hook)adds ashouldInterceptRequest(WebView, WebResourceRequest)override that returnssuper's result when the class has none, then puts the hook in front (non-null response = returned). Hide ads and Disable tracking each add their own hook. Checked withdexdumpon the patched Volkskrant 7.55.0: both clients get the method with both hooks beforeinvoke-super.nl.midasvo.extension.web.WebRequestBlocker(host rules, main frame never blocked, empty response), used by the newedition.EditionWebRequestsand byNrcWebContent(NRC hosts and behaviour unchanged: exact hosts only). Hooks have the never-throw wrapper; JVM tests inWebRequestBlockerTest,EditionWebRequestsTest.docs/apps/edition.md): Hide ads:securepubads.g.doubleclick.net,googleads.g.doubleclick.net,pagead2.googlesyndication.com,ib.adnxs.com,msft-ssp.adnxs.com,prebid-server.dpgmedia.net,advertising-cdn.dpgmedia.cloud. Disable tracking:hit.gemius.pland subdomains,t.contentsquare.net. Never blocked (pinned by a test): privacy gate hosts, the publishers' sites, the embeds' own hosts,www.googletagmanager.com.hide_newsletter_signups(default on, "Advertenties en promotie"):ContentFiltersdrops aBlock.EmbedBlockwhose HTML contains/optiext/optiextension.dll. StubBlock.EmbedBlock.getContent()added;check-stubs.shOK on Het Parool 7.55.0 and Volkskrant 7.53.1.docs/HOSTS.mddoes not exist on dev yet, so the hosts are listed indocs/apps/edition.md.Verification
buildAndroid(incl. contract check):extensions:extension:testDebugUnitTestcheck-patches.shVolkskrant 7.55.0check-patches.shTrouw 7.55.0check-patches.shVolkskrant 7.54.0check-patches.shNRC 5.12.24Not verified
EmbedBlock(and whether Trouw/Het Parool have the same form): the URL comes with the article, not the APK.googleads.g.doubleclick.netin a YouTube embed leaves playback alone.🤖 Generated with Claude Code
Merged into dev through the integration PR #195 (same commits), released as v1.11.0-dev.10.
Pull request closed