Skip to content

Conversation

@mindgraffiti
Copy link
Contributor

@mindgraffiti mindgraffiti commented Aug 21, 2018

Closes #138.

Follows WordPress-iOS Notifications implementation of grouping sections by fuzzy dates. Note that this is consistent with Android's UI.

simulator screen shot - iphone se - 2018-08-21 at 15 22 30

@mindgraffiti mindgraffiti added the type: enhancement A request for an enhancement. label Aug 21, 2018
@mindgraffiti mindgraffiti added this to the External open beta milestone Aug 21, 2018
@mindgraffiti mindgraffiti self-assigned this Aug 21, 2018
import Foundation

extension Date {
/// Returns a NSDate instance with only its Year / Month / Weekday / Day set. Removes the time!
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This Date extension comes from WordPressShared. I was not sure I should add the whole WordPressShared pod just for a single function, but I can if that is preferred.

Copy link
Contributor

@bummytime bummytime Aug 22, 2018

Choose a reason for hiding this comment

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

@mindgraffiti the WPShared pod is already included in our podfile. So, feel free to use that date helper directly. 😀

Copy link
Contributor

Choose a reason for hiding this comment

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

@mindgraffiti Would it be possible to:

  • delete this method
  • update the podfile to include the WordPressShared pod in the Storage framework (i.e. pod 'WordPressShared', '1.0.8')
  • then use the WordPressShared version in Order+CoreDataClass.swift

?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just now getting back to this. Thank you for the instructions! I haven't imported a pod to a subproject before.


// MARK: - Private Helpers
fileprivate enum Sections: String {
case Months = "0"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sections enum is duplicated from here into Order+Woo.swift. Making it public here did not make it accessible to Order+Woo. (Possibly because of ReadOnlyEntity?)

@mindgraffiti
Copy link
Contributor Author

@jleandroperez @bummytime this is ready for review. Thank you for introducing me to keyPaths Jorge 🥇

/// Returns a Section Identifier that can be sorted. Note that this string is not human readable, and
/// you should use the *descriptionForSectionIdentifier* method as well!.
///
@objc func sectionIdentifier() -> String {
Copy link
Contributor

Choose a reason for hiding this comment

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

@mindgraffiti since this method is required by a ViewController (App Side!), would it be possible to move this method to the main app? (extension StorageOrder).

Copy link
Contributor

@bummytime bummytime Aug 23, 2018

Choose a reason for hiding this comment

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

Same comment as what @jleandroperez said ☝️ 😄

@bummytime
Copy link
Contributor

@mindgraffiti just a general UI question — I noticed the sections' heights are larger in this PR vs. the i6 designs. Was this intentional?

napkin 90 08-23-18 10 07 16 am

Copy link
Contributor

@bummytime bummytime left a comment

Choose a reason for hiding this comment

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

Nice job on this @mindgraffiti — I loved seeing this finally implemented! 😄 I left a few questions for you and a separate UI comment. Let me know your thoughts.

import Foundation

extension Date {
/// Returns a NSDate instance with only its Year / Month / Weekday / Day set. Removes the time!
Copy link
Contributor

Choose a reason for hiding this comment

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

@mindgraffiti Would it be possible to:

  • delete this method
  • update the podfile to include the WordPressShared pod in the Storage framework (i.e. pod 'WordPressShared', '1.0.8')
  • then use the WordPressShared version in Order+CoreDataClass.swift

?

///
@objc func sectionIdentifier() -> String {
// Normalize Dates: Time must not be considered. Just the raw dates
let fromDate = dateCreated?.normalizedDate()
Copy link
Contributor

Choose a reason for hiding this comment

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

See my comment above about using the WordPressShared version ☝️ . Let me know your thoughts.

/// Returns a Section Identifier that can be sorted. Note that this string is not human readable, and
/// you should use the *descriptionForSectionIdentifier* method as well!.
///
@objc func sectionIdentifier() -> String {
Copy link
Contributor

@bummytime bummytime Aug 23, 2018

Choose a reason for hiding this comment

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

Same comment as what @jleandroperez said ☝️ 😄

@mindgraffiti
Copy link
Contributor Author

@bummytime yeah, the Orders List is following a non-standard section header height in the i6 design, iirc. And I think the code that set up the section height was erased at some point. I'll open a separate PR to investigate what happened there.

@mindgraffiti mindgraffiti merged commit a49ce10 into develop Aug 23, 2018
@mindgraffiti mindgraffiti deleted the feature/138-section-dates branch August 23, 2018 18:15
@bummytime
Copy link
Contributor

:shipit: given in Slack, I didn't mark it here...my bad. Thanks for working hard on this PR @mindgraffiti :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: enhancement A request for an enhancement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants