-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Migrate Remaining EditPostActivity
Direct Launches to EditorLauncher
#22120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrate Remaining EditPostActivity
Direct Launches to EditorLauncher
#22120
Conversation
… targetClass Replace direct EditPostActivity Intent creation with EditorLauncher for share intents and eliminate the reflection-like targetClass pattern in ShareAction enum. Changes: - Migrate SHARE_TO_POST to use EditorLauncher.getInstance().createEditorIntent() - Remove ShareAction.targetClass property and use explicit switch statement - Add null checking for selectedSite with appropriate error handling - Preserve original media sharing behavior via Intent.EXTRA_STREAM This addresses the review comment about remaining direct EditPostActivity launches and improves the ShareAction design by removing the awkward targetClass property.
…serving site resolution behavior Migrate AddQuickPressShortcutActivity to use EditorLauncher while maintaining the original behavior where shortcuts store site IDs and resolve them to SiteModels at launch time. Changes: - Add EditorLauncherSiteParameter sealed class supporting EditorLauncherSite(SiteModel) or QuickPressBlogId(Int) - Replace EditorLauncherParams.site with siteParameter field for compile-time type safety - Add Builder.forSite() and Builder.forQuickPressBlogId() factory methods - Update EditorLauncher.addBasicExtras() to handle both site parameter types - Migrate AddQuickPressShortcutActivity to use Builder.forQuickPressBlogId() - Update all existing Builder usages in ActivityLauncher and ShareIntentReceiverActivity This preserves original QuickPress behavior where EditPostActivity resolves site IDs at launch time, while routing through EditorLauncher for analytics and consistency.
…ia upload Replace direct EditPostActivity Intent creation with EditorLauncher for the "Write Post" action that appears in snackbars after successful media uploads. Changes: - Use EditorLauncher.getInstance().createEditorIntent() for write post action - Pass insertMedia parameter with uploaded media files - Preserve isPage(false) for new post creation - Maintain existing Intent flags for proper activity handling This ensures consistent editor routing and analytics tracking for posts created after media upload while preserving the original media insertion behavior.
…t creation Replace direct EditPostActivity Intent creation with EditorLauncher for the "Write Post" action that appears in upload completion notifications. Changes: - Use EditorLauncher.getInstance().createEditorIntent() for notification write post action - Pass insertMedia parameter with uploaded media files - Preserve isPage(false) for new post creation - Maintain existing Intent flags and notification action setup This ensures consistent editor routing and analytics tracking for posts created from upload notifications while preserving the original media insertion behavior.
8e2fdd3
to
cf7c1f6
Compare
84c0290
to
8c473d7
Compare
|
App Name | ![]() |
|
Flavor | Jalapeno | |
Build Type | Debug | |
Version | pr22120-f9ba6e5 | |
Commit | f9ba6e5 | |
Direct Download | wordpress-prototype-build-pr22120-f9ba6e5.apk |
|
App Name | ![]() |
|
Flavor | Jalapeno | |
Build Type | Debug | |
Version | pr22120-f9ba6e5 | |
Commit | f9ba6e5 | |
Direct Download | jetpack-prototype-build-pr22120-f9ba6e5.apk |
Update test to expect 'siteParameter' field instead of 'site' field after the EditorLauncherParams refactor to use sealed class. The test reflection was failing because the field name changed from 'site' to 'siteParameter' in the data class.
Improve naming throughout EditorLauncher ecosystem to better convey intent: Changes: - EditorLauncherSiteParameter → EditorLauncherSiteSource - EditorLauncherSite → DirectSite (clearer than generic Site) - QuickPressBlogId → QuickPressSiteId (consistent naming) - siteParameter field → siteSource field - quickPressBlogId property → siteId property The "siteSource" name better conveys that this parameter represents the source of site information (either direct SiteModel or site ID to be resolved later), rather than being just another generic parameter. Addresses Copilot suggestion for more meaningful naming.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR completes the migration from direct EditPostActivity
launches to using the EditorLauncher
pattern across the WordPress Android codebase. The primary goal is to centralize editor launching logic and improve type safety through the use of EditorLauncherParams
.
- Migrates remaining
EditPostActivity
direct launches in share intents, QuickPress shortcuts, upload notifications, and upload snackbars - Extends
EditorLauncherParams
to support QuickPress shortcuts with runtime site resolution - Removes reflection-like patterns in favor of explicit switch statements
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
EditorLauncherParams.kt | Adds sealed class for site sources and factory methods for different launch scenarios |
EditorLauncher.kt | Updates intent creation to handle both direct site models and QuickPress blog IDs |
ShareIntentReceiverActivity.java | Migrates share intents to use EditorLauncher with explicit switch statement |
ShareIntentReceiverFragment.java | Removes reflection-like targetClass pattern from ShareAction enum |
AddQuickPressShortcutActivity.java | Migrates QuickPress shortcuts to use EditorLauncher with blog ID resolution |
UploadUtils.java | Migrates "Write Post" snackbar action to use EditorLauncher |
PostUploadNotifier.java | Migrates upload notification "Write Post" action to use EditorLauncher |
ActivityLauncher.java | Updates all existing EditorLauncher usages to use new factory methods |
EditorLauncherTest.kt | Updates test to reflect site source parameter changes |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## trunk #22120 +/- ##
=======================================
Coverage 39.43% 39.43%
=======================================
Files 2149 2149
Lines 101872 101872
Branches 15604 15604
=======================================
Hits 40177 40177
Misses 58126 58126
Partials 3569 3569 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes look good and all testing steps passed
@oguzkocer it appears this introduced a regression where the GutenbergKit editor content is unexpectedly discarded when toggling the OS appearance. This problem does not occur for Gutenberg Mobile. Screen_Recording_20250813_150159_Jetpack.Pre-Alpha.mp4 |
@dcalhoun Thank you for reporting the issue! This is not a regression in this PR, because I can reproduce the issue in |
Follow up to #22111 to migrate the remaining
EditPostActivity
launches to use theEditorLauncher
.ShareIntentReceiverActivity Migration
Commit: 934ed82
Migrated share intents to use EditorLauncher and removed the reflection-like
targetClass
pattern from ShareAction enum.Changes:
shareAction.targetClass
with explicit switch statementEditorLauncher.getInstance().createEditorIntent()
forSHARE_TO_POST
selectedSite
Testing:
MediaBrowserActivity
opensAddQuickPressShortcutActivity Migration
Commit: dfb51a0
Extended EditorLauncherParams to support QuickPress shortcuts while preserving the original site resolution behavior where shortcuts store site IDs and resolve them at launch time.
Changes:
EditorLauncherSiteSource
sealed class for compile-time type safetyBuilder.forSite()
andBuilder.forQuickPressBlogId()
factory methodsEditorLauncher
to handle both site source typesAddQuickPressShortcutActivity
to useBuilder.forQuickPressBlogId()
Testing:
UploadUtils Migration
Commit: ed06a15
Migrated the "Write Post" action that appears in snackbars after successful media uploads to use EditorLauncher.
Changes:
EditorLauncher.getInstance().createEditorIntent()
for write post actioninsertMedia
parameter with uploaded media filesisPage(false)
for new post creationTesting:
PostUploadNotifier Migration
Commit: 8e2fdd3
Migrated the "Write Post" action in upload completion notifications to use EditorLauncher.
Changes:
EditorLauncher.getInstance().createEditorIntent()
for notification write post actioninsertMedia
parameter with uploaded media filesisPage(false)
for new post creationTesting:
PendingIntent
behavior → verify proper activity launch