Skip to content

CMM-2376: Add a Featured image option to the pre-publish sheet - #23283

Closed
adalpari wants to merge 7 commits into
trunkfrom
adalpari/add-android-label-support-tickets
Closed

CMM-2376: Add a Featured image option to the pre-publish sheet#23283
adalpari wants to merge 7 commits into
trunkfrom
adalpari/add-android-label-support-tickets

Conversation

@adalpari

@adalpari adalpari commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

TL;DR

This PR is adding a new section to the "publish post" bottom sheet. It now allows to add a featured image before creating a post. This has been done to be in parity with iOS.

Screenshot_20260902-180650

Description

On iOS the pre-publish sheet includes a Featured image option, but on Android the classic pre-publish bottom sheet only exposed Publish date, Tags, Categories, and Social — there was no featured-image entry point in the publish flow. Featured image was already supported elsewhere (legacy post settings, the postsrs Compose settings, and the Gutenberg editor), so this closes the gap in the classic publish flow to reach parity with iOS.

This adds a Featured image row to the pre-publish home sheet (posts only, mirroring the neighboring Categories/Tags rows) that opens a sub-screen to set, replace, or remove the post's featured image, with an image preview plus upload progress/retry states.

No backend/model changes were needed — the implementation reuses the existing FeaturedImageHelper, UpdateFeaturedImageUseCase, MediaPickerLauncher, and EditPostRepository.featuredImageId.

Notable changes:

  • New PrepublishingFeaturedImageFragment + PrepublishingFeaturedImageViewModel sub-screen, following the existing Categories pattern.
  • New "Featured image" home row with a Set/Not set summary.
  • EditPostActivity.setFeaturedImageId now writes the id directly when the post settings fragment isn't present, so setting an image from the media library/stock — and upload completion — works while only the pre-publish sheet is open. The sheet reflects changes by observing EditPostRepository.postChanged and featured-image upload events.
  • Unit tests for the new ViewModel.

Testing instructions

Set a featured image while publishing:

  • Create a post and check you can add/remove a featured image
  • Edit a post and check you can add/remove a featured image

The publish flow had no featured-image entry point, unlike iOS. Add a
"Featured image" row that opens a set/replace/remove sub-screen, reusing
the existing featured-image helpers.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@dangermattic

dangermattic commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator
1 Warning
⚠️ PR is not assigned to a milestone.

Generated by 🚫 Danger

@wpmobilebot

wpmobilebot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

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
Versionpr23283-a567f83
Build Number1498
Application IDorg.wordpress.android.prealpha
Commita567f83
Installation URL0ujvrurktdoq0
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

@wpmobilebot

wpmobilebot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

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
Versionpr23283-a567f83
Build Number1498
Application IDcom.jetpack.android.prealpha
Commita567f83
Installation URL3dsduhsoof528
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

Observe postChanged raw instead of via observeEvent, since it is a
single-consumption Event shared with other observers that would swallow
the refresh. Also render only one image view per state so an empty local
view can't cover the loaded remote image.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@wpmobilebot

wpmobilebot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

🤖 Build Failure Analysis

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

…ixes

Route featured-image removal through a new EditorDataProvider hook so the
editor's cached featured image is cleared (set already synced via the
picker result path). Add featured-image row coverage to the home
ViewModel test and resolve detekt findings.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@codecov

codecov Bot commented Sep 2, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 75.00000% with 17 lines in your changes missing coverage. Please review.
✅ Project coverage is 37.93%. Comparing base (925f6c4) to head (a567f83).

Files with missing lines Patch % Lines
...aturedimage/PrepublishingFeaturedImageViewModel.kt 78.26% 3 Missing and 7 partials ⚠️
.../wordpress/android/ui/posts/FeaturedImageHelper.kt 0.00% 3 Missing ⚠️
...s/prepublishing/home/PrepublishingHomeViewModel.kt 76.92% 1 Missing and 2 partials ⚠️
...d/ui/posts/prepublishing/PrepublishingViewModel.kt 66.66% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##            trunk   #23283      +/-   ##
==========================================
+ Coverage   37.91%   37.93%   +0.01%     
==========================================
  Files        2352     2353       +1     
  Lines      128795   128862      +67     
  Branches    17898    17917      +19     
