-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Part-4: Compiler Warnings as Errors - WordPress Module - FragmentManager and PreferenceFragment #19876
Part-4: Compiler Warnings as Errors - WordPress Module - FragmentManager and PreferenceFragment #19876
Conversation
1) Only updated feasible getFragmentManager() occurence
For java to kotlin conversion
Created AndroidX implementation of NotificationsSettingsDialogPreference.java
1) Ringtone preference is deprecated. 2) WPSwitchPreference replaced with AndroidX implementation.
1) Why? -> androidx.preference does not support addition of Child Preference Screens programtically no longer. Reference: https://stackoverflow.com/questions/60029806/why-does-the-nested-preferencescreen-not-open-when-using-androidx (Cites documentation as proof of result) 2) Why `ChildNotificationSettingsFragment`? -> To automatically change toolbar's state. 3) Why Change `NotificationsSettingsActivity`? -> The new androidx implementation requires the use of `PreferenceFragmentCompat` and to navigate to child preference screens, we need the parent activity to implement `PreferenceFragmentCompat.OnPreferenceStartFragmentCallback`
1) Why? -> androidx.preference does not support addition of Child Preference Screens programtically no longer. Reference: https://stackoverflow.com/questions/60029806/why-does-the-nested-preferencescreen-not-open-when-using-androidx (Cites documentation as proof of result) 2) Why `NotificationsMySitesSettingsFragment` interface? -> So, both `NotifcationsSettingsFragment` and a child preference screen deal with changes in settings for followed blogs/my sites. To separate out common code and give a form of abstraction to the purpose, this interface was implemented.
Why? PreferenceFragment has been deprecated in favour of PreferenceFragmentCompat Changes: 1) Previous java to kotlin migration fixes such as dependency injection fixes and null safety. 2) Removed Notification Types Child preference screen in favour of recommended implementation. 3) Removed Notification Types Child preference screen in favour of recommended implementation. 4) Removed Deprecated DialogPreference in favour of androidx implementation. 5) Ringtone Preference migration to Preference as support for it has been deprecated. References: https://stackoverflow.com/questions/60029806/why-does-the-nested-preferencescreen-not-open-when-using-androidx (cites high quality resource for problem and its solution)
@antonis Pr is ready for review! |
Note: Component left in PR for easy review: |
Generated by 🚫 dangerJS |
Thank you for your work on this @07jasjeet 🙇 I was wondering if the commits can be split into smaller PRs that can be reviewed and tested independently? If there are dependencies the PRs can be chained and merged one by one. We rarely land so big code changes in one batch.
This can also be included if we extract the related work in a separate PR. |
Alright, so each commit will have its own PRs. Considering that, we need some PRs as follows:
|
The above PR split looks good to me 👍 |
Hey @07jasjeet 👋 I've run some automated test and found the following. Checkstyle
Detekt
|
Not sure on how to solve the |
Good question @07jasjeet 👍 The specific rule is related to how we import WordPress-FluxC-Android inner classes. It can be handled by using the full import of the inner class (e.g. in I've prepared a patch for the specific cases below. This rule may seem opinionated but it is part of the Android Code Style Guidelines for Contributors that we are using. |
On running detekt again, 8 unavoidable warning show up which existed prior to this PR's changes.
Hey @07jasjeet 👋
I will iterate with more feedback on the PR. |
Hello @antonis These are unavoidable in my eye. I do need some suggestions as to how we should move forward with this. |
Thank you for your quick response @07jasjeet and your contribution 🙇
My understanding is that those are related to new code introduced in this PR. Probably the checks on the equivalent java code were different or suppressed.
For the two
We can even add some default values and initialise this only with the properties needed on each case. For the For the The Regarding the
or
The Trying to compile the code I also get the following warnings which are treated as errors in our configuration.
One other generic issue not caught by the tools is the use of not-null assertion operator ( Taking a step back I think that we should return in our plan to split the code into multiple PRs that can be reviewed and tested individually. Do we need all the changes for #17253 or we enlarged the scope to also cover #17962? |
Alright Ill try to split commits as much as I can. As for the rest, I'll not make commits to this PR anymore and rather deal with these detekt issues in separate the PRs. |
Hey @07jasjeet! Would you still like to work on this? Should we keep this PR open? |
Closing due to inactivity, but we would be happy to review further contributions in the future! |
Partially fixes #17253 and #17962
This PR include complete migration of
NotificationsSettingsFragment
to AndroidX implementation and migration of deprecatedFragmentManager
usages.All the links and answers to some expected questions have been given in commits description itself.
A few mistakes to be considered while reading commit 275795f 's description:
Point
3
is duplicated from2
but the actual message was:The link mentioned is wrong, this is the intended link.
To Test:
Regression Notes
Potential unintended areas of impact
Notifications Settings screen's child screens
What I did to test those areas of impact (or what existing automated tests I relied on)
Manual testing
What automated tests I added (or what prevented me from doing so)
None
PR Submission Checklist:
RELEASE-NOTES.txt
if necessary.UI Changes Testing Checklist: