-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Add navigation abstraction layer to EditPostActivity
#22067
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
- EditPostDestination: Type-safe sealed class for navigation destinations - EditPostNavigator: Interface for navigation implementation abstraction - Provides foundation for replacing ViewPager with flexible navigation
- Manages navigation state and events using LiveData - Provides navigateTo() method accepting destination enum - Handles back navigation logic with proper fallback hierarchy - Includes debugging logs for navigation flow tracking - Uses EditPostDestination.default() for type-safe fallbacks
- Tests all navigation methods and state transitions - Covers complete user journey flows (Editor → Settings → PublishSettings) - Verifies event emission for UI updates - Tests edge cases like back navigation from Editor - Ensures proper fallback behavior and type safety - 11 test scenarios with 100% navigation logic coverage
- Set up navigation state observers to update ViewPager position and UI - Replace direct ViewPager.currentItem assignments with editPostNavigationViewModel.navigateTo() - Update back navigation logic to use navigation ViewModel with proper fallback - Update menu visibility logic to use navigation state instead of ViewPager position - Add helper methods updateViewPagerPosition() and updateUIForDestination() - Maintain existing ViewPager functionality while adding navigation abstraction layer
- Remove onPageSelected callback that was duplicating UI updates - Fix History destination to use correct liftOnScrollTargetViewId (empty_recycler_view) - UI updates now handled exclusively by navigation system in updateUIForDestination() - ViewPager is now purely for content display, not navigation state management
|
App Name | ![]() |
|
Flavor | Jalapeno | |
Build Type | Debug | |
Version | pr22067-579b8fa | |
Commit | 579b8fa | |
Direct Download | wordpress-prototype-build-pr22067-579b8fa.apk |
|
App Name | ![]() |
|
Flavor | Jalapeno | |
Build Type | Debug | |
Version | pr22067-579b8fa | |
Commit | 579b8fa | |
Direct Download | jetpack-prototype-build-pr22067-579b8fa.apk |
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## trunk #22067 +/- ##
=======================================
Coverage 39.29% 39.29%
=======================================
Files 2143 2143
Lines 101698 101698
Branches 15597 15597
=======================================
Hits 39958 39958
Misses 58187 58187
Partials 3553 3553 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
* Interface for handling navigation between different screens in the Edit Post flow. | ||
* Provides abstraction over the underlying navigation implementation. | ||
*/ | ||
interface EditPostNavigator { |
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.
AS says this interface is unused, which I confirmed by deleting it and successfully building the app. Is there a reason to keep this?
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.
This abstraction happened a little early in the process. I'll remove it in #22068 and re-add it when we need it. Sorry for the confusion!
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 main editor screen where users write and edit post content. | ||
*/ | ||
object Editor : EditPostDestination() |
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.
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.
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 Code looks and works fine. I left a couple of comments, but it's up to you whether they're worth addressing so I'll approve this. I do recommend asking Copilot for a review in future PRs - it usually does a great job finding issues.
Update: Well, I hadn't noticed that auto-merge was enabled, so I guess if you want to address those comments you can do so in a subsequent PR.
Summary
Replaces direct ViewPager manipulation with a testable navigation abstraction layer.
Changes
Benefits
Testing Instructions