Commit graph

22 commits

Author SHA1 Message Date
Ryan Nystrom
623ff2a8a8 Container size doesnt use content inset, add new APIs
Summary:
The content inset of a collection view can change at any time (as it does with our refresh control) and isn't a good measure of the container size. I don't want to totally remove that API though, so I changed the default behavior, added an insets API, and also added the functionality of the original in a new API.

This makes sizes much more deterministic.

Reviewed By: jessesquires

Differential Revision: D4800758

fbshipit-source-id: 85ce843b5b1c297cea2e2ea705fa255617cbe356
2017-03-30 09:35:03 -07:00
Ryan Nystrom
a15ea08614 Move section controller mutation API to object provided in update block
Summary:
We constantly have random bugs pop up when mutations are made outside of a batch update. This change restricts the mutation API to a batch context object (which is just an `IGListAdapter`) so they can only be done **inside an update block**.

- Fixed open source project
- Confirmed open source examples build
- Updated all of Instagram.app to use this API
- Changelog breaking changes entry

Fixes #392

Reviewed By: jessesquires

Differential Revision: D4754129

fbshipit-source-id: 11d32a0fac3e50c9edbb01e92a8a0c7b8a43cf2d
2017-03-22 12:46:49 -07:00
Bofei Zhu
f7702fa713 Container Inset Size For Section Controller
Summary:
Add API for #315. Not sure if this is what you want rnystrom though 🤔. Will add tests after you confirm.

