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

Update card design and do not display author name when "Me" is selected #11705

Merged
merged 63 commits into from May 28, 2019
Merged

Update card design and do not display author name when "Me" is selected #11705

merged 63 commits into from May 28, 2019

Conversation

leandroalonso
Copy link
Contributor

Ref #11646

In this PR:

  • The post card was redesigned;
  • The author is not displayed when "Me" is selected as a filter;
  • Fixed a bug that was displaying a large empty area at the top of the posts lists

To test:

Use the blueprint in the master issue as a starting point. These are some user-scenarios that can be tested:

  • Check how Published, Drafted, Scheduled and Trashed posts look
  • Make sure that when selecting "Me" your name is not displayed
  • Trash some posts, then Undo
  • Edit posts and check that they update
  • Test in larger devices (ie.: iPad) as well with increased font sizes
  • Upload media and check that the progress bar is correctly displayed
  • Remove your internet connection, change a post and make sure that a "Retry" button is displayed

Here are some screenshots:

post_list_redesign

Update release notes:

  • If there are user facing changes, I have added an item to RELEASE-NOTES.txt.

@peril-wordpress-mobile
Copy link

peril-wordpress-mobile bot commented May 15, 2019

Warnings
⚠️ PR is not assigned to a milestone.
⚠️ PR has more than 500 lines of code changing. Consider splitting into smaller PRs if possible.

Generated by 🚫 dangerJS

@nheagy nheagy added [Status] Needs Design Review A designer needs to sign off on the implemented design. Posts List labels May 15, 2019
@SylvesterWilmott
Copy link

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.

@SylvesterWilmott
Copy link

Thanks for the changes @leandroalonso

Looks great!

@SylvesterWilmott SylvesterWilmott removed the [Status] Needs Design Review A designer needs to sign off on the implemented design. label May 20, 2019
Copy link
Contributor

@nheagy nheagy left a 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:
image

Also, after changing text size the text does update, but images disappear:

text size change image problem

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) {
Copy link
Contributor

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?

Copy link
Contributor Author

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
Copy link
Contributor

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.

Copy link
Contributor Author

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]) {
Copy link
Contributor

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?

Copy link
Contributor Author

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.

@@ -4,9 +4,10 @@ import Gridicons
/// Encapsulates status display logic for PostCardTableViewCells.
///
class PostCardStatusViewModel: NSObject {
private let separator = "·"
Copy link
Contributor

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

Copy link
Contributor Author

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;
Copy link
Contributor

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?

Copy link
Contributor Author

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 {
Copy link
Contributor

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
Copy link
Contributor

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)

Copy link
Contributor Author

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!
Copy link
Contributor

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?

Copy link
Contributor Author

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 ??

Copy link
Contributor

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 😆

Copy link
Contributor Author

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? {
Copy link
Contributor

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@nheagy nheagy force-pushed the issues/11646-post-list-revamp branch from bfef387 to 4d6ada6 Compare May 23, 2019 21:05
Copy link
Contributor

@nheagy nheagy left a 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 {
Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor

@nheagy nheagy left a comment

Choose a reason for hiding this comment

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

Nice! 🎉

:shipit:

@nheagy nheagy merged commit bdac32d into wordpress-mobile:issues/11646-post-list-revamp May 28, 2019
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.

None yet

4 participants