feat(gelderlander): add a feed teaser filter and generalise the article component filter #18

Closed
opened 2026-10-10 12:22:18 +02:00 by midas · 0 comments
Owner

Part of #16.

Feature description

Several roadmap issues want to drop specific blocks from De Gelderlander's section feeds and article bodies:

  • shopping and deals;
  • cross-promotion;
  • games promos;
  • notification suggestions;
  • upsell slots;
  • polls;
  • comments.

Build the filtering infrastructure once, so each named patch only declares which model types to drop.

Findings (9.21.1)

Feed (home and section pages)

  • com.kubus.module.network.model.SectionResponse.<init>(List mainContent, List navigations, List trackingEvents, String sectionUrn) is fully unobfuscated, and it is the only model that holds List<TeaserBlock>.
    • It is constructed by SectionResponseJsonAdapter (both the direct constructor and the synthetic one with int + DefaultConstructorMarker) and by copy().
    • It feeds both _sectionContent and sectionContent.
  • The type discriminator is enum knc (TeaserType): uno, compact, divider, carousel, ticker, dossier, breakingNews, shop, ad, advertisementPack, minicarousel, imagecarousel, videocarousel, liveTeaser, localnews, promobanner, dealsbanner, regionPromotion, htmlEmbed, podcastEmbed, recommendations, pushCategories, teaserTopList, collections, recap, liveblog, gamesPromo, audiobundle, playlist, marketingPosition.
  • Spacing is computed from the neighbouring items (c8b.b(cur, prev, ...) in s7b), so filtering at the data level leaves no gaps. Watch for two Divider teasers ending up next to each other.
  • The Compose per-item dispatcher s7b.R1 does not decompile (4160 code units). Don't hook the UI layer.

Article

  • g20.a(ArticleComponent): i30 (anchor string "FALLBACK (") is already hooked by Hide share buttons, which returns null for ShareButtons.
  • g20.b drops nulls, so returning null removes a component without leaving space.

Approach

  • Feed: insert p1 = Filter.filterTeasers(p1) at index 0 of SectionResponse.<init>.
    • Implement it as an extension method that returns a new ArrayList (the input may be immutable).
    • Drop items by instanceof against a set of model classes.
    • Collapse adjacent dividers.
  • Article: replace the share-buttons smali in g20.a with the same mechanism, an instanceof set for article components.
  • Move Hide share buttons onto the shared hook without changing its behaviour.

Done when

  • Unnamed infrastructure patch(es), used by Hide share buttons and the feed/article issues in #16.
  • Build passes; patch-install.ps1 -NoInstall shows Hide share buttons still applied on 9.21.1.
  • Device check:
    • articles still end without the share row;
    • the feed is unchanged when no types are filtered.
  • docs/apps/gelderlander.md documents both filter points.

Midas Settings

The filters decide at runtime, through Midas Settings (#49). Each filterable type belongs to a toggle from the issue that asks for it.

  • Read the toggles through MidasSettings' in-memory cache. SectionResponse.<init> runs for every section load, so it is a hot path.
  • Changes apply on the next feed or article load, without a restart.
  • Hide share buttons becomes a toggle as well: "Verberg deelknoppen", default on.
Part of #16. ## Feature description Several roadmap issues want to drop specific blocks from De Gelderlander's section feeds and article bodies: - shopping and deals; - cross-promotion; - games promos; - notification suggestions; - upsell slots; - polls; - comments. Build the filtering infrastructure once, so each named patch only declares which model types to drop. ## Findings (9.21.1) ### Feed (home and section pages) - `com.kubus.module.network.model.SectionResponse.<init>(List mainContent, List navigations, List trackingEvents, String sectionUrn)` is fully unobfuscated, and it is the only model that holds `List<TeaserBlock>`. - It is constructed by `SectionResponseJsonAdapter` (both the direct constructor and the synthetic one with `int` + `DefaultConstructorMarker`) and by `copy()`. - It feeds both `_sectionContent` and `sectionContent`. - The type discriminator is enum `knc` (TeaserType): uno, compact, divider, carousel, ticker, dossier, breakingNews, shop, ad, advertisementPack, minicarousel, imagecarousel, videocarousel, liveTeaser, localnews, promobanner, dealsbanner, regionPromotion, htmlEmbed, podcastEmbed, recommendations, pushCategories, teaserTopList, collections, recap, liveblog, gamesPromo, audiobundle, playlist, marketingPosition. - Spacing is computed from the neighbouring items (`c8b.b(cur, prev, ...)` in `s7b`), so filtering at the data level leaves no gaps. Watch for two `Divider` teasers ending up next to each other. - The Compose per-item dispatcher `s7b.R1` does not decompile (4160 code units). Don't hook the UI layer. ### Article - `g20.a(ArticleComponent): i30` (anchor string `"FALLBACK ("`) is already hooked by **Hide share buttons**, which returns null for `ShareButtons`. - `g20.b` drops nulls, so returning null removes a component without leaving space. ## Approach - Feed: insert `p1 = Filter.filterTeasers(p1)` at index 0 of `SectionResponse.<init>`. - Implement it as an extension method that returns a new `ArrayList` (the input may be immutable). - Drop items by `instanceof` against a set of model classes. - Collapse adjacent dividers. - Article: replace the share-buttons smali in `g20.a` with the same mechanism, an `instanceof` set for article components. - Move **Hide share buttons** onto the shared hook without changing its behaviour. ## Done when - [ ] Unnamed infrastructure patch(es), used by **Hide share buttons** and the feed/article issues in #16. - [ ] Build passes; `patch-install.ps1 -NoInstall` shows **Hide share buttons** still applied on 9.21.1. - [ ] Device check: - [ ] articles still end without the share row; - [ ] the feed is unchanged when no types are filtered. - [ ] `docs/apps/gelderlander.md` documents both filter points. ## Midas Settings The filters decide at runtime, through Midas Settings (#49). Each filterable type belongs to a toggle from the issue that asks for it. - Read the toggles through `MidasSettings`' in-memory cache. `SectionResponse.<init>` runs for every section load, so it is a hot path. - Changes apply on the next feed or article load, without a restart. - **Hide share buttons** becomes a toggle as well: "Verberg deelknoppen", default on.
midas closed this issue 2026-10-10 20:59:09 +02:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
midas/midas-patches#18
No description provided.