CMM-2376: Add a Featured image option to the pre-publish sheet - #23283
CMM-2376: Add a Featured image option to the pre-publish sheet#23283adalpari wants to merge 7 commits into
Conversation
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>
Generated by 🚫 Danger |
|
|
|
|
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>
🤖 Build Failure AnalysisThis 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 Report❌ Patch coverage is 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. 🚀 New features to boost your workflow:
|
|
@adalpari Claude found two issues that should be addressed. |
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>
Addressed! :) |
|
@adalpari After choosing a featured image, it briefly disappears after uploading. The featured image in "Post Settings" does the same thing, sadly. 2.webmAlso, 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.webmLastly, I did a re-review and Claude found a potential "Medium" issue. |
I guess you mean the middle "Choose/Remove Featured Image" CTA screen right? About the other points, let me have a look. |
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>
|
This PR was auto-closed when the branch was renamed ( |


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.
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
postsrsCompose 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, andEditPostRepository.featuredImageId.Notable changes:
PrepublishingFeaturedImageFragment+PrepublishingFeaturedImageViewModelsub-screen, following the existing Categories pattern.EditPostActivity.setFeaturedImageIdnow 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 observingEditPostRepository.postChangedand featured-image upload events.Testing instructions
Set a featured image while publishing: