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

Reader site filter: show unseen post count #15581

Merged
merged 6 commits into from
Jan 5, 2021

Conversation

ScoutHarris
Copy link
Contributor

@ScoutHarris ScoutHarris commented Jan 5, 2021

Ref #15483

On the Reader's site filter, a unseen post count is now displayed for each site.

To test:

  • Go to the Reader.
  • On any feed that has a filter (Following, Automattic, P2s), tap Filter.
  • Verify:
    • For sites that have unseen posts, the count is displayed.
    • For sites that have no unseen posts, the count is not displayed.
    • The counts match those in the web Reader.
    • Numbers above 1000 are abbreviated with multipliers(K, M, B, etc.)

To verify large numbers are abbreviated, you can hack the displayed count. In FilterProvider:addUnseenPostCount, change the displayed value: countLabel.text = topic.unseenCount.abbreviatedString()

Example:

let count = 876875666978
countLabel.text = count.abbreviatedString()

unseen_count abbrevs
ipad_light ipad_dark

PR submission checklist:

  • I have considered adding unit tests where possible.
  • I have considered adding accessibility improvements for my changes.
  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

@ScoutHarris ScoutHarris added this to the 16.5 milestone Jan 5, 2021
@ScoutHarris ScoutHarris self-assigned this Jan 5, 2021
@peril-wordpress-mobile
Copy link

peril-wordpress-mobile bot commented Jan 5, 2021

You can trigger an installable build for these changes by visiting CircleCI here.

@peril-wordpress-mobile
Copy link

peril-wordpress-mobile bot commented Jan 5, 2021

You can trigger optional UI/connected tests for these changes by visiting CircleCI here.

@ScoutHarris ScoutHarris added the [Status] Needs Design Review A designer needs to sign off on the implemented design. label Jan 5, 2021
@ScoutHarris ScoutHarris marked this pull request as ready for review January 5, 2021 20:30
Copy link
Member

@mattmiklic mattmiklic left a comment

Choose a reason for hiding this comment

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

These are looking good. Thanks @ScoutHarris!

@mattmiklic mattmiklic removed the [Status] Needs Design Review A designer needs to sign off on the implemented design. label Jan 5, 2021
@ScoutHarris
Copy link
Contributor Author

ScoutHarris commented Jan 5, 2021

Hey @mattmiklic . Sorry for the ping, but I just noticed something. Is the multiplier for thousands supposed to be upper or lower case "K"? I made it lowercase to match Android, but I see now the designs have uppercase. Thank you!

Copy link
Member

@aerych aerych left a comment

Choose a reason for hiding this comment

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

Heya @ScoutHarris !
I tested and the changes look good.
I had one nitpick code wise. Apart from that and the question about k vs K this should be good to go. :)

@@ -43,7 +43,7 @@ extension Double {
static let units: [Unit] = {
var units: [Unit] = []

units.append(Unit(abbreviationFormat: NSLocalizedString("%@K", comment: "Label displaying value in thousands. Ex: 66.6K."), accessibilityLabelFormat: NSLocalizedString("%@ thousand", comment: "Accessibility label for value in thousands. Ex: 66.6 thousand.")))
units.append(Unit(abbreviationFormat: NSLocalizedString("%@k", comment: "Label displaying value in thousands. Ex: 66.6k."), accessibilityLabelFormat: NSLocalizedString("%@ thousand", comment: "Accessibility label for value in thousands. Ex: 66.6 thousand.")))
Copy link
Member

Choose a reason for hiding this comment

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

Was going to ask if we wanted the upper case K to match the other abbreviations, but I see you already asked :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I went ahead and reverted the change (i.e. make it uppercase again) since I think we all agree on it. If @mattmiklic rebels, I can change it later. 😄

Copy link
Member

Choose a reason for hiding this comment

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

No rebellion here, I agree with making this uppercase. :)

/// Adds a custom accessory view displaying the unseen post count.
///
private static func addUnseenPostCount(_ topic: ReaderSiteTopic, with cell: UITableViewCell) {

Copy link
Member

Choose a reason for hiding this comment

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

Wondering if it would be better to set the accessory view to nil here. Refs my comment in prepareForReuse.

@@ -43,6 +43,10 @@ class SiteTableViewCell: UITableViewCell, GhostableView {
fatalError("init(coder:) has not been implemented")
}

override func prepareForReuse() {
accessoryView = nil
Copy link
Member

Choose a reason for hiding this comment

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

I think we'd probably want to call super here. :)

However, I'm wondering if this would be better done elsewhere. Per the docs:

For performance reasons, you should only reset attributes of the cell that are not related to content, for example, alpha, editing, and selection state.

Changes that modify the view hierarchy seem like they would be content related.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think we'd probably want to call super here.

Every. Time. 🤦

I'm wondering if this would be better done elsewhere.

Thanks for that! Tis been moved.

@ScoutHarris
Copy link
Contributor Author

Thanks @aerych ! Ready for another pass please.

@ScoutHarris ScoutHarris requested a review from aerych January 5, 2021 22:12
Copy link
Member

@aerych aerych left a comment

Choose a reason for hiding this comment

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

Shiny! :shipit:

@ScoutHarris ScoutHarris merged commit e1f80fc into develop Jan 5, 2021
@ScoutHarris ScoutHarris deleted the 15483-show_unseen_count branch January 5, 2021 22:41
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.

3 participants