-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
[Notifications] Add Like Post and Comment Inline Actions #22688
[Notifications] Add Like Post and Comment Inline Actions #22688
Conversation
|
App Name | ![]() |
|
Configuration | Release-Alpha | |
Build Number | pr22688-55200cd | |
Version | 24.3 | |
Bundle ID | org.wordpress.alpha | |
Commit | 55200cd | |
App Center Build | WPiOS - One-Offs #8981 |
|
App Name | ![]() |
|
Configuration | Release-Alpha | |
Build Number | pr22688-55200cd | |
Version | 24.3 | |
Bundle ID | com.jetpack.alpha | |
Commit | 55200cd | |
App Center Build | jetpack-installable-builds #8011 |
…e-comment-inline-action # Conflicts: # WordPress/Classes/ViewRelated/Notifications/Controllers/NotificationsViewController/NotificationsViewModel.swift
// MARK: - Init | ||
|
||
init?(note: Notification) { | ||
guard let postID = note.metaPostID?.uintValue, let siteID = note.metaSiteID?.uintValue else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
postID
and siteID
seem to be required arguments for this struct. Maybe we can add the otherwise synthesized init too so this one acts more like a convenience nullable init?
That way the call-site can unwrap them before if needed. Right now it may be slightly implicit when init is called with a Notification but returned value is nil.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you provide an example?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So when this init return nil URL(string:)
, it is obvious to why that would be the case. But for this one, Notification
being a very large and complicated entity, it would be very implicit why the init fails.
My point is, the caller would have to read the implementation of the init to find out why init returns nil.
I think the proper way of addressing this would be passing exactly what the struct needs rather than passing the whole Notification
. So instead of doing note.body(ofType
, the struct can accept a closure that returns [String: Any]?
and an updateClosure
.
WordPress/Classes/Models/Notifications/Types/NewPostNotification.swift
Outdated
Show resolved
Hide resolved
func toggleLikeForPostNotification(like: Bool, | ||
postID: UInt, | ||
siteID: UInt, | ||
completion: @escaping (Result<Bool, Swift.Error>) -> Void) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: I think if we select these lines & CTRL + M, it would style the syntax differently.
Generated by 🚫 Danger |
...ess/Classes/ViewRelated/Views/List/NotificationsList/NotificationsTableViewCellContent.swift
Show resolved
Hide resolved
🐛 When the like status is changed from the details screen bottom bar, it doesn't reflect on the row after going back. This is still the case after a pull-to-refresh action. |
…post-inline-action # Conflicts: # WordPress/Classes/ViewRelated/Notifications/Controllers/NotificationsViewController/NotificationsViewController.swift # WordPress/Classes/ViewRelated/Views/List/NotificationsList/NotificationsTableViewCellContent.swift # WordPress/WordPress.xcodeproj/project.pbxproj
…ve non-nullable init" This reverts commit f999a4a.
Fixes #22466
Description
This PR adds the Post Like inline action.
Challenges
Row Fade Animation
When toggling the post liked status, the notification row reloads with a fade animation. The reason behind this is because the notifications screen is using the
WPTableViewHandler
object, which observes Core Data changes. So when the notification object is updated locally, theWPTableViewHandler
catches this update and reloads the associated row. I couldn't figure out an easy way to disable this behavior.I have tried setting
tableViewHandler.updateRowAnimation = .none
but it didn't work.Change Propagation
When a post's liked status is toggled anywhere on the app, this change isn't broadcasted to the Notifications screen. Here is how to reproduce this issue:
Ideally, when a post is liked on one screen, the same post should appear liked on all other loaded screens. I tested on Android and I was able to reproduce this issue.
Test Instructions
Posts
Comments
Regression Notes
Potential unintended areas of impact
Smoke test post like feature in other parts of the app ( e.g Reader )
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)
N/A
PR submission checklist:
RELEASE-NOTES.txt
if necessary.