- [x] All tests pass. Demo project builds and runs.
- [x] 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.
- [x] I have reviewed the [contributing guide](https://github.com/Instagram/IGListKit/blob/master/.github/CONTRIBUTING.md)
Closes https://github.com/Instagram/IGListKit/pull/456

Reviewed By: jessesquires

Differential Revision: D4697190

Pulled By: rnystrom

fbshipit-source-id: f8513cf2fa33441eb40f486954136553d19dda0c
2017-03-15 09:25:40 -07:00
Alex Mathers
2a0b4c990a Add IGListCollectionContext API to get visible indexes.
Summary:
Add IGListCollectionContext API to get visible indexes:
`- (NSArray<NSIndexPath *> *)visiblePathsForSectionController:(IGListSectionController<IGListSectionType> *) sectionController`

Issue fixed: #465

- [x] All tests pass. Demo project builds and runs.
- [x] I added tests, an experiment, or detailed why my change isn't tested.
- [x] I added an entry to the `CHANGELOG.md` for any breaking changes, enhancements, or bug fixes.
- [x] I have reviewed the [contributing guide](https://github.com/Instagram/IGListKit/blob/master/.github/CONTRIBUTING.md)
Closes https://github.com/Instagram/IGListKit/pull/507

Differential Revision: D4621418

Pulled By: jessesquires

fbshipit-source-id: 4b55500c83ca1b911c418e5857756bb076fc80e4
2017-02-28 14:32:06 -08:00
Ryan Nystrom
6bdcac81d8 Layout invalidation API
Summary:
Adding a new layout-invalidation API, telling the layout object to query and rebuild the layout for all items in the section controller. This works with `UICollectionViewFlowLayout` and should work with other custom layouts (including our own).

Issue fixed: #360, #459

- [x] All tests pass. Demo project builds and runs.
- [x] I added tests, an experiment, or detailed why my change isn't tested.
- [x] I added an entry to the `CHANGELOG.md` for any breaking changes, enhancements, or bug fixes.
Closes https://github.com/Instagram/IGListKit/pull/499

Reviewed By: jessesquires

Differential Revision: D4590274

Pulled By: rnystrom

fbshipit-source-id: f87235be4e6c024bf979b831a8938be68895e011
2017-02-21 15:30:56 -08:00
Ryan Nystrom
4dec244416 Add item-level moves to IGListCollectionContext
Summary:
Adding an API to do item-level (cell) moves on the collection view. This complicates things a little bit because of all the issues that moving sections have while in batch updates (e.g. simultaneous animation UICV bugs). Thankfully we use pretty strict types so the compiler does most of the work for us.

Closes #145

- [x] Tests build and pass
- [x] Add `IGListBatchUpdateData` tests to check moves during
  - [x] ~~Moving within a reloaded section (no op)~~ can't reload sections
  - [x] Moving within a deleted section (no op)
  - [x] Moving within a moved section (convert section ops to delete+insert)
  - [x] Moving an index path that is also reloaded (convert to delete+insert path)
- [x] Add move unit tests to `IGListAdapterUpdater`
- [x] Add move unit tests to `IGListReloadDataUpdater` (mostly for code coverage...)
- [x] Add move unit tests to `IGListStackedSectionController`
- [x] Add `CHANGELOG.md` entry for 3.0.0
- [x] Test moving without batch
Closes https://github.com/Instagram/IGListKit/pull/418

Reviewed By: jessesquires

Differential Revision: D4521732

Pulled By: rnystrom

fbshipit-source-id: 99a46d1cbb0cc1f857a62ff6ca257aff6e8b7f25
2017-02-10 18:01:18 -08:00
Bofei Zhu
2074eba50e Convert NSUInteger to NSInteger
Summary:
- [x] All tests pass. Demo project builds and runs.

No breaking changes that I am aware of.
Closes https://github.com/Instagram/IGListKit/pull/440

Differential Revision: D4448496

Pulled By: rnystrom

fbshipit-source-id: 9ad9bc3734b605ceab25bf6cdf993568aa6561c1
2017-01-22 14:44:14 -08:00
Bofei Zhu
d0ff14c934 Clean internal NSArray copying
Summary:
Fixed #384

- [x] All tests pass. Demo project builds and runs.
Closes https://github.com/Instagram/IGListKit/pull/441

Differential Revision: D4448500

Pulled By: rnystrom

fbshipit-source-id: 38276083a3689eea92c1c7afd1bded3c8fe96282
2017-01-22 14:44:14 -08:00
PhilCai
86335ac260 fix issue 424
Summary:
- [x] All tests pass. Demo project builds and runs.
- [x] I added tests, an experiment, or detailed why my change isn't tested.
- [x] I added an entry to the `CHANGELOG.md` for any breaking changes, enhancements, or bug fixes.
- [x] I have reviewed the [contributing guide](https://github.com/Instagram/IGListKit/blob/master/.github/CONTRIBUTING.md)
Closes https://github.com/Instagram/IGListKit/pull/426

Differential Revision: D4428853

Pulled By: rnystrom

fbshipit-source-id: 1c5f3aa196a726986be291c7347eded853eb0eac
2017-01-18 08:44:00 -08:00
Jeff Bailey
8d74b8f778 Fix for #348 - IGListStackedSectionController's children need to know numberOrItems before didUpdate is called
Summary:
The reloadData method in IGListStackedSectionController was being called too soon.  It was moved from the constructor to the `didUpdateToObject` method.  Tests were updated to reflect the change.

- [x] All tests pass. Demo project builds and runs.
- [x] 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.
- [x] I have reviewed the [contributing guide](https://github.com/Instagram/IGListKit/blob/master/.github/CONTRIBUTING.md)
Closes https://github.com/Instagram/IGListKit/pull/390

Differential Revision: D4419751

Pulled By: rnystrom

fbshipit-source-id: 7c812d306b23dd251c160425873930eb8022b1a5
2017-01-14 14:29:03 -08:00
Ryan Nystrom
e9ad6b199e Working ranges in stacked section controllers
Summary:
Closes #354

- [x] All tests pass. Demo project builds and runs.
- [x] I added tests, an experiment, or detailed why my change isn't tested.
- [x] I have reviewed the [contributing guide](https://github.com/Instagram/IGListKit/blob/master/.github/CONTRIBUTING.md)
Closes https://github.com/Instagram/IGListKit/pull/356

Differential Revision: D4365718

Pulled By: jessesquires

fbshipit-source-id: 41d7bcd823415e5795a069a4ef335e60e7da806a
2016-12-23 08:29:14 -08:00
Jesse Squires
6d84f85dd0 Fix stacked section controller OOB when cell ends display
Summary:
Fixes bug reported internally. When items are removed dynamically the stack internal store will attempt to access data that has already been removed. Instead use assoc objects.

We did change `IGListAdapter` to [use a map](https://github.com/Instagram/IGListKit/blob/master/Source/IGListAdapter.m#L681) instead of assoc objects. That could be a good cleanup.

cc cdoncarroll

- [x] All tests pass. Demo project builds and runs.
- [x] I added tests, an experiment, or detailed why my change isn't tested.
- [x] I have reviewed the [contributing guide](https://github.com/Instagram/IGListKit/blob/master/.github/CONTRIBUTING.md)
Closes https://github.com/Instagram/IGListKit/pull/358

Differential Revision: D4363840

Pulled By: jessesquires

fbshipit-source-id: ef73b4302f88a15cbf70378421d702f7e2bddbd5
2016-12-22 14:44:10 -08:00
Ryan Nystrom
e66bd85e32 Fix deselection from stack collection context offset
Summary:
Offset should be relative.

Fixes #279

- [x] All tests pass. Demo project builds and runs.
- [x] I added tests, an experiment, or detailed why my change isn't tested.
- [x] I have reviewed the [contributing guide](https://github.com/Instagram/IGListKit/blob/master/.github/CONTRIBUTING.md)
Closes https://github.com/Instagram/IGListKit/pull/295

Differential Revision: D4290143

Pulled By: rnystrom

fbshipit-source-id: 8d6dccb821b12700d0d7e8704006ef5371396dfd
2016-12-06 18:59:00 -08:00
Ryan Nystrom
10bdfb23f9 Add more unit tests to stack section controller
Summary:
Beefing up our test coverage. Made an improvement to supplementary view behavior along the way. Will update `CHANGELOG.md` once travis finishes w/ link to PR #.

- [x] All tests pass. Demo project builds and runs.
- [x] I added tests, an experiment, or detailed why my change isn't tested.
- [x] I have reviewed the [contributing guide](https://github.com/Instagram/IGListKit/blob/master/.github/CONTRIBUTING.md)
Closes https://github.com/Instagram/IGListKit/pull/286

Differential Revision: D4281961

Pulled By: jessesquires

fbshipit-source-id: 32b5877bd72250b9a99e600ceffc64d686fa5651
2016-12-05 17:44:02 -08:00
Brandon Everett
36363f42aa Create private method in IGListStackedSectionController to get relative index
Summary:
Fixes from PR #273 rebase.

jessesquires rnystrom this should look a little better and be able to merge.

- [x] All tests pass. Demo project builds and runs.
- [x] I added tests, an experiment, or detailed why my change isn't tested.
- [x] I have reviewed the [contributing guide](https://github.com/Instagram/IGListKit/blob/master/.github/CONTRIBUTING.md)
Closes https://github.com/Instagram/IGListKit/pull/275

Differential Revision: D4271440

Pulled By: rnystrom

fbshipit-source-id: a85b8c80b5504640d7f82b183ed5b5d0d0ea5c1b
2016-12-03 08:29:14 -08:00
Jesse Squires
e5afb5b4d0 Add scrolling method on IGListCollectionContext. Close #267
Summary:
- Add scrolling method on IGListCollectionContext so that section controllers can scroll to themselves.
- Update CHANGELOG.
- Other misc fixes.
- Closes #267 on GitHub.

Reviewed By: rnystrom

Differential Revision: D4261144

fbshipit-source-id: 9eed833cfff06107607bba01a0beee1d871497b6
2016-12-01 16:14:04 -08:00
Suraya Shivji
e2fbb68670 Swap NSUInteger to NSInteger Public API
Summary:
Swapped NSUInteger to NSInteger in public headers. Fixed a test in IGListSectionMapTests.m to pass with NSInteger. For issue #200!

- [x] All tests pass. Demo project builds and runs.
- [x] I added tests, an experiment, or detailed why my change isn't tested.
- [x] I have reviewed the [contributing guide](https://github.com/Instagram/IGListKit/blob/master/CONTRIBUTING.md)
Closes https://github.com/Instagram/IGListKit/pull/205

Differential Revision: D4191521

Pulled By: rnystrom

fbshipit-source-id: 3f15c5ee3f8ed2d382de2602912a2e998bfbcbba
2016-11-16 15:28:59 -08:00
Ryan Nystrom
f5339113df Support supplementaryViews created from nibs (continued)
Summary:
Continuing the work on #90. I don't believe I can push directly to that PR since the origin is `master` of a repo I don't have access to.

https://help.github.com/articles/checking-out-pull-requests-locally/

I went ahead and added another supplementary view test copying the old one we had.

cc jessesquires in case there's something else I can do here. I believe this will still give rawlinxx credit?
Closes https://github.com/Instagram/IGListKit/pull/162

Differential Revision: D4137364

Pulled By: rnystrom

fbshipit-source-id: d8418ac5728fd6d9570fa1d1568f4343f5c4112b
2016-11-05 16:29:06 -07:00
Bofei Zhu
158d04ebe0 Support supplementaryViews created from storyboard
Summary:
Miss this in the previous PR #92. Will add unit test soon.
Closes https://github.com/Instagram/IGListKit/pull/123

Differential Revision: D4101594

Pulled By: rnystrom

fbshipit-source-id: 820030358532b0878f6d9e9092834266c9260a38
2016-11-01 10:59:21 -07:00
Bofei Zhu
8855b5156a Add storyboard support #39
Summary:
This PR is for #39

- [x] I have reviewed the [contributing guide](https://github.com/Instagram/IGListKit/blob/master/CONTRIBUTING.md)
Closes https://github.com/Instagram/IGListKit/pull/92

Differential Revision: D4066721

Pulled By: rnystrom

fbshipit-source-id: 4fca278ae9a54aa46626932d47d4a4c001b437d6
2016-10-25 15:29:13 -07:00
Sven Bacia
ce4b851da3 Support cells created from nibs
Summary:
I started working on adding support for dequeuing cells created from nibs (issue #1). Additionally I extended `IGListSingleSectionController` so that it can be used with nibs too. I don't know if you had this also in mind.

- [x]  I'm currently thinking about the best way to test these changes.
- [x] I was not able to update the documentation (issue #55).

- [x] All tests pass. Demo project builds and runs.
- [x] I added tests, an experiment, or detailed why my change isn't tested.
- [x] I have reviewed the [contributing guide](https://github.com/Instagram/IGListKit/blob/master/CONTRIBUTING.md)
Closes https://github.com/Instagram/IGListKit/pull/56

Reviewed By: dshahidehpour

Differential Revision: D4023746

Pulled By: rnystrom

fbshipit-source-id: 6a8b4cfb4dba38ea6e9870a9a4506288ee155cfe
2016-10-14 18:59:18 -07:00
FBShipIt
cdc796746a Initial commit
fbshipit-source-id: c38b897b9e2b87c782e0e01b0145d9189dc7f9d8
2016-10-11 10:12:17 -04:00