-
Notifications
You must be signed in to change notification settings - Fork 1.3k
EditorLauncher
Scaffold Implementation
#22111
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
Conversation
Implement hybrid approach for editor activity routing that will support both legacy EditPostActivity and future EditPostGutenbergKitActivity. Changes: - Add EditorLauncher singleton with feature-flag-based routing logic - Migrate all ActivityLauncher methods to use EditorLauncher helper - Add EditorLauncher to dependency injection (AppComponent) - Include analytics tracking and source identification for launches - Route to EditPostActivity for now (scaffold implementation) This provides infrastructure for clean editor activity separation while maintaining backward compatibility. Future changes will: - Add EditorLauncherParams data class with builder pattern - Route to EditPostGutenbergKitActivity when implemented - Add redirection fallback with monitoring Covers ActivityLauncher methods: - openEditorForSiteInNewStack() - openEditorForPostInNewStack() - openEditorForReblog() - addNewPostForResult() variants - editPostOrPageForResult() variants - editPageForResult() variants - addNewPageForResult() variants
Replace Bundle-based Intent extras with type-safe parameter objects to improve maintainability and reduce errors. Changes: - Add EditorLauncherParams.kt with Kotlin data class and Java Builder pattern - Update EditorLauncher.kt to accept EditorLauncherParams instead of Intent bundles - Refactor ActivityLauncher.java methods to use EditorLauncherParams.Builder - Add backward compatibility with deprecated Intent-based method - Centralize all Intent extra handling in EditorLauncher.addEditorExtras() - Maintain analytics tracking with type-safe parameter source detection This provides compile-time safety while maintaining Java interoperability through the builder pattern.
Complete migration to EditorLauncherParams for all ActivityLauncher methods. Changes: - Remove deprecated createEditorIntent(context, Intent) method from EditorLauncher - Remove unused getIntentSource() legacy method - Update remaining ActivityLauncher methods to use EditorLauncherParams.Builder: - addNewPostWithContentFromAIForResult() - addNewPageForResult() (both Activity and Fragment variants) - All editor launches now use type-safe parameters instead of Bundle operations This completes the EditorLauncherParams migration for ActivityLauncher, providing compile-time safety and better maintainability.
Address all code quality issues identified by Detekt static analysis. Changes: - Remove unused imports (Bundle) and unused property (analyticsTracker) - Replace TODO comments with regular comments to avoid ForbiddenComment violations - Break down complex addEditorExtras() method into smaller helper methods: - addBasicExtras() - site, page, promo flags - addPostExtras() - post IDs, autosave, quickpress, landing editor flags - addReblogExtras() - reblog title, quote, image, citation, action - addPageExtras() - page title, content, template - addMiscExtras() - voice content, media, prompt ID, entry point - Fix MaxLineLength violations by splitting long builder method calls - Add missing newline at end of EditorLauncherParams.kt This reduces cyclomatic complexity and improves code maintainability while maintaining all existing functionality.
Centralizes the EXTRA_CREATION_SOURCE_DETAIL Intent extra creation in EditorLauncher.addMiscExtras instead of requiring manual addition in each ActivityLauncher method. This eliminates code duplication and ensures analytics tracking is consistently applied across all editor launches. Changes: - Add AnalyticsUtils.EXTRA_CREATION_SOURCE_DETAIL to EditorLauncher.addMiscExtras - Remove redundant analytics field additions from ActivityLauncher methods - Add AnalyticsUtils import to EditorLauncher
Makes the Java Builder pattern more type-safe by requiring SiteModel in the constructor rather than checking for null at build time. Changes: - EditorLauncherParams.Builder now takes @nonnull SiteModel in constructor - Remove site() setter method from Builder - Remove runtime requireNotNull check in build() - Update all call sites to pass site to constructor - Add missing @nonnull annotations in ActivityLauncher
Tracks editor launches with should_use_gutenberg_kit property to understand feature flag usage patterns.
Ensures all EditorLauncherParams fields are handled in EditorLauncher.addEditorExtras() through documentation and a unit test that validates completeness. Changes: - Add cross-reference documentation in EditorLauncherParams and EditorLauncher - Add EditorLauncherTest with detailed field-to-method mapping documentation - Test validates that all fields are accounted for in addEditorExtras methods - Filter out Kotlin synthetic fields in test validation
Adds a way to distinguish editor launches that went through EditorLauncher vs direct Intent creation for analytics purposes. Changes: - EditorLauncher: Add EXTRA_LAUNCHED_VIA_EDITOR_LAUNCHER intent extra - EditPostActivity: Track EDITOR_LAUNCHED_VIA_EDITOR_LAUNCHER when extra is present (only on initial creation, not configuration changes) - AnalyticsTracker: Add EDITOR_LAUNCHED_VIA_EDITOR_LAUNCHER stat
Generated by 🚫 Danger |
|
App Name | ![]() |
|
Flavor | Jalapeno | |
Build Type | Debug | |
Version | pr22111-4198b77 | |
Commit | 4198b77 | |
Direct Download | jetpack-prototype-build-pr22111-4198b77.apk |
WordPress/src/main/java/org/wordpress/android/ui/ActivityLauncher.java
Fixed
Show resolved
Hide resolved
|
App Name | ![]() |
|
Flavor | Jalapeno | |
Build Type | Debug | |
Version | pr22111-4198b77 | |
Commit | 4198b77 | |
Direct Download | wordpress-prototype-build-pr22111-4198b77.apk |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## trunk #22111 +/- ##
=======================================
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:
|
I asked Claude this:
And got this response:
I don't think the first one is an issue, but the others appear to be launching |
When I tap a post in the post list, it shows an empty post in the editor. Same for pages. empty-post.mp4Logcat shows we're passing
|
Sharing a photo to the app also fails with the same
share.mp4 |
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.
When I tap a post in the post list, it shows an empty post in the editor. Same for pages.
I experience the same for each of the three editors—GutenbergKit, Gutenberg Mobile, and Aztec. Surprisingly, it does not occur when creating a new page from a template; that flow successfully populates the editor.
Sharing a photo to the app also fails with the same
HTTP 400
issue.
Sharing media to GutenbergKit is currently unsupported, see CMM-190. That said, sharing media to Gutenberg Mobile appears broken in the trunk
branch, so likely unrelated to these changes. 😞
I performed quick smoke testing of fundamental features in each of GutenbergKit, Gutenberg Mobile, and Aztec—text editing, media uploads, drafting, publishing, analytics, network connection changes, OS appearance changes, etc. I did not encounter regressions aside from those noted above.
Prevents crashes when PostModel is null (e.g., when mPostStore.getPostByLocalPostId returns null for non-existent posts) by showing a user-friendly error message instead. Changes: - Add null check and error toast in both editPostOrPageForResult variants - Prevents crashes from calling post.getId() or post.isPage() on null objects
The trunk editPostOrPageForResult methods never set boolean extras like EXTRA_IS_PAGE, EXTRA_IS_PROMO, or EXTRA_LOAD_AUTO_SAVE_REVISION unless explicitly required. Making all boolean parameters nullable ensures they're only set when explicitly provided, matching trunk behavior exactly. Changes: - Make all boolean fields nullable in EditorLauncherParams and Builder - Update EditorLauncher to only set extras when parameters are non-null - Remove unnecessary loadAutoSaveRevision(false) from first editPostOrPageForResult - Preserves explicit boolean settings in other methods (pages, promos, etc.)
0f02cd3
to
2c1d8d5
Compare
@nbradbury Let me take a look at that in a separate PR. |
This was an unfortunate oversight by me, and it was happening because some of the Really sorry about the faulty PR 🙇♂️ |
.reblogPostImage(post.getFeaturedImage()) | ||
.reblogPostCitation(post.getUrl()) | ||
.reblogAction(EditPostActivityConstants.ACTION_REBLOG) | ||
.source(reblogSource) |
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.
The original implementation didn't set this here and set it in addNewPostForResult
instead. This wouldn't have been a problem, but I've removed it in 4198b77 to match the previous implementation.
|
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.
@oguzkocer The problem with opening posts/pages appears to be resolved so merge when ready
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.
The latest iteration tested well for me in GutenbergKit, Gutenberg Mobile, and Aztec. I believe we are good to merge.
Summary
Adds a centralized
EditorLauncher
system to replace direct Intent creation for editor activities, providing type-safe parameters and consistent analytics tracking.Motivation
This scaffolding enables the future introduction of a dedicated
GutenbergKitActivity
by centralizing editor launch logic. The plan is to:GutenbergKitActivity
This approach allows iterating on a clean, modern editor experience while maintaining backward compatibility through the existing activity.
Key Components
EditorLauncher
EDITOR_LAUNCHER
events withwill_use_gutenberg_kit
property and addsEXTRA_LAUNCHED_VIA_EDITOR_LAUNCHER
intent extraEditorLauncherParams
Integration
EXTRA_CREATION_SOURCE_DETAIL
handling eliminates code duplicationTechnical Details
Type Safety Improvements
SiteModel
parameter upfront (no runtime null checks)Analytics Centralization
Previously, every ActivityLauncher method manually added analytics extras:
Now handled automatically in EditorLauncher when
params.source
is provided.Launch Method Tracking
EditorLauncher adds
EXTRA_LAUNCHED_VIA_EDITOR_LAUNCHER
intent extra to distinguish between:EDITOR_LAUNCHED_VIA_EDITOR_LAUNCHER
)This enables measuring EditorLauncher adoption vs legacy launch methods.
Completeness Validation
Backward Compatibility