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

Fix for #378 - emptyView not updated when items added #395

Closed

Conversation

edmonston
Copy link
Contributor

Changes in this pull request

Modified IGListAdapter to update the hidden status of the emptyView after any item-level changes (insertInSectionController:atIndexes: and related methods) based on whether the item count is zero.

Closes #378

Pull request checklist

  • All tests pass. Demo project builds and runs.
  • I added tests, an experiment, or detailed why my change isn't tested.
  • I added an entry to the CHANGELOG.md for any breaking changes, enhancements, or bug fixes.
  • I have reviewed the contributing guide

@coveralls
Copy link

coveralls commented Jan 8, 2017

Coverage Status

Coverage increased (+0.09%) to 98.065% when pulling 4edf558 on edmonston:378-emptyview-not-updated into c19379e on Instagram:master.

@@ -2,6 +2,12 @@

The changelog for `IGListKit`. Also see the [releases](https://github.com/instagram/IGListKit/releases) on GitHub.

### Enhancements
Copy link
Contributor

Choose a reason for hiding this comment

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

Just for the sake of completion we should add a header for 2.2.0 with a link to the milestone

Also can you add a link to this pull request at the end of your contribution, following the same format as other changelog entries

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure thing, CHANGELOG.md updated.

@facebook-github-bot
Copy link
Contributor

@edmonston updated the pull request - view changes

@facebook-github-bot
Copy link
Contributor

@edmonston updated the pull request - view changes

@coveralls
Copy link

coveralls commented Jan 8, 2017

Coverage Status

Coverage increased (+0.09%) to 98.065% when pulling 0d535ae on edmonston:378-emptyview-not-updated into c19379e on Instagram:master.

@coveralls
Copy link

coveralls commented Jan 8, 2017

Coverage Status

Coverage increased (+0.09%) to 98.065% when pulling 0d535ae on edmonston:378-emptyview-not-updated into c19379e on Instagram:master.

@jessesquires jessesquires added this to the 2.2.0 milestone Jan 8, 2017

- (BOOL)itemCountIsZero {
__block BOOL isZero = YES;
[self.sectionMap enumerateUsingBlock:^(id _Nonnull object, IGListSectionController<IGListSectionType> * _Nonnull sectionController, NSInteger section, BOOL * _Nonnull stop) {
Copy link
Contributor

Choose a reason for hiding this comment

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

minor nit: could we specify an explicit type for id __Nonnull object ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hmm, can we? it seems like id is the best we can do based on the signature of [IGListSectionMap enumerateUsingBlock:], but quite possibly I am missing something...

- (void)enumerateUsingBlock:(void (^)(id object, IGListSectionController<IGListSectionType> *sectionController, NSInteger section, BOOL *stop))block;

https://github.com/Instagram/IGListKit/blob/master/Source/Internal/IGListSectionMap.h#L103

Copy link
Contributor

Choose a reason for hiding this comment

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

oops! 😳 nevermind. 😄

@jessesquires
Copy link
Contributor

Looks good to me. Thanks @edmonston ! 💯

@facebook-github-bot
Copy link
Contributor

@jessesquires has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@jessesquires jessesquires modified the milestones: 2.2.0, 3.0.0 Feb 23, 2017
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.

emptyView Not Updated In Response to Item Updates
5 participants