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
Update card design and do not display author name when "Me" is selected #11705
Update card design and do not display author name when "Me" is selected #11705
Conversation
Generated by 🚫 dangerJS |
Looks really good @leandroalonso thanks! Can we modify the height of the card images for iPad? If you check in the current reader, we should re-use the height of the images there for iPad. |
Thanks for the changes @leandroalonso Looks great! |
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 is looking really good. Replacing the post cell(s) is a fairly big undertaking, so I appreciate the courage :D
Besides what I've mentioned in the code, there are a few issues in RtL languages:
Also, after changing text size the text does update, but images disappear:
And feel free to let me know when you think my comments are entirely wrong 😆
import Foundation | ||
|
||
extension UIView { | ||
func setLayoutMargin(top: CGFloat? = nil, left: CGFloat? = nil, bottom: CGFloat? = nil, right: CGFloat? = 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.
setLayoutMargin
should be plural, but setLayoutMargins
already exists. Want to take another pass at this method name?
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.
Changed to changeLayoutMargins
.
@@ -0,0 +1,12 @@ | |||
import Foundation |
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.
Our naming scheme for extension files is to capitalize the name after the +
, such as UIView+LayoutMargins.swift
. However, I feel like UIView+Helpers.swift
in WordPressUI
is a better fit for this than adding a new file to the WPiOS project.
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.
NSString *lastModified = NSLocalizedString(@"last-modified",@"A label for a post's last-modified date."); | ||
return [NSString stringWithFormat:@"%@ (%@)", shortDate, lastModified]; | ||
} else if ([self isScheduled]) { | ||
if ([self isScheduled]) { |
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 looks to be removing the last modified date from drafts and pending. Is that intentional?
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.
My bad. The idea was to remove the last-modified
string, not the entire date. Fixed.
WordPress/Classes/ViewRelated/Post/AbstractPostListViewController.swift
Outdated
Show resolved
Hide resolved
@@ -4,9 +4,10 @@ import Gridicons | |||
/// Encapsulates status display logic for PostCardTableViewCells. | |||
/// | |||
class PostCardStatusViewModel: NSObject { | |||
private let separator = "·" |
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.
We put constants like this in a Constants
enum. You'll find examples if you search the codebase for private enum Constants
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.
Done.
@@ -41,7 +41,7 @@ - (void)applyStyles | |||
[WPStyleGuide applyRestorePostButtonStyle:self.restoreButton]; | |||
|
|||
self.postContentView.layer.borderColor = [[WPStyleGuide postCardBorderColor] CGColor]; | |||
self.postContentView.layer.borderWidth = 1.0; | |||
self.postContentView.layer.borderWidth = 0.5; |
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.
Do we want 0.5 or do we want 1px in the devices display resolution?
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.
Good catch. Refactored to ensure 1px in devices display resolution. Also changed in PostCell
.
|
||
@testable import WordPress | ||
|
||
class PostCellTests: XCTestCase { |
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.
Loving the tests.
@IBOutlet weak var titleAndSnippetView: UIStackView! | ||
@IBOutlet weak var topMargin: NSLayoutConstraint! | ||
|
||
private let margin: CGFloat = WPDeviceIdentification.isiPad() ? 20 : 16 |
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.
Let's put all these constants in a constants enum (or two)
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.
Done.
return ImageLoader(imageView: featuredImage, gifStrategy: .mediumGIFs) | ||
}() | ||
|
||
private var post: Post! |
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 we do this without the !
s?
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.
By making it Optional
we will need to add boilerplate guard
in 9 different places. Also, all the methods that use post
are called only after a post is assigned.
What do you think? Keep the !
or change it to ?
?
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.
I'm solidly in the ?
camp. This is something our team has debates both sides for—sadly you're caught on my side at the moment 😆
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.
Done!
setNeedsDisplay() | ||
} | ||
|
||
override func hitTest(_ point: CGPoint, with event: UIEvent?) -> 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.
Can you explain the need for a hitTest
?
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.
Done.
bfef387
to
4d6ada6
Compare
This reverts commit d0629e065da26c94f670ea1baa3fbfad3d730dde.
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.
I feel like this is in a really good spot!
I have one request regarding the separator 😆
@@ -140,6 +140,12 @@ class PostCardStatusViewModel: NSObject { | |||
} | |||
} | |||
|
|||
func author(separatorDirection direction: UIUserInterfaceLayoutDirection) -> String { |
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 separator logic feels overdone. Could we find a simpler way to make this look right? What about checking the mockups again and seeing if there's a better place to add the separator than in the ViewModel for the author label's text?
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.
Done. I've extracted the separator itself to the view controller.
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.
Nice! 🎉
Ref #11646
In this PR:
To test:
Use the blueprint in the master issue as a starting point. These are some user-scenarios that can be tested:
Here are some screenshots:
Update release notes:
RELEASE-NOTES.txt
.