WP Stories integration phase 1 - lint fixes not coming from Stories source code#11920
Conversation
|
You can trigger optional UI/connected tests for these changes by visiting CircleCI here. |
Generated by 🚫 dangerJS |
|
You can test the changes on this Pull Request by downloading the APK here. |
0nko
left a comment
There was a problem hiding this comment.
Hey @mzorz. The code itself looks good but I was unable to test it because I can't get it to build. I'm getting this error:
ERROR: Unable to resolve dependency for ':WordPress@wasabiDebugUnitTest/compileClasspath': Could not resolve project :libs:portkey-android:stories.
Am I missing some step?
|
Thanks @mzorz! Unfortunately, I'm not able to build the app ("Could not resolve project :libs:portkey-android:stories"). However, I reviewed the code and tested the app on the CircleCI build and it LGTM.
I think the issues you pointed out are related to a bit different issue. The mentioned issues are dealing with the difference between having the observer Activity or Fragment. Whereas this PR is dealing with the difference between having as the observer Fragment or FragmentLifeCyclerOwner. Anyway, I agree this is a good change as it fixes some issues when dealing with fragment transactions and LiveData. As I mentioned on the p2 post I think we should also go through the release notes of |
@0nko The instructions are in the base PR, should have made that clear 😅 - look here please #11864 - thanks for checking! |
|
Thanks for taking the time to check this @malinajirka !
I think I wanted to say it's about getting the right lifecycleOwner, which is obtained through the
Right, agreed 👍🏻
As commented elsewhere as well, it'd be great if we could isolate this change on the target |
|
Going to move this one to target |
|
Closing this one in favor of #11934 which targets |
This PR builds on top of #11864
Note: the instructions for building are in the base PR #11864.
This PR fixes a lot of lint errors that appeared only after adding the
portkey-androidrepo as agit submodulein #11864, and that are not strictly related to the submodule being added, but are all part of the code available in the basedevelopbranch. I have been trying to understand why these issues are reported by the linter only after adding the submodule (and these errors do not appear in the submodule's code), so after struggling for a couple of days and verifying all the libraries used are the same versions, etc as in the target codebase, decided to go ahead and fix the issues with this PR.In this sense, while this PR needs to be in the chain of a feature branch for development, is not strictly related to the functionality that the feature branch is going to end up having, but only fixes problems in the target codebase to give the new submodule a proper welcome.
The issues that appear here were of 2 kinds:
UseRequireInsteadOfGet, in order to actually fix this we'd need to change most of thecontext!!andactivity!!declarations, which I consider this is a nice to have to make code nicer but not really a behavior change, hence I added the flag as awarningclass in thelint.xmlconfiguration in 531d608.lifeCycleOwnerin all observe() calls where a Fragment or Activity was being added forViewModelchanges listening. I believe this change needed to be done as it was the source of many other issues that have been otherwise fixed as they manifested themselves (see for example this one here Changing lifecycle owner to be the fragment instead of the activity. #10954 by @develric, I've seen other comments by @planarvoid on other PRs but couldn't find their reference again). This is fixed in a889ee4.For the second one, I found this SO answer here to be useful https://stackoverflow.com/questions/59521691/use-viewlifecycleowner-as-the-lifecycleowner
From the documentation of Fragment's
getLifecycleOwnersource code itself it seems this should be the way to go anyway, and is safe to change to the recommended way:To test:
PR submission checklist:
RELEASE-NOTES.txtif necessary.