Skip to content

Add support for contingency messaging#9083

Open
CrisBarreiro wants to merge 1 commit into
developfrom
feature/cris/enable-contingency-messaging
Open

Add support for contingency messaging#9083
CrisBarreiro wants to merge 1 commit into
developfrom
feature/cris/enable-contingency-messaging

Conversation

@CrisBarreiro

@CrisBarreiro CrisBarreiro commented Jul 2, 2026

Copy link
Copy Markdown
Collaborator

Task/Issue URL: https://app.asana.com/1/137249556945/project/72649045549333/task/1214489465023873?focus=true
Tech Design URL (if applicable):

Description

Add support for contingency messaging:

  • Bottom sheet when visiting YouTube
  • Message in settings with hidden toggle

Steps to test this PR

Feature 1

  • Fresh install the app
  • Go to YouTube ad blocking settings and enable the feature
  • Go to Feature Flag Inventory and enable adBlockingExtensionFeature -> enableContingencyMode
  • Go to YouTube ad blocking settings and check nothing changed
  • Open a YouTube video (you might see ads), check no contingency messaging is shown
  • Go to Feature Flag Inventory and enable adBlockingExtensionFeature -> adBlockingUXImprovements
  • Go to YouTube ad blocking settings and check the toggle disappeared and there's a contingency message
  • Go back and reload the video
  • Check a contingency message is shown, Dismiss it
  • Navigate to another video
  • Check contingency message not shown again
  • Go to Feature Flag Inventory and disable and immediately enable adBlockingExtensionFeature -> enableContingencyMode
  • Go back and reload the video
  • Check contingency messaging is shown again

UI changes

Before After
Screenshot_20260702_173322 Screenshot_20260702_180254
contingency-after

Note

Medium Risk
User-visible browser and settings behavior tied to remote feature flags, including when script injection is skipped in contingency mode elsewhere in the module; well-tested but worth validating navigation timing and one-shot messaging edge cases.

Overview
Adds contingency messaging when remote flags adBlockingUXImprovements and enableContingencyMode are on, so users are told YouTube ad blocking is temporarily unavailable instead of seeing a broken toggle or silent failure.

On YouTube extension domains, a one-time bottom sheet is shown after page load (deferred until the WebView has window focus); pending shows are cancelled on the next onPageStarted. Whether the message already appeared is persisted in DataStore and resets when contingency mode is turned off.

Ad Blocking settings (v2) switches to a read-only contingency row (warning icon + copy) and hides the block-ads toggle and description; the header status indicator stays off in contingency mode even if blocking would otherwise be enabled.

Contingency copy and v2 settings strings are added across locales (moved out of donottranslate.xml).

Reviewed by Cursor Bugbot for commit da76a95. Bugbot is set up for automated code reviews on this repo. Configure here.

CrisBarreiro commented Jul 2, 2026

Copy link
Copy Markdown
Collaborator Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@CrisBarreiro CrisBarreiro changed the base branch from develop to graphite-base/9083 July 2, 2026 16:10
@CrisBarreiro CrisBarreiro force-pushed the feature/cris/enable-contingency-messaging branch from 4f76570 to 540ac9e Compare July 2, 2026 16:10
@CrisBarreiro CrisBarreiro changed the base branch from graphite-base/9083 to feature/cris/clarify-duck-player-entry-point July 2, 2026 16:10
@CrisBarreiro CrisBarreiro mentioned this pull request Jul 2, 2026
10 tasks
@CrisBarreiro CrisBarreiro requested a review from cmonfortep July 3, 2026 10:24
@CrisBarreiro CrisBarreiro marked this pull request as draft July 6, 2026 11:30
@CrisBarreiro CrisBarreiro force-pushed the feature/cris/enable-contingency-messaging branch from ad28b40 to 60e63f7 Compare July 7, 2026 10:47
@CrisBarreiro CrisBarreiro force-pushed the feature/cris/clarify-duck-player-entry-point branch from 1cbd817 to d244f17 Compare July 7, 2026 10:57
@CrisBarreiro CrisBarreiro force-pushed the feature/cris/enable-contingency-messaging branch from 60e63f7 to abec109 Compare July 7, 2026 10:57
@CrisBarreiro CrisBarreiro marked this pull request as ready for review July 7, 2026 10:57
@CrisBarreiro CrisBarreiro force-pushed the feature/cris/clarify-duck-player-entry-point branch from d244f17 to f40c3e2 Compare July 8, 2026 08:32
@CrisBarreiro CrisBarreiro force-pushed the feature/cris/enable-contingency-messaging branch from 183d4bf to 9bf11e2 Compare July 8, 2026 08:32
cursor[bot]

This comment was marked as resolved.

@CrisBarreiro CrisBarreiro changed the base branch from feature/cris/clarify-duck-player-entry-point to graphite-base/9083 July 8, 2026 08:54
@CrisBarreiro CrisBarreiro force-pushed the feature/cris/enable-contingency-messaging branch from 9bf11e2 to cfb68de Compare July 8, 2026 08:55
@graphite-app graphite-app Bot changed the base branch from graphite-base/9083 to develop July 8, 2026 08:55
@CrisBarreiro CrisBarreiro force-pushed the feature/cris/enable-contingency-messaging branch from cfb68de to 1af6633 Compare July 8, 2026 08:55
@CrisBarreiro CrisBarreiro marked this pull request as draft July 8, 2026 13:48
@CrisBarreiro CrisBarreiro force-pushed the feature/cris/enable-contingency-messaging branch from 1af6633 to 878d441 Compare July 8, 2026 14:35
@CrisBarreiro CrisBarreiro marked this pull request as ready for review July 9, 2026 09:48
@CrisBarreiro CrisBarreiro force-pushed the feature/cris/enable-contingency-messaging branch from cdffe40 to c4b2af4 Compare July 9, 2026 10:10
@CrisBarreiro CrisBarreiro changed the base branch from develop to graphite-base/9083 July 9, 2026 10:25
@CrisBarreiro CrisBarreiro force-pushed the feature/cris/enable-contingency-messaging branch from fd2e2b1 to 84e11a7 Compare July 9, 2026 10:25
@CrisBarreiro CrisBarreiro changed the base branch from graphite-base/9083 to feature/cris/extract-domain-matcher July 9, 2026 10:25
@CrisBarreiro CrisBarreiro changed the base branch from feature/cris/extract-domain-matcher to graphite-base/9083 July 9, 2026 12:34
@CrisBarreiro CrisBarreiro force-pushed the feature/cris/enable-contingency-messaging branch from 84e11a7 to 1b4d2da Compare July 9, 2026 12:34
@graphite-app graphite-app Bot changed the base branch from graphite-base/9083 to develop July 9, 2026 12:35
@CrisBarreiro CrisBarreiro force-pushed the feature/cris/enable-contingency-messaging branch from 1b4d2da to c62ca18 Compare July 9, 2026 12:35

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit c62ca18. Configure here.

@cmonfortep cmonfortep left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

Just few recommendations to avoid showing the sheet on race conditions, or on wrong sites.

Show a one-off bottom sheet when ad-blocking contingency mode is enabled
and the user visits YouTube, gated behind the adBlockingUXImprovements
flag. It shows once per contingency-enabled period; the shown state is
reset when contingency mode is disabled (observed via the toggle's
enabled() flow in MainProcessLifecycleObserver.onCreate).

Driven by AdBlockingExtensionJsInjectorPlugin on page load, which notifies
the internal ContingencyMessageHandler, keeping JS injection and UI
concerns separated. No changes to any -api module.
@CrisBarreiro CrisBarreiro force-pushed the feature/cris/enable-contingency-messaging branch from c62ca18 to da76a95 Compare July 9, 2026 16:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants