Skip to content

Add GutenbergKit opt-in announcement and per-site override#22813

Draft
jkmassel wants to merge 1 commit into
trunkfrom
jkmassel/gutenbergkit-opt-in
Draft

Add GutenbergKit opt-in announcement and per-site override#22813
jkmassel wants to merge 1 commit into
trunkfrom
jkmassel/gutenbergkit-opt-in

Conversation

@jkmassel
Copy link
Copy Markdown
Contributor

@jkmassel jkmassel commented Apr 22, 2026

Adds a one-time announcement bottom sheet that flips an app-wide GutenbergKit opt-in, plus a per-site tri-state override in Site Settings so a single site can be pinned on or off independently of the global flag.

Summary

  • New GutenbergKitAnnouncementBottomSheetFragment shown once per user on WPMainActivity.onResume, gated on the remote gutenberg_kit flag, a one-shot pref, a non-null current site, and SiteSettingsProvider.isBlockEditorDefault(site) (so Aztec users aren't pitched an editor they can't act on).
  • Activate sets GUTENBERG_KIT_USER_OPT_IN in UndeletablePrefKey so it survives logout; Maybe later just dismisses. Inline Learn more opens a support article via WPWebViewActivity.
  • Site Settings gains a per-site Try the new editor toggle, visible whenever the remote flag is on, that overrides the global opt-in for that site.
  • Per-site override is tri-state — opt-in / opt-out / follow-global — stored as two StringSet prefs (GUTENBERG_KIT_OPT_IN_SITES, GUTENBERG_KIT_OPT_OUT_SITES) so absence cleanly means "follow global."
  • Resolution everywhere is siteOverride ?? globalOptIn, still subject to the existing experimental / remote-feature / kill-switch gates in GutenbergKitFeatureChecker.

Changes

  • GutenbergKitAnnouncementBottomSheetFragment + gutenberg_kit_announcement_bottom_sheet.xml: New bottom sheet. Consumes top window insets so Material's BottomSheetDialog doesn't double-pad under the status bar. Inline Learn more ClickableSpan opens a web page via WPWebViewActivity.
  • WPMainActivityViewModel: checkAndShowGutenbergKitAnnouncement(site) — gated on remote flag, wasGutenbergKitAnnouncementShown, non-null site, and SiteSettingsProvider.isBlockEditorDefault(site). Replaces the deprecated SiteUtils.isBlockEditorDefaultForNewPost (now @Deprecated on trunk).
  • WPMainActivity: Observes the announcement event and shows the fragment.
  • GutenbergKitFeatureChecker: FeatureState now carries isUserOptedIn + siteOverride: Boolean?; isGutenbergKitEnabled(site) and getFeatureState(site) accept an optional SiteModel. @JvmOverloads for Java interop. isGutenbergKitRemoteFeatureEnabled() exposed for opt-in surfaces.
  • SiteSettingsFragment: New per-site toggle wired through AppPrefs.setGutenbergKitSiteOverride / getGutenbergKitSiteOverride. Displayed checked = siteOverride ?? globalOptIn. Visibility gated by the remote flag.
  • AppPrefs / AppPrefsWrapper: Adds GUTENBERG_KIT_USER_OPT_IN (undeletable), GUTENBERG_KIT_ANNOUNCEMENT_SHOWN (undeletable), GUTENBERG_KIT_OPT_IN_SITES and GUTENBERG_KIT_OPT_OUT_SITES (deletable). Javadoc'd.
  • EditorCapabilityResolver: Passes site through the GBKit gate so Theme Styles and Third-Party Blocks resolve against the same per-site view the launcher uses — previously they only saw the global opt-in, so a site-level opt-in could open GBKit without those capabilities applied.
  • EditorLauncher: Already site-aware via getFeatureState(site); no behaviour change.

Test plan

  • Fresh install with remote flag on: launch app → announcement sheet appears once; tap Activate → opens a new post → editor is GutenbergKit; sheet does not re-appear on next launch.
  • Maybe later dismisses without flipping the opt-in; sheet does not re-appear.
  • Site Settings: toggling Try the new editor opts the current site in/out, independent of the global flag; survives app restart.
  • Global opt-in on + per-site off → that site opens Aztec; other sites open GutenbergKit.
  • Global opt-in off + per-site on → that site opens GutenbergKit; Theme Styles and Third-Party Blocks rows are visible for the site (resolver agrees with the launcher).
  • Site with block editor disabled (mobileEditor == "aztec"): announcement sheet does not appear.
  • Remote flag off: neither the announcement nor the Site Settings toggle appear.
  • Learn more inline link opens the web page.
  • Unit tests: WPMainActivityViewModelTest, GutenbergKitFeatureCheckerTest, EditorCapabilityResolverTest pass.

