-
Notifications
You must be signed in to change notification settings - Fork 136
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
[Wear App] Remove NavController injection from all Wear ViewModels #12639
[Wear App] Remove NavController injection from all Wear ViewModels #12639
Conversation
📲 You can test the changes from this Pull Request in WooCommerce Android by scanning the QR code below to install the corresponding build.
|
📲 You can test the changes from this Pull Request in WooCommerce-Wear Android by scanning the QR code below to install the corresponding build.
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## trunk #12639 +/- ##
=========================================
Coverage 40.58% 40.58%
Complexity 5699 5699
=========================================
Files 1232 1232
Lines 69413 69397 -16
Branches 9617 9617
=========================================
- Hits 28170 28164 -6
+ Misses 38651 38642 -9
+ Partials 2592 2591 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Summary
Removes from the Wear app architectural design the practice of injecting the NavController into every VIewModel with a navigation action. This is not recommended due to the fact that the UI grants a NavController, and when the screen is destroyed, the NavController reference will also be lost.
This PR fixes it by keeping all NavControllers inside the Composables. The result is a simpler way to create the Wear ViewModels, without the need of using assisted injections.
How to Test
Make sure all screens with navigations (Login and Order List) are still working, even during configuration changes
Update release notes:
RELEASE-NOTES.txt
if necessary.Reviewer (or Author, in the case of optional code reviews):
Please make sure these conditions are met before approving the PR, or request changes if the PR needs improvement: