Skip to content

Conversation

@bummytime
Copy link
Contributor

@bummytime bummytime commented Sep 14, 2018

This PR wraps up the work on Top Performers. It mainly contains UI additions:

top_performers2

Just like NewOrdersViewController, the top performers table uses a ResultsController instance not attached to a tableview. Updates should be reflects as soon as new data is inserted into Storage.

Other Misc things:

  • In Array+Helpers.swift added a helper func to safely grab a value from a Collection regardless of bounds
  • In AppDelegate.swift, updated the UITableViewHeaderFooterView text color via appearance proxy (the Orders List screen had the wrong color for section headers)
  • In UIImage+Woo.swift, added a GridIcon that i used for a product image placeholder if a valid URL is not available
  • Made buildDateString() a static func on StatsStore
  • Remote product images are brought to you by UIImageView+Networking in WordPressUI 🎉

Also note that I addressed the "stale data after logout" issue (#300) in this PR. Both New Orders and Top performers should correctly reset after the user logs out. The revenue chart data does NOT reset correctly after a log out, however this will be addressed when #258 is completed.

Fixes: #178
Fixes #300

Testing

Preconditions: Start with a fresh install of the app. Log into a your store of choice (ideally one with recent-ish orders).

Give the UI a good test drive here. Things to consider:

  • Portrait and landscape orientations
  • Multiple device sizes
  • UI updates (Pull to refresh) after adding/updating/deleting orders from the store you are logged into
  • Logout of one store and sign into another — does everything work like you expect?

@jleandroperez and @mindgraffiti would you mind taking this for a spin? Thanks!

… feature/178-top-performers-mark3

* 'develop' of github.com:woocommerce/woocommerce-ios:
  Increasing version to Mark 0.7
  Clear barChart data after period VC disappears
… feature/178-top-performers-mark3

* 'develop' of github.com:woocommerce/woocommerce-ios: (25 commits)
  SyncingCoordinator: Adding Documentation Note!
  OrdersViewController: Updating pageSize
  SyncCoordinator: Fixing faulty logic
  OrdersViewController: Decreasing the pageSize
  OrdersViewController: Restores pageSize
  Revert to this commit to test PR 295
  Implements SyncingCoordinator Unit Tests
  OrdersViewController: New FSM State
  NewOrdersViewController: Updates constants
  SyncCoordinator: Renames Public API
  SyncCoordinator: Fixing condition
  OrdersViewController: SyncingCoordinatorDelegate Conformance
  SyncCoordinator: Documenting API
  NewOrdersViewController: Wiring updated synchronizeOrders Action
  OrderAction: Page > PageNumber
  OrderAction: Renames parameters
  OrdersViewController: Wiring  Sync Coordinator
  Implements SyncingCoordinator
  NewOrdersViewController: Wiring new Sync API
  OrderAction: Synchronize Orders now expects pageSize and pageNumber
  ...
… feature/178-top-performers-mark3

* 'develop' of github.com:woocommerce/woocommerce-ios:
  OrdersViewController: Reverts Testing Code
  Revert to this commit to test Error State
  Revert to this commit to test Empty Unfiltered State
  OrdersViewController: Notice as Error Handler
  OrdersViewController: Nukes FSM Error State
@wpmobilebot
Copy link
Collaborator

1 Warning
⚠️ PR has more than 500 lines of code changing. Consider splitting into smaller PRs if possible.

Generated by 🚫 Danger

Copy link
Contributor

@jleandroperez jleandroperez left a comment

Choose a reason for hiding this comment

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

@bummytime code looks great!! few issues i've hit:

Issue A: Suck in No Activity

  1. Log into a WC Store
  2. Open the Dashboard
  3. Top Performers display No Activity
  4. Buy an item (on the web)
  5. Pull to refresh

As a result, i'm stuck in the No Activity state.

I'm triggering this in (my) Store. Julia's works just fine... am i missing something? is there a minimum sale threshold?

Issue B: Logout > Not Sync'ing

  1. Log into Account A
  2. Logout
  3. Log into Account B

I'm still having the "Dashboard not syncing" (after an account switch).

Issue C: Pull to Refresh Flicker

  1. Open the Dashboard
  2. Pull to Refresh

As a result, the spinner is hidden immediately (zero delay). Feels a bit off, maybe we could do something like what we have in OrderDetailsViewController? (dispatch group + multiple sync OPs)

Issue D: Empty State Bottom Padding

This is not an issue, actually, a detail that we need to spin over!.

Whenever (everything) is in the Empty State, the bottom padding between the placeholder asset and the edge of the screen is huuuge. Maybe we could:

A. Reduce the bottom padding?
B. Add top padding so that it's... balanced?

Still, any alternative i could come up falls short: whenever any of the tabs happens not to be empty... well, the assymetry will be even worse right?.


Please let me know if i did something wrong, the first issue (empty state in my blog) feels like there is something i'm not doing?

Thanks Matt, looks amazing!!!

if let productURLString = statsItem?.imageUrl {
productImage.downloadImage(from: URL(string: productURLString), placeholderImage: UIImage.productPlaceholderImage)
} else {
productImage.image = UIImage.productPlaceholderImage
Copy link
Contributor

Choose a reason for hiding this comment

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

(No need to change anything, just passing along an awesome trick!!) You can just do as follows, because the UIImage is inferred from the context:

productImage.image = .productPlaceholderImage

@bummytime
Copy link
Contributor Author

Thanks for the thorough review @jleandroperez!

Issue A: Suck in No Activity

We chatted offline about this and "fixed the glitch" on the site itself ;-)

Issue B: Logout > Not Sync'ing

Yeah, this is a known issue and will get fixed in #260 (before open beta!)

Issue C: Pull to Refresh Flicker

Good catch, I will see if I can address this here without a ton of code. If not I may open another issue.

Issue D: Empty State Bottom Padding

Yeah, I am not satisfied with the current state of this either. I will update it in this PR!

Copy link
Contributor

@mindgraffiti mindgraffiti left a comment

Choose a reason for hiding this comment

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

Looking good!

Minor edits needed for some code comments. Needs a little polish to the line height on the Top Performers name label. I know, I know, autolayout :shakesfistatsky: :)


extension Collection {

/// Returns the element at the specified index iff it is within bounds, otherwise nil.
Copy link
Contributor

Choose a reason for hiding this comment

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

extra f in if

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@mindgraffiti That is the old programmer in me — I meant to do that (meaning: "if and only if..." ). I'll remove it for clarity. 😉

Copy link
Contributor

Choose a reason for hiding this comment

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

TIL there is notation for "if and only if". please keep that!

return Locale(identifier: identifier).currencySymbol ?? currency
}

/// Returns the a friendly-formatted total string including the currency symbol
Copy link
Contributor

Choose a reason for hiding this comment

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

delete "the"

/// Returns the a friendly-formatted total string including the currency symbol
///
var formattedTotalString: String {
return currencySymbol + total.friendlyString()
Copy link
Contributor

Choose a reason for hiding this comment

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

Once I'm done with the MoneyFormatter struct, we'll have new toys to use!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yay!

@@ -0,0 +1,77 @@
<?xml version="1.0" encoding="UTF-8"?>
Copy link
Contributor

Choose a reason for hiding this comment

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

Not certain what's going on here, but the nameLabel has too much height / padding / line height. I tried switching the label to multiline, checking for height constraints, and checking the stackview (but none of that is fixing the issue).

UINavigationBar.appearance().isTranslucent = false
UINavigationBar.appearance().tintColor = .white
UIApplication.shared.statusBarStyle = .lightContent
UILabel.appearance(whenContainedInInstancesOf: [UITableViewHeaderFooterView.self]).textColor = StyleManager.sectionTitleColor
Copy link
Contributor

Choose a reason for hiding this comment

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

+1


class IntrinsicTableView: UITableView {

override var contentSize:CGSize {
Copy link
Collaborator

Choose a reason for hiding this comment

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

⚠️ Colons should be next to the identifier when specifying a type and next to the key in dictionary literals.

Copy link
Contributor

@jleandroperez jleandroperez left a comment

Choose a reason for hiding this comment

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

Looking great!!! discussed over slack, we're addressing the pendings in smaller issues, we need to move this puppy!!

Thanks Bummy!!!

:shipit:

@bummytime bummytime merged commit bc42e5b into develop Sep 17, 2018
@bummytime bummytime deleted the feature/178-top-performers-mark3 branch September 17, 2018 20:46
@bummytime
Copy link
Contributor Author

Thanks @jleandroperez — issues are logged!

@jleandroperez
Copy link
Contributor

Thanks for doing that sir!!! 🙇

@designsimply designsimply added feature: stats Related to stats, including Top Performers. and removed [Feat] Dashboard labels May 6, 2021
@peril-woocommerce
Copy link

peril-woocommerce bot commented May 6, 2021

Warnings
⚠️ PR has more than 500 lines of code changing. Consider splitting into smaller PRs if possible.

Generated by 🚫 dangerJS

@AliSoftware AliSoftware added feature: stats Related to stats, including Top Performers. and removed feature: stats Related to stats, including Top Performers. labels May 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature: stats Related to stats, including Top Performers.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dashboard: New orders UI reflects incorrect values after logout→login Dashboard: Top Performers

7 participants