@dangermattic
Copy link
Copy Markdown
Collaborator

1 Warning
⚠️ This PR is larger than 300 lines of changes. Please consider splitting it into smaller PRs for easier and faster reviews.
1 Message
📖 This PR is still a Draft: some checks will be skipped.

Generated by 🚫 Danger

@wpmobilebot
Copy link
Copy Markdown
Contributor

wpmobilebot commented Apr 22, 2026

App Icon📲 You can test the changes from this Pull Request in WordPress Android by scanning the QR code below to install the corresponding build.

App NameWordPress Android
Build TypeDebug
Versionpr22813-3a28b0b
Build Number1488
Application IDorg.wordpress.android.prealpha
Commit3a28b0b
Installation URL3s70lve9d34ug
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

@wpmobilebot
Copy link
Copy Markdown
Contributor

wpmobilebot commented Apr 22, 2026

App Icon📲 You can test the changes from this Pull Request in Jetpack Android by scanning the QR code below to install the corresponding build.

App NameJetpack Android
Build TypeDebug
Versionpr22813-3a28b0b
Build Number1488
Application IDcom.jetpack.android.prealpha
Commit3a28b0b
Installation URL6dimqdb3prkt0
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

@wpmobilebot
Copy link
Copy Markdown
Contributor

wpmobilebot commented Apr 22, 2026

🤖 Build Failure Analysis

This build has failures. Claude has analyzed them - check the build annotations for details.

@jkmassel jkmassel force-pushed the jkmassel/gutenbergkit-opt-in branch 3 times, most recently from 71d2a8f to 24faca7 Compare May 25, 2026 19:40
@jkmassel jkmassel changed the title Add per-site GutenbergKit opt-in and announcement bottom sheet Add GutenbergKit opt-in announcement and per-site override May 25, 2026
@jkmassel jkmassel force-pushed the jkmassel/gutenbergkit-opt-in branch from 2130282 to 046f3cd Compare May 25, 2026 19:47
@codecov
Copy link
Copy Markdown

codecov Bot commented May 25, 2026

Codecov Report

❌ Patch coverage is 43.37349% with 47 lines in your changes missing coverage. Please review.
✅ Project coverage is 37.32%. Comparing base (82411a0) to head (3a28b0b).

Files with missing lines Patch % Lines
.../java/org/wordpress/android/ui/prefs/AppPrefs.java 0.00% 38 Missing ⚠️
.../org/wordpress/android/ui/prefs/AppPrefsWrapper.kt 0.00% 4 Missing ⚠️
...a/org/wordpress/android/ui/posts/EditorLauncher.kt 0.00% 2 Missing ⚠️
...ess/android/ui/posts/GutenbergKitFeatureChecker.kt 83.33% 1 Missing and 1 partial ⚠️
...org/wordpress/android/ui/mysite/MySiteViewModel.kt 87.50% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##            trunk   #22813   +/-   ##
=======================================
  Coverage   37.32%   37.32%           
=======================================
  Files        2320     2321    +1     
  Lines      124578   124651   +73     
  Branches    16926    16947   +21     
=======================================
+ Hits        46498    46526   +28     
- Misses      74319    74362   +43     
- Partials     3761     3763    +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@jkmassel jkmassel force-pushed the jkmassel/gutenbergkit-opt-in branch 7 times, most recently from 0c000b9 to dcc7187 Compare May 25, 2026 22:00
Introduces a one-time announcement bottom sheet, shown on the next
WPMainActivity.onResume when the GutenbergKit remote feature is on,
the current site already defaults to the block editor, and the
announcement has not been shown before. The dialog's primary CTA
sets an app-wide opt-in flag (UndeletablePrefKey, persists across
logout); "Maybe later" dismisses without flipping it.

Site Settings gains a per-site GutenbergKit toggle, gated on the
same remote flag. The toggle is a tri-state override stored as two
StringSets (opt-in / opt-out / follow global), letting a user pin
a specific site on or off independent of the global opt-in.

Resolution order in GutenbergKitFeatureChecker: kill switch beats
everything; then siteOverride ?? globalOptIn ?? experimental ??
remote-feature decides. Threaded through EditorCapabilityResolver
so Theme Styles and Third-Party Blocks visibility / application
stays in agreement with whether the editor actually opens for the
site.
@jkmassel jkmassel force-pushed the jkmassel/gutenbergkit-opt-in branch from dcc7187 to 3a28b0b Compare May 25, 2026 22:09
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.

3 participants