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

The inline action of Like Comment #20187

Merged

Conversation

jarvislin
Copy link
Contributor

@jarvislin jarvislin commented Feb 15, 2024

Part of #20024

This is the feature for liking a comment from the inline action.
This PR contains:

  1. The implementation of the Like Comment inline action.
  2. Refactor the codebase.

To Test:

  1. Open the Jetpack app and switch to the notifications tab.
  2. Scroll the top tab to COMMENTS and click it.
  3. Click on the star icon in the notification item.
  4. The Like status should be updated.
  5. Done, thank you!
Light Dark RTL
截圖 2024-02-15 下午2 39 16 截圖 2024-02-15 下午2 39 25 截圖 2024-02-15 下午3 04 42

Regression Notes

  1. Potential unintended areas of impact

    • Notification tab
  2. What I did to test those areas of impact (or what existing automated tests I relied on)

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

    • None, sadly we still haven't made our code testable yet.

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)

Jarvis Lin added 11 commits January 31, 2024 18:15
…-inline-action

# Conflicts:
#	WordPress/src/main/java/org/wordpress/android/ui/notifications/adapters/NotesAdapter.java
…-inline-action

# Conflicts:
#	WordPress/src/main/java/org/wordpress/android/ui/notifications/adapters/NotesAdapter.kt
…-inline-action

# Conflicts:
#	WordPress/src/main/java/org/wordpress/android/ui/notifications/adapters/NotesAdapter.kt
#	WordPress/src/main/res/layout/notifications_list_item.xml
@wpmobilebot
Copy link
Contributor

wpmobilebot commented Feb 15, 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
Versionpr20187-2b40d4c
Commit2b40d4c
Direct Downloadjetpack-prototype-build-pr20187-2b40d4c.apk
Note: Google Login is not supported on these builds.

@wpmobilebot
Copy link
Contributor

wpmobilebot commented Feb 15, 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
Versionpr20187-2b40d4c
Commit2b40d4c
Direct Downloadwordpress-prototype-build-pr20187-2b40d4c.apk
Note: Google Login is not supported on these builds.

Copy link

codecov bot commented Feb 15, 2024

Codecov Report

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

Comparison is base (a9a0972) 40.15% compared to head (2b40d4c) 40.14%.

Files Patch % Lines
.../ui/notifications/NotificationsListFragmentPage.kt 0.00% 20 Missing ⚠️
...oid/ui/notifications/NotificationsListViewModel.kt 0.00% 18 Missing ⚠️
...c/main/java/org/wordpress/android/models/Note.java 0.00% 6 Missing ⚠️
...ava/org/wordpress/android/models/NoteExtensions.kt 0.00% 1 Missing ⚠️
Additional details and impacted files
@@                         Coverage Diff                          @@
##           feature/notifications_refresh_p1   #20187      +/-   ##
====================================================================
- Coverage                             40.15%   40.14%   -0.01%     
====================================================================
  Files                                  1469     1469              
  Lines                                 67683    67697      +14     
  Branches                              11211    11210       -1     
====================================================================
  Hits                                  27179    27179              
- Misses                                38010    38024      +14     
  Partials                               2494     2494              

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

@jarvislin jarvislin requested review from mkevins and antonis February 15, 2024 07:02
@jarvislin jarvislin self-assigned this Feb 15, 2024
@jarvislin jarvislin marked this pull request as ready for review February 15, 2024 07:05
@dangermattic
Copy link
Collaborator

1 Warning
⚠️ PR is not assigned to a milestone.

Generated by 🚫 Danger

@jarvislin
Copy link
Contributor Author

Thank you, @antonis Nice catch! I found that not only the gray color, but also the green color are different in light/dark mode.
I think it'd better if we can tint the color by icon types.

@@ -27,30 +30,26 @@ import javax.inject.Named
class NotificationsListViewModel @Inject constructor(
@Named(UI_THREAD) mainDispatcher: CoroutineDispatcher,
Copy link
Contributor

Choose a reason for hiding this comment

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

We could add a background dispatcher and use it in the "like coroutine" to avoid blocking the UI when updating the like status.
@Named(BG_THREAD) val bgDispatcher: CoroutineDispatcher

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm gonna replace @Named(UI_THREAD) mainDispatcher: CoroutineDispatcher with @Named(BG_THREAD) val bgDispatcher: CoroutineDispatcher to see if the blocking issue in main thread can be resolved.

But I guess the root cause is not the about the dispatcher, it should throw NetworkOnMainThreadException if I run on the wrong thread.

I noticed that UI refreshes many times because of the event bus, I'd like to remove redundant events after #20024 is done.

Copy link
Contributor

Choose a reason for hiding this comment

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

Makes sense @jarvislin 👍

I noticed that UI refreshes many times because of the event bus, I'd like to remove redundant events after #20024 is done.

Sounds good. We can merge this PR and tackle this later.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmmm the main thread is blocking even I don't click on the action icon. So there should be a different root cause.

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.

Great work @jarvislin 👍
I've tested the implementation on a Pixel 5/Android 14 and it worked as described in most cases for me. The code also looks good.
I've added a few comments inline with suggestions.

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 the changes @jarvislin 🙇
All look good to me 🎉
We can iterate on the UI update issue later #20187 (comment)

@antonis antonis merged commit 6c0ef89 into feature/notifications_refresh_p1 Feb 15, 2024
19 checks passed
@antonis antonis deleted the issue/20024-like-inline-action branch February 15, 2024 13:33
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