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

Notification inline actions - preliminary refactor #20172

Conversation

mkevins
Copy link
Contributor

@mkevins mkevins commented Feb 12, 2024

Description

This PR is a preliminary step to refactor and align shared elements of the design for inline actions on notifications. In the development of resolving #20040, a strategy emerged that would benefit other similar issues / tasks: establishing a declarative model for Notifications, and treating access to the pre-existing class(es) as an implementation detail. This allows us to treat the existing code structure itself as "immutable", a benefit since any changes there may be hard to follow in the current state.

This PR also adds many missing nullability annotations, and extracts some logic from a method which violates lint for "CyclomaticComplexMethod" and "LongMethod" rules (though more work is needed before the rule suppression can be removed).


To Test:

  • Run the app using this branch (either build in Android Studio, or via one of the apks)
  • Login to the app using an account which has some activity (with various kinds of notifications)
  • Smoke test the notifications behavior:
    • Scroll the notifications list and ensure they all look correct
    • Tap on some of the notifications to ensure that the behavior is still correct (e.g. tap a like notification to see the list of users who liked the comment or post, etc.)
  • Observe that comment notifications have a star icon
  • Observe that like notifications have a share icon
    • Please note that the share icon is just a place-holder for now, and currently does not match the icon from the Figma designs

Regression Notes

  1. Potential unintended areas of impact

Notifications

  1. What I did to test those areas of impact (or what existing automated tests I relied on)

Manual testing

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

Additional refactoring is necessary before automated tests can be added


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.

Testing Checklist:

  • WordPress.com sites and self-hosted Jetpack sites.
  • 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)

@dangermattic
Copy link
Collaborator

3 Warnings
⚠️ Class Notification is missing tests, but unit-tests-exemption label was set to ignore this.
⚠️ Class Like is missing tests, but unit-tests-exemption label was set to ignore this.
⚠️ Class NoteType is missing tests, but unit-tests-exemption label was set to ignore this.

Generated by 🚫 Danger

@wpmobilebot
Copy link
Contributor

wpmobilebot commented Feb 12, 2024

Jetpack📲 You can test the changes from this Pull Request in Jetpack by scanning the QR code below to install the corresponding build.
App NameJetpack Jetpack
FlavorJalapeno
Build TypeDebug
Versionpr20172-1146fe9
Commit1146fe9
Direct Downloadjetpack-prototype-build-pr20172-1146fe9.apk
Note: Google Login is not supported on these builds.

@wpmobilebot
Copy link
Contributor

wpmobilebot commented Feb 12, 2024

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
Versionpr20172-1146fe9
Commit1146fe9
Direct Downloadwordpress-prototype-build-pr20172-1146fe9.apk
Note: Google Login is not supported on these builds.

Copy link
Contributor

@jarvislin jarvislin left a comment

Choose a reason for hiding this comment

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

Thanks for refactoring the code, this is helpful to me!
Code looks great, and the testing result is as expected.

@mkevins
Copy link
Contributor Author

mkevins commented Feb 12, 2024

Thank you for reviewing and testing!

Copy link

codecov bot commented Feb 12, 2024

Codecov Report

Attention: 29 lines in your changes are missing coverage. Please review.

Comparison is base (cf22b77) 40.19% compared to head (1146fe9) 40.18%.
Report is 7 commits behind head on feature/notifications_refresh_p1.

Files Patch % Lines
...ava/org/wordpress/android/models/NoteExtensions.kt 0.00% 19 Missing ⚠️
...c/main/java/org/wordpress/android/models/Note.java 0.00% 9 Missing ⚠️
...wordpress/android/datasets/NotificationsTable.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@                         Coverage Diff                          @@
##           feature/notifications_refresh_p1   #20172      +/-   ##
====================================================================
- Coverage                             40.19%   40.18%   -0.02%     
====================================================================
  Files                                  1468     1469       +1     
  Lines                                 67560    67579      +19     
  Branches                              11185    11187       +2     
====================================================================
  Hits                                  27157    27157              
- Misses                                37914    37933      +19     
  Partials                               2489     2489              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@antonis antonis left a comment

Choose a reason for hiding this comment

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

Thank you for refactoring this part of the code @mkevins 🙇
The code looks good and I haven't noticed any behavior changes in my tests 🎉

@antonis antonis merged commit 4786b5e into feature/notifications_refresh_p1 Feb 12, 2024
20 checks passed
@antonis antonis deleted the issue/20040-notifications-share-an-own-published-post--preliminary-refactor branch February 12, 2024 10:47
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.

5 participants