-
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 Refresh] Comment Content Redesign #23147
[Notifications Refresh] Comment Content Redesign #23147
Conversation
888486a
to
6f15c2b
Compare
|
App Name | ![]() |
|
Configuration | Release-Alpha | |
Build Number | pr23147-3d77d0a | |
Version | 24.8 | |
Bundle ID | org.wordpress.alpha | |
Commit | 3d77d0a | |
App Center Build | WPiOS - One-Offs #9826 |
|
App Name | ![]() |
|
Configuration | Release-Alpha | |
Build Number | pr23147-3d77d0a | |
Version | 24.8 | |
Bundle ID | com.jetpack.alpha | |
Commit | 3d77d0a | |
App Center Build | jetpack-installable-builds #8874 |
@@ -0,0 +1,82 @@ | |||
import UIKit | |||
|
|||
final class CommentDetailContentView: UIView { |
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.
As I've mentioned in the PR description, most of the logic was extracted from CommentContentTableViewCell
, except:
- The cell was using a
NSLayoutConstraint
to constraint the height, I'm usingintrinsicContentSize
instead. - The cell was providing 2 methods to render comments (
web
,richContent
). I've extracted only theweb
rendering method because it was the one used inComment Detail
screen. - Added a
Configuration
type to encapsulate configuration properties.
case .rendered(let height): return height | ||
} | ||
} | ||
} |
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.
This State
enum is not very useful right now, but I was thinking of showing an activity indicator because the comment rendering is async.
) | ||
button.accessibilityLabel = NSLocalizedString("Share comment", comment: "Accessibility label for button to share a comment from a notification") | ||
return button | ||
}() |
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.
Edit and share bar buttons were removed from the navigation bar, because now they're buttons in the comment's menu.
case .share: | ||
shareCommentURL() | ||
case .changeStatus(let status): | ||
print("Option \(status) tapped") |
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.
Handling status changes will be addressed in a separate PR as it depends on this issue.
let contentConfig = CommentDetailContentTableViewCell.ContentConfiguration(comment: comment) { [weak self] _ in | ||
UIView.performWithoutAnimation { | ||
self?.tableView.performBatchUpdates({}) | ||
} |
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.
When rendering the comment, we use the performBatchUpdates
method to relayout the cells and update their heights. This approach was part of the previous implementation. What I've added is the wrapping of this method inside UIView.performWithoutAnimation
, ensuring that the cells' relayout occurs without any animation. In my opinion, the default animation appeared clunky.
@@ -729,7 +698,7 @@ private extension CommentDetailViewController { | |||
present(activityViewController, animated: true, completion: nil) | |||
} | |||
|
|||
func presentUserInfoSheet(_ senderView: UIView) { | |||
func presentUserInfoSheet() { |
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.
The senderView: UIView
param was not used, so I removed it.
6a74476
to
95870d0
Compare
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.
Tested the changes and everything works well. My only concern is a really little padding between a header and content. It looks really tight. Maybe it's worth double check with Chris and perhaps restore the previous value?
func configure(with headerConfig: HeaderConfiguration, contentConfig: ContentConfiguration, parent: UIViewController) { | ||
self.updateHeader(with: headerConfig, parent: parent) | ||
self.commentView.configure(with: contentConfig) | ||
} |
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.
Just to double-check: what is the purpose of this initializer? It is not used and I'm not sure if we have a case for this.
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.
This acts as the primary configure
method, while the other one is merely a convenience method. The convenience configure method is supposed to call this one, but I just realized that it's not the case. Resolved in 3d77d0a
Generated by 🚫 Danger |
cac14dc
into
feature/notifications_refresh_p2
Fixes https://github.com/Automattic/wordpress-mobile/issues/31 and part of https://github.com/Automattic/wordpress-mobile/issues/38
Dependencies
This PR depends on:
Description
This PR introduces a new component for the comment table view cell, while the previous cell,
CommentContentTableViewCell
, continues to be used in the Reader Comments screen. I decided against refactoring the original for a couple of reasons:The new class
CommentDetailContentTableViewCell
is comprised of 2 components:CommentContentHeaderView
: This component was implemented in this PR.CommentDetailContentView
: I've extracted the comment rendering logic fromCommentContentTableViewCell
into this component.Test Instructions
Comment Moderation Allowed
Comment Moderation Not Allowed
Regression Notes
Potential unintended areas of impact
Smoke test the "Comment Detail" screen when accessed from "My Site > Comments".
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.Testing checklist: