Skip to content

Refactor AC-165 [AdsClient] Remove the UnifiedTile wrapper type - #35593

Open
Almaju wants to merge 3 commits into
mozilla-mobile:mainfrom
Almaju:ahanot/ads-client-remove-unified-tile
Open

Refactor AC-165 [AdsClient] Remove the UnifiedTile wrapper type#35593
Almaju wants to merge 3 commits into
mozilla-mobile:mainfrom
Almaju:ahanot/ads-client-remove-unified-tile

Conversation

@Almaju

@Almaju Almaju commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

📜 Tickets

Jira ticket

💡 Description

Three no-op refactors of the sponsored tiles path, now that the ads client is the only tile source:

  1. Drop MARS leftovers: the unused timestamp param and its protocol shim, the dead AdPlacement struct, write-only UnifiedTile fields, Decodable conformances nothing decodes into, and two unused AppDelegate imports.
  2. Delete UnifiedTile : a field-for-field copy of MozAdsTile that was built and immediately turned into a Site. UnifiedAdsProvider now vends [Site] directly, so MozAdsTile stops leaking into TopSitesManager and the test mocks.
  3. Move the MozAdsTileSite conversion onto Site as a factory overload beside createSponsoredSite(url:title:siteInfo:). It lives in Client because Site is Storage and MozAdsTile is MozillaAppServices.

No behavior change. No assertions changed.

📝 Checklist

  • I filled in the ticket numbers and a description of my work
  • I updated the PR name to follow our PR naming guidelines
  • I ensured unit tests pass and wrote tests for new code
  • If working on UI, I checked and implemented accessibility (Dynamic Text and VoiceOver)
  • If adding telemetry, I read the data stewardship requirements and will request a data review
  • If adding or modifying strings, I read the guidelines and will request a string review from l10n
  • If needed, I updated documentation and added comments to complex code

Almaju added 3 commits August 7, 2026 16:29
…HTTP provider

Now that the ads client is the only way sponsored tiles are served, remove
the vestiges of the previous URLSession-based MARS implementation:

- UnifiedAdsProvider: drop the unused `timestamp` parameter (the ads client
  owns caching now) and the protocol-extension shim that only existed to
  give it a default value. Also removes the unused private `AdPlacement`
  request-body struct, a sibling of the `RequestBody` removed in mozilla-mobile#34874.
- UnifiedTile: drop `format` and `blockKey` (written, never read), drop the
  `Decodable` conformances (nothing decodes JSON into these anymore), and
  drop the unused `name` parameter from `from(name:mozAdsTile:)` — callers
  passed the placement id but the factory always read `mozAdsTile.name`.
- AppDelegate: remove the unused RustAdsClient and MozAdsEnvironment imports.

No behavior change. Tests updated mechanically; no assertions changed.
UnifiedTile was a field-for-field copy of MozAdsTile that performed no
transformation, and its entire lifetime was a single statement: it was
built from a MozAdsTile and immediately converted into a Site. The
insulation it appeared to provide was illusory, since any App Services
schema change would break UnifiedTile.from all the same.

UnifiedAdsProvider now vends [Site] directly, which lets both UnifiedTile
and the Site+createSponsoredSite helper go away. MozAdsTile is confined to
UnifiedAdsProvider.swift — the one file whose job is talking to the ads
client — instead of leaking into TopSitesManager and the test mocks.

- UnifiedTileResult -> SponsoredTileResult (Result<[Site], Error>)
- TopSitesManager.fetchSponsoredSites() is now a passthrough; the timeout
  helpers are retyped from [UnifiedTile] to [Site]
- MockSponsoredTileData vends [Site] via a shared makeSponsoredSite helper
  reused by the tests that previously built UnifiedTiles by hand

No behavior change. No assertions changed.
… a Site extension

UnifiedAdsProvider held a private static makeSponsoredSite(from:) that
built a Site out of a MozAdsTile. That is a Site construction detail, not
provider logic, so it now sits alongside the existing
Site.createSponsoredSite(url:title:siteInfo:) as a second factory
overload.

The extension lives in the Client module because neither side can reach
the other: Site belongs to Storage and MozAdsTile to MozillaAppServices.

No behavior change. Tests are unaffected — MockSponsoredTileData builds
Site through SponsoredSiteInfo directly and never goes through MozAdsTile.
@Almaju
Almaju force-pushed the ahanot/ads-client-remove-unified-tile branch from e50ce6b to 231f986 Compare September 8, 2026 21:46
@Almaju Almaju changed the title Refactor FXIOS-TODO [AdsClient] Remove the UnifiedTile wrapper type Refactor AC-165 [AdsClient] Remove the UnifiedTile wrapper type Sep 8, 2026
@Almaju
Almaju force-pushed the ahanot/ads-client-remove-unified-tile branch from 231f986 to cd4521b Compare September 8, 2026 21:59
@Almaju
Almaju marked this pull request as ready for review September 9, 2026 18:18
@Almaju
Almaju requested a review from a team as a code owner September 9, 2026 18:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant