Refactor EditPostActivity by extracting helper classes#22492
Closed
Refactor EditPostActivity by extracting helper classes#22492
Conversation
Extract three cohesive responsibilities from EditPostActivity into testable helper classes, reducing the Activity by ~130 lines: - MediaUploadCoordinator: Handles media upload event coordination between FluxC and the editor (progress, success, error, retry) - PostLoadingStateManager: Manages post loading state machine and progress dialog visibility - EditorIntentProcessor: Processes editor intents and determines appropriate actions (new post, existing post, share, reblog, etc.) Each helper follows existing patterns using @reusable Dagger injection with callback interfaces for Activity-level handling. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Collaborator
Generated by 🚫 Danger |
Contributor
|
| App Name | Jetpack | |
| Flavor | Jalapeno | |
| Build Type | Debug | |
| Version | pr22492-f866f81 | |
| Commit | f866f81 | |
| Direct Download | jetpack-prototype-build-pr22492-f866f81.apk |
Contributor
|
| App Name | WordPress | |
| Flavor | Jalapeno | |
| Build Type | Debug | |
| Version | pr22492-f866f81 | |
| Commit | f866f81 | |
| Direct Download | wordpress-prototype-build-pr22492-f866f81.apk |
Continues refactoring EditPostActivity by extracting three more cohesive responsibilities into testable helper classes: - EditorMediaPickerHandler: Handles media picker launching - EditorActivityResultHandler: Handles activity result processing - ShareContentHandler: Handles share content from intents Each handler follows the existing @reusable Dagger pattern with callback interfaces for Activity-level operations. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## trunk #22492 +/- ##
==========================================
+ Coverage 38.93% 39.12% +0.19%
==========================================
Files 2190 2199 +9
Lines 105425 106022 +597
Branches 14952 15164 +212
==========================================
+ Hits 41052 41486 +434
- Misses 60940 60997 +57
- Partials 3433 3539 +106 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…tivity Extracts two more helper classes: - EditorModeHandler - Manages editor mode switching (HTML/Visual/Gutenberg) - EditorNavigationManager - Manages ViewPager navigation and UI updates Reduces EditPostActivity by 79 lines with full unit test coverage. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Extracts post publishing and upload coordination logic: - PostPublishingCoordinator handles primary action, upload, validation, and publish - Manages email verification checks and empty post validation - Delegates to StorePostViewModel for actual saving Reduces EditPostActivity by 91 lines with unit test coverage. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
Contributor
Author
|
Closing this as it was just an experiment. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.





Summary
Refactors EditPostActivity by extracting cohesive responsibilities into smaller, testable helper classes.
Phase 1 (Initial commit):
MediaUploadCoordinator- Coordinates media upload events between FluxC and the editorPostLoadingStateManager- Manages post loading states and progress dialogsEditorIntentProcessor- Processes editor intents and determines post setup actionsPhase 2:
EditorMediaPickerHandler- Handles media picker launching for the post editorEditorActivityResultHandler- Handles activity result processingShareContentHandler- Handles setting post content from share intentsPhase 3:
EditorModeHandler- Manages editor mode switching (HTML/Visual/Gutenberg)EditorNavigationManager- Manages ViewPager navigation and UI updates for destinationsPhase 4:
PostPublishingCoordinator- Handles post publishing workflow, email verification, and upload validationEach handler follows the existing
@ReusableDagger pattern with callback interfaces for Activity-level operations. This approach:Test plan
Build verification:
./gradlew assembleWordPressVanillaDebugpasses./gradlew detektpasses./gradlew checkstylepasses./gradlew :WordPress:testWordPressVanillaDebugUnitTestpassesManual testing:
Media upload flow:
Activity result handling:
Share content:
Editor mode switching:
Navigation:
Publishing flow:
🤖 Generated with Claude Code