==========================================
+ Hits        48836    48886      +50     
- Misses      75964    75971       +7     
- Partials     3995     4005      +10     

☔ View full report in Codecov by Harness.
📢 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.

@adalpari
adalpari marked this pull request as ready for review September 2, 2026 12:25
@adalpari
adalpari requested a review from nbradbury September 2, 2026 12:25
@nbradbury

Copy link
Copy Markdown
Contributor

@adalpari Claude found two issues that should be addressed.

review-pr23283-featured-image-prepublish-2026-09-02.pdf

adalpari and others added 2 commits September 2, 2026 16:04
Address code-review findings on the featured-image pre-publish option:

- Gate the row to hosts that can fully edit a featured image via a new
  EditorDataProvider.supportsFeaturedImageEditing(); the posts-list
  quick-publish flow has no editor, so it no longer offers a Set button
  that can't complete.
- Fix GutenbergKitActivity.setFeaturedImageId to write the id and sync
  the editor when the settings screen isn't shown (sheet is open).
- Cancel any pending upload when replacing an image, matching the
  legacy choose path.
- Base the home row's Set/Not set label on the featured image state so
  an in-progress upload no longer reads as "Not set".

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@adalpari

adalpari commented Sep 2, 2026

Copy link
Copy Markdown
Contributor Author

@adalpari Claude found two issues that should be addressed.

review-pr23283-featured-image-prepublish-2026-09-02.pdf

Addressed! :)

@nbradbury

Copy link
Copy Markdown
Contributor

@adalpari After choosing a featured image, it briefly disappears after uploading. The featured image in "Post Settings" does the same thing, sadly.

2.webm

Also, this works differently than choosing a featured image in post settings. There when you tap to add a featured image, it takes you directly to the photos without an intermediate step. It also shows the featured image right there in post settings, and you can tap to change or remove it. It seems like pre-publish should handle things the same way.

4.webm

Lastly, I did a re-review and Claude found a potential "Medium" issue.

rereview-pr23283-featured-image-prepublish-2026-09-02.pdf

@adalpari

adalpari commented Sep 2, 2026

Copy link
Copy Markdown
Contributor Author

Also, this works differently than choosing a featured image in post settings. There when you tap to add a featured image, it takes you directly to the photos without an intermediate step. It also shows the featured image right there in post settings, and you can tap to change or remove it. It seems like pre-publish should handle things the same way.

I guess you mean the middle "Choose/Remove Featured Image" CTA screen right?
I did it that way to follow how other fields in the pre-publish screen work. For instance if you want to add a tag or a category, they are handled at a deeper level/screen. So, imo, it's better to follow the general bottom sheet behaviour. Maybe we could change the "Set" label once is set by a thumbnail.

About the other points, let me have a look.

adalpari and others added 2 commits September 2, 2026 17:29
setupHomeUiState runs on the main thread, so use a lightweight
FeaturedImageHelper.hasFeaturedImageOrPendingUpload check instead of
createCurrentFeaturedImageState, which does a media-store lookup and
Photon URL work just to produce a boolean.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Replace the featured-image sub-screen with an inline "Featured image"
card on the pre-publish home sheet, matching iOS: a placeholder that
opens the picker, and once set, tapping it offers Replace/Remove (and
Retry on a failed upload). The card updates live via a merged UI state
refreshed off the main thread on post/upload changes.

Also pin the publish/submit button as a footer so it stays visible while
the sheet scrolls, and compare the card by its rendered content in the
diff callback so repeated refreshes don't flicker the image.

Removes the now-unused PrepublishingFeaturedImageFragment/ViewModel,
its screen navigation, DI wiring and strings.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@adalpari adalpari closed this Sep 2, 2026
@adalpari
adalpari deleted the adalpari/add-android-label-support-tickets branch September 2, 2026 16:06
@adalpari

adalpari commented Sep 3, 2026

Copy link
Copy Markdown
Contributor Author

This PR was auto-closed when the branch was renamed (adalpari/add-android-label-support-ticketscmm-2376-featured-image-pre-publish-sheet). Work continues in #23284.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants