Skip to content
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

Removes - unused methods and classess using Android Studio Tool - Part 2 #19850

Merged
merged 64 commits into from
Jan 1, 2024

Conversation

AjeshRPai
Copy link
Contributor

@AjeshRPai AjeshRPai commented Dec 26, 2023

Fixes #

Description

This PR removes unused code from the Repo using Android Tool. Code → Analyze → Run inspection by name..., type Unused declaration

2nd Part of #19788

Screenshot 2023-12-26 at 10 31 26 AM

To Test:

  1. Smoke test the JP And WP app and verify that everything is working as expected
  2. Verify that the classess, methods and files deleted are unused.

Regression Notes

  1. Potential unintended areas of impact
    App is not working as expected

  2. What I did to test those areas of impact (or what existing automated tests I relied on)
    Manual testing and Smoke testing

  3. What automated tests I added (or what prevented me from doing so)
    Nothing

PR submission checklist:

  • I have completed the Regression Notes.
  • I have considered adding accessibility improvements for my changes.
  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

UI Changes testing checklist:

  • Portrait and landscape orientations.
  • Light and dark modes.
  • Fonts: Larger, smaller and bold text.
  • High contrast.
  • Talkback.
  • Languages with large words or with letters/accents not frequently used in English.
  • Right-to-left languages. (Even if translation isn’t complete, formatting should still respect the right-to-left layout)
  • Large and small screen sizes. (Tablet and smaller phones)
  • Multi-tasking: Split screen and Pop-up view. (Android 10 or higher)

@AjeshRPai AjeshRPai self-assigned this Dec 26, 2023
@wpmobilebot
Copy link
Contributor

wpmobilebot commented Dec 26, 2023

WordPress📲 You can test the changes from this Pull Request in WordPress by scanning the QR code below to install the corresponding build.
App NameWordPress WordPress
FlavorJalapeno
Build TypeDebug
Versionpr19850-9658b98
Commit9658b98
Direct Downloadwordpress-prototype-build-pr19850-9658b98.apk
Note: Google Login is not supported on these builds.

@AjeshRPai AjeshRPai changed the title Removes unused methods using Android Studio Tool Removes unused methods using Android Studio Tool - 2/2 Dec 26, 2023
@AjeshRPai AjeshRPai changed the title Removes unused methods using Android Studio Tool - 2/2 Removes - unused methods and classess using Android Studio Tool - 2/2 Dec 26, 2023
@AjeshRPai AjeshRPai requested a review from irfano December 27, 2023 09:54
@AjeshRPai AjeshRPai marked this pull request as ready for review December 27, 2023 09:54
@AjeshRPai AjeshRPai requested a review from a team as a code owner December 27, 2023 09:54
Copy link
Member

@irfano irfano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found out some unused fields while reviewing. Then I noticed this PR only covers methods and classes and I refrained from delving into the details to find more unused fields.
When I run unused declaration for only methods and classes, there are still 317 warnings. Some of these warnings are false alarms, but others are really unused. Did you intentionally leave them in the code? Here are few examples:

  • AztecEditorFragment.canUndo()
  • AztecEditorFragment.MediaPredicate.getTempMediaIdPredicate()
  • AppPrefs.getReaderRecommendedTagsDeletedForLoggedOutUser()
  • LocaleManager.createLanguageDetailDisplayStrings()

Was your intention to remove all unused methods and classes? If that is the case, I can go over all warnings to find unused declarations that are really unused.
I have smoke-tested the basic features, and they are still working properly 🟢. I believe this PR is safe. We can either add more unused code and merge this, or merge this and perform other cleanups in a separate PR.

Comment on lines -646 to -647
properties.put(NEWS_CARD_ORIGIN, origin);
properties.put(NEWS_CARD_VERSION, String.valueOf(version));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can remove also AnalyticsUtil.NEWS_CARD_ORIGIN and AnalyticsUtil.NEWS_CARD_VERSION.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can also remove the definition of these keys, DeletablePrefKey.STATS_WIDGET_KEYS_BLOGS, DeletablePrefKey.STATS_WIDGET_DATA, DeletablePrefKey.STATS_WIDGET_DATA, DeletablePrefKey.STATS_WIDGET_PROMO_ANALYTICS, UndeletablePrefKey.IAP_SYNC_REQUIRED, DeletablePrefKey.PENDING_DRAFTS_NOTIFICATION_LAST_NOTIFICATION_DATES.

@peril-wordpress-mobile
Copy link

peril-wordpress-mobile bot commented Jan 1, 2024

Warnings
⚠️ PR is not assigned to a milestone.

Generated by 🚫 dangerJS

@wpmobilebot
Copy link
Contributor

2 Warnings
⚠️ This PR is larger than 300 lines of changes. Please consider splitting it into smaller PRs for easier and faster reviews.
⚠️ PR is not assigned to a milestone.

Generated by 🚫 Danger

@AjeshRPai
Copy link
Contributor Author

Hey @irfano

Thanks for the review. 🙌🏼

When I run unused declaration for only methods and classes, there are still 317 warnings. Some of these warnings are false alarms, but others are unused. Did you intentionally leave them in the code? Here are a few examples

I reverted some commits, which deleted the unused functions in the Editor libs. I intend to take it up removing of the unused methods from Editor libs in a separate PR.

Was your intention to remove all unused methods and classes? If that is the case, I can go over all warnings to find unused declarations that are really unused.

Yup, I was concentrating more on Classes and Methods. There is a chance that I might have missed some methods or classes. If you can, go over all the warnings that are still there. It would be really helpful. I suggest you do it in a separate PR if possible. Otherwise, I can take it up and create a Part 3 PR.

@AjeshRPai AjeshRPai changed the title Removes - unused methods and classess using Android Studio Tool - 2/2 Removes - unused methods and classess using Android Studio Tool - 2/3 Jan 1, 2024
Copy link
Member

@irfano irfano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We discussed with Ajesh and decided to continue removing the remaining warnings in other PRs.
The changes in this PR LGTM! 👍🏻 Merging now.

@irfano irfano merged commit 2ed394c into trunk Jan 1, 2024
20 checks passed
@irfano irfano deleted the removes-unused-methods branch January 1, 2024 17:23
@AjeshRPai AjeshRPai changed the title Removes - unused methods and classess using Android Studio Tool - 2/3 Removes - unused methods and classess using Android Studio Tool - Part 2 Jan 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants