Commit graph

115 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
4e9b0bb4c4 Prevent negative spaces for items and supplementaries
Summary:
If a negative height/width comes down, cap it to `0.0`.

Issue fixed: #566

Also fixes t16455632 internally.

- [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/583

Differential Revision: D4797520

Pulled By: jessesquires

fbshipit-source-id: 3eeec5244a445bb451460286b4f006ca0d9c67d1
2017-03-29 15:01:08 -07:00
Ryan Nystrom
5eca718ea7 Drop section moves if they are also deleted or inserted
Summary:
Issue fixed: #430

- [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/577

Differential Revision: D4768612

Pulled By: rnystrom

fbshipit-source-id: 6a2024101411302446cc2b7843fa175cd43a1562
2017-03-23 22:31:38 -07:00
Ryan Nystrom
ca9e9a16b7 Fix unused variable warning when asserts compiled out
Summary:
Found this examining Travis output. Warning removed when asserts aren't compiled.

Closes https://github.com/Instagram/IGListKit/pull/580

Differential Revision: D4763179

Pulled By: rnystrom

fbshipit-source-id: af23780387e8d8f95f11fe778d91e281006ff6fb
2017-03-23 11:47:58 -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
Ryan Nystrom
af984ca81d Assert nil diff identifier, remove if nil
Summary:
Do not allow `nil` diff identifiers to get through. Pluck the objects if this happens and assert.

- Fix the bug if it happens
- Assert to tell the developer what is wrong

Differential Revision: D4753827

fbshipit-source-id: 3a92543c648ed7157ec30af7cb1c91a6e6238e33
2017-03-22 09:49:26 -07:00
Shiyi Zhao
24308a9881 handle float number fraction part for layout.
Summary:
[IGListCollectionViewLayout]: handle float number fraction part for layout.
When width of item is a float number with non-zero fraction part.
After integer scaled, it might add up smaller or bigger than maxWidth.
Ex with 6 items with 13 padding on each side
1. iPhone 7, maxWidth = 349, scaledItemWidth = 58 -> 58 * 6 = 348, which is smaller than 349
-> this can cause issue where is extra one line at end
2. iPone 7 plus, maxWidth = 388, scaledItemWidth = 64.6667 -> 64.6667 * 6 = 388.0002, which is bigger than 388
-> this can cause issue where last item is mistakenly shifted to next row

To fix it, add epsilon = 1 to allow some error range
Also add stretchToEdge BOOL flag to handle case 1 to decide whether to strech the width of last item.

Reviewed By: ryanolsonk, jessesquires

Differential Revision: D4720156

fbshipit-source-id: 765f6b13b7d601394d65788c30ae69ac1b37c3f2
2017-03-17 12:33:34 -07:00
Shiyi Zhao
a80245a696 add integer pixel scaled for frame
Summary: [IGListCollectionViewLayout]: add integer pixel scaled for frame

Reviewed By: jessesquires

Differential Revision: D4727500

fbshipit-source-id: dccabe9152fdec4a9bee2b92d9a7897552a0fecb
2017-03-17 12:33:34 -07:00
PhilCai
bbd4738ca2 Simplify header height check in layout
Summary:
Issue fixed: #

- [ ] 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](https://github.com/Instagram/IGListKit/blob/master/.github/CONTRIBUTING.md)

Small changes
Closes https://github.com/Instagram/IGListKit/pull/565

Differential Revision: D4728939

Pulled By: rnystrom

fbshipit-source-id: 4f0c3455f55d4c267dffe5d7ebd37a96a648ec52
2017-03-17 08:20:39 -07:00
Viktor Gardart
15f3c4b828 Renamed batchUpdatesCollector to batchUpdates fixes #556
Summary:
Issue fixed: #556
Closes https://github.com/Instagram/IGListKit/pull/564

Differential Revision: D4725115

Pulled By: jessesquires

fbshipit-source-id: f6ea9a6f80b3b3f1123df7c4c19d658e2b63653f
2017-03-16 16:18:21 -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
Ryan Nystrom
79348164a7 Auto diffing section controller
Summary:
Started work on the plane to get this moving since #418  is up and ready to land. We'll likely need to spend some time fleshing out the API of this, and I think I'll split it up into a couple different PRs once ready for review. Putting this up now to get early feedback.

This adds an auto-diffing section controller as outlined in #38. There are several key parts:

- Subclass a new section controller `IGListAutoSectionController` (naming wip)
- Connect a data source
- Implement the data source methods that do 3 things:
  - Given a top-level object, transform it into an array of **diffable** view models
  - Given a view model, return a cell
  - Given a view model, return a size for a cell
- A new protocol for the cell `IGListBindable` so that we can control when the cell is updated w/ the view model.
  - The most important part of this is that it unlocks moving and reloading a cell, which you can't do w/ `UICollectionView`

- [ ] Unit test `reloadObjects:`
- [x] Add
Closes https://github.com/Instagram/IGListKit/pull/494

Reviewed By: amonshiz

Differential Revision: D4696966

Pulled By: rnystrom

fbshipit-source-id: f21b8341b3ed4389f2a4a106d0d316f481ba6943
2017-03-15 07:47:24 -07:00
Yifan Peng
982ded0908 remove subclass restriction on IGListCollectionViewLayout
Summary: remove subclass restriction on IGListCollectionViewLayout, so IGListCollectionViewLayout can be subclassed to support customized layout behavior.

Reviewed By: rnystrom

Differential Revision: D4700759

fbshipit-source-id: 1a22d1b981251ae60028724ae220e49d2d37c190
2017-03-14 10:16:28 -07:00
Shiyi Zhao
7f652e2c17 fix a bug which caused double inset being applied when having non-zero left contentInset.
Summary: [IGListCollectionViewLayout]: fix a bug which caused double inset being applied when having non-zero left contentInset.

Reviewed By: jessesquires

Differential Revision: D4692870

fbshipit-source-id: 1a1a3ccf944a83fea3a706b83f54293346b35c5a
2017-03-10 19:00:41 -08:00
Ryan Nystrom
3f9dea21e0 Track batch updates in object and explicit state
Summary:
Batch updates are complicated b/c its unknown when the update block will actually execute. When executing the block, we want to collect inserts/deletes/reloads/moves (item and section). Allow mutations to happen synchronously outside of the update block.

Tracking state will also help with the auto-diff where we need to allow re-entrant updates.

Peeling off a chunk from #494

Issue fixed: #288

- [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/525

Reviewed By: jessesquires

Differential Revision: D4656463

Pulled By: rnystrom

fbshipit-source-id: 8f4d3dc21b03d595e02ee9ee9664277e8ead0531
2017-03-07 09:33:03 -08:00
Benny Wong
03c316a4db Fix spelling in documentation
Summary:
Simple spelling fix in documentation.
Closes https://github.com/Instagram/IGListKit/pull/529

Differential Revision: D4666490

Pulled By: rnystrom

fbshipit-source-id: b6e4a17da720f176f807606bded76de8fa21b618
2017-03-07 08:31:06 -08:00
Leyla Hujer
68a264d29c Revert D4640425: [IGListKit] kill IGListCollectionView. GH issue #409
Summary: This reverts commit 871b75eaeb1c9f2a40fe8f3fd81b209661704587

Differential Revision: D4640425

fbshipit-source-id: 4b0e8a9820891062cf7f8d13de13d678adb5df4a
2017-03-06 16:15:31 -08:00
Jesse Squires
3fb2ac0d60 kill IGListCollectionView. GH issue #409
Summary: Remove `IGListCollectionView` per #409. Use plain old `UICollectionView`.

Reviewed By: rnystrom

Differential Revision: D4640425

fbshipit-source-id: 871b75eaeb1c9f2a40fe8f3fd81b209661704587
2017-03-06 15:01:01 -08:00
Ryan Nystrom
2e996e283e Test and fix layout fitting width and inset sections with newline
Summary:
Fixes internally reported issue where the layout was new lining a section that had proper width math. Also, when inset sections were all on the same line, the max height added inset for each section, causing the newline to be too low.

- [x] All tests pass. Demo project builds and runs.
- [x] I added tests, an experiment, or detailed why my change isn't tested.
Closes https://github.com/Instagram/IGListKit/pull/522

Reviewed By: jessesquires

Differential Revision: D4655554

Pulled By: rnystrom

fbshipit-source-id: 5e759451e285ccd636ed59dcee0777ce590797ad
2017-03-04 16:15:51 -08: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
f639cdd287 Prevent stale adapter:collectionView corruptions
Summary:
This becomes an issue pretty easily in embedded `IGListAdapter` environments (lists in lists). IGListKit creates a single `IGListSectionController` instance per object, but cells are reused within `IGListCollectionView`. If you assign `adapter.collectionView = cell.collectionView` (like we recommend in our [example](https://github.com/Instagram/IGListKit/blob/master/Examples/Examples-iOS/IGListKitExamples/SectionControllers/HorizontalSectionController.swift#L40)), then you can have many adapters with a weak ref to the **same collection view**.

Obviously when updates happen across all embedded lists, adapters could potentially update the same collection view and apply a corrupted batch update.

I proposed using `<objc/runtime.h>` and using associated objects, but since `OBJC_ASSOCIATION_ASSIGN` is not zerod-on-release reference (its just `unsafe_unretained`) I'd have to make a weak wrapped object, which is overkill.

Instead I think a global weak:weak map is fine. We d
Closes https://github.com/Instagram/IGListKit/pull/517

Differential Revision: D4623300

Pulled By: rnystrom

fbshipit-source-id: 53d2dd158923c431e793b0c8e28997e9bbf55b8b
2017-02-28 07:32:10 -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
Vincent Peng
2adea72158 Rename "withCollectionView:" param to "collectionView:"
Summary:
- Rename "withCollectionView:" param to "collectionView:" param to be consistent with the rest
of the protocol.
- Update tests.

Related issue: #466

- [x] All tests pass. Demo project builds and runs.
- [ ] 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/491

Differential Revision: D4589976

Pulled By: rnystrom

fbshipit-source-id: 5e5aa7328a6bbac6baa705d5228f0eb4321d8c31
2017-02-21 09:15:45 -08:00
Jesse Squires
7a94167be1 optimize. avoid unncessary copies.
Summary: Reduce and avoid unnecessary copies in IGListAdapter and IGListSectionMap.

Reviewed By: rnystrom

Differential Revision: D4555347

fbshipit-source-id: 3ade3311955fe5d12fc7617ad72feba9dafb60fb
2017-02-14 15:33:43 -08:00
Ryan Nystrom
9c37fbf8a4 Handle nil section controllers from data source
Summary:
Removing the assert and handling `nil` section controllers. This wont effect Swift code which demands a non-optional section controller, but Objective-C is more nuanced. There is evidence that some callers do not have a default state and are returning `nil`.

Unfortunately this will [OOB here](https://github.com/Instagram/IGListKit/blob/master/Source/Internal/IGListSectionMap.m#L63) if using the original `objects` array provided by the data source. Instead we prune the array, only allowing in objects that have a matching section controller.

Fixes t15773862 internally.

- [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/488

Reviewed By: dshahidehpour

Differential Revision: D4553886

Pulled By: rnystrom

fbshipit-source-id: a473a99b5eb513e4b610019dba0394a014193fc4
2017-02-14 08:01:47 -08:00
Ryan Nystrom
a5a08d2e11 Remove IGListGridCollectionViewLayout
Summary:
Follow from #450, this layout has been replaced. You served us well!

- [x] All tests pass. Demo project builds and runs.
- [x] I added an entry to the `CHANGELOG.md` for any breaking changes, enhancements, or bug fixes.
Closes https://github.com/Instagram/IGListKit/pull/482

Differential Revision: D4553897

Pulled By: rnystrom

fbshipit-source-id: caccb386ba8914fbbf5e81d997524efb78c6e4ea
2017-02-13 14:30:58 -08:00
Ryan Nystrom
4eddd4a191 Consider supplementary views when sending display events
Summary:
This was a little bit of an invasive change with the display handler, but I think that this is the right call. When sending display events for objects, we should account for the supplementary view as part of the section controller. This is especially useful for headers and footers.

Note that this wont effect the working range API at all.

Fixes #300
Closes https://github.com/Instagram/IGListKit/pull/470

Differential Revision: D4551338

Pulled By: rnystrom

fbshipit-source-id: dda6fbf18bcfc2c941d80ee2314a543d1ab83843
2017-02-13 07:01:13 -08:00
Dustin Shahidehpour
fef72e579e Backed out changeset b72b444c1197
Summary: This diff isn't correct, and the Instagram cut happens today. Pulling back so I have time to test the correct change more throughly.

Reviewed By: rnystrom

Differential Revision: D4550149

fbshipit-source-id: 2e882caeb9ef999b7fd57562740b352ea8edfa5f
2017-02-12 14:30:39 -08:00
Ryan Nystrom
e2c2d3dcec Vertical UICollectionViewLayout supporting inline sections (take 2)
Summary:
Working on porting our collection view layout to IGListKit. I'm doing this because its a solid layout, and we just finished preparing it to work with inline sections. It is designed to work in tandem with IGListKit, so we're adding it.

This is still a WIP as I add more tests, but I'd love as much feedback as possible.

Aside from the glob of header documentation, this has the following features:

- Infinite sections that each have infinite items. Sections and items can fall inline. When they break the width of their container they will fall on the next row.
- Sections can have their own insets, line spacing, and interitem spacing.
- Sticky header support! When you use headers, it will always newline the section.
- Maximum width with a border decoration view
  - Use this to pinch in your content on larger devices

Followup to #423

- [ ] ~~Move decoration view support to delegate~~ removed
- [x] Unit test changing [top y sticky inset](https://coveralls.io/builds/9977284/source?filen
Closes https://github.com/Instagram/IGListKit/pull/484

Differential Revision: D4547760

Pulled By: rnystrom

fbshipit-source-id: 879e2da16eb78bb6a90967e77d9ad0bbf7c69594
2017-02-10 18:01:22 -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
Jesse Squires
7d55bd80ae fix integer type inconsistency, potential over/underflow
Summary:
Internal crash reports (see T15774792) indicate we're having integer overflow/underflow issues.
I notcied this inconsistency, which was introduced by GH issues #431, #440.

Differential Revision: D4546852

fbshipit-source-id: 67e56487cce02f082943f3008bcfcb5cf6205e0e
2017-02-10 16:32:33 -08:00
Ryan Nystrom
80ad941369 Revert D4521797: [IGListKit][PR] Vertical UICollectionViewLayout supporting inline sections
Summary: This reverts commit 20b36ae573d38ca3125a6f3d5faec181c290ab94

Differential Revision: D4521797

fbshipit-source-id: 447de6cf2b30de9c2109dffb266326aceceec7fc
2017-02-10 11:33:07 -08:00
PhilCai
74e797c6fd Fix some IGCollectionView unavaliable methods hint
Summary:
- [x] 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.
- [x] I have reviewed the [contributing guide](https://github.com/Instagram/IGListKit/blob/master/.github/CONTRIBUTING.md)

I guess there's some mistake in unavailable hints
Closes https://github.com/Instagram/IGListKit/pull/479

Differential Revision: D4543489

Pulled By: rnystrom

fbshipit-source-id: fb925fad04d2931fbfd0e26a87d36f85eee0b2e9
2017-02-10 09:03:09 -08:00
Ryan Nystrom
727833409f Vertical UICollectionViewLayout supporting inline sections
Summary:
Working on porting our collection view layout to IGListKit. I'm doing this because its a solid layout, and we just finished preparing it to work with inline sections. It is designed to work in tandem with IGListKit, so we're adding it.

This is still a WIP as I add more tests, but I'd love as much feedback as possible.

Aside from the glob of header documentation, this has the following features:

- Infinite sections that each have infinite items. Sections and items can fall inline. When they break the width of their container they will fall on the next row.
- Sections can have their own insets, line spacing, and interitem spacing.
- Sticky header support! When you use headers, it will always newline the section.
- Maximum width with a border decoration view
  - Use this to pinch in your content on larger devices

Followup to #423

- [ ] ~~Move decoration view support to delegate~~ removed
- [x] Unit test changing [top y sticky inset](https://coveralls.io/builds/9977284/source?filen
Closes https://github.com/Instagram/IGListKit/pull/450

Reviewed By: jessesquires

Differential Revision: D4521797

Pulled By: rnystrom

fbshipit-source-id: 20b36ae573d38ca3125a6f3d5faec181c290ab94
2017-02-10 08:30:33 -08:00
Adlai Holler
106054c181 Add -[IGListAdapter sectionControllerForSection:]
Summary:
Before the diff, you can lookup the object for a given section, and then lookup the section controller for that object, but this seems like a pretty valuable/common operation.
Closes https://github.com/Instagram/IGListKit/pull/477

Differential Revision: D4537479

Pulled By: rnystrom

fbshipit-source-id: ad47a243f0bb0fc72a362863dff2f00b0b640fab
2017-02-09 11:31:17 -08:00
Dustin Shahidehpour
fce3286ae4 Decouple Empty View from backgroundView, make it move with PTR
Summary:
1. The "Empty View" and CV background view are different things. People can now differentiate.
2. The Empty View isn't created until it is needed.
3. The Empty View moves with Refresh Controls.

![](https://media.giphy.com/media/26gslZ7qP07e4N9h6/giphy.gif)

- [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/462

Reviewed By: rnystrom

Differential Revision: D4502591

Pulled By: dshahidehpour

fbshipit-source-id: b72b444c1197c90c385c7414f0662299070a86d1
2017-02-06 08:14:00 -08:00
Bofei Zhu
8a645139b2 - (BOOL) hasChanges should be a readonly property
Summary:
Closed #402

- [x] All tests pass. Demo project builds and runs.
- [x] I added an entry to the `CHANGELOG.md` for any breaking changes, enhancements, or bug fixes.
Closes https://github.com/Instagram/IGListKit/pull/453

Differential Revision: D4479611

Pulled By: rnystrom

fbshipit-source-id: 4c93ce30613e45c19478f9f5d0e59eeeb0142766
2017-02-02 09:59:05 -08:00
David Yamnitsky
5cc0fcd1d7 Fix calculation of vertical and horizontal center in scrollToObject
Summary: Fix bug where scroll position would be incorrect in call to `-[IGListAdapter scrollToObject:supplementaryKinds:scrollDirection:scrollPosition:animated:` with scrollDirection/scrollPosition of UICollectionViewScrollDirectionVertical/UICollectionViewScrollPositionCenteredVertically or UICollectionViewScrollDirectionHorizontal/UICollectionViewScrollPositionCenteredHorizontally and with a collection view with nonzero contentInset.

Reviewed By: jessesquires

Differential Revision: D4475043

fbshipit-source-id: 4714ab0ed02e52e2d7f333624cc17858058ee57f
2017-02-01 12:14:10 -08:00
Adlai Holler
24d74adf04 Add NSObject Conformance to IGListUpdatingDelegate
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/435

Differential Revision: D4479614

Pulled By: rnystrom

fbshipit-source-id: cd0e734d01a53430ec0566f27bd9f39f3d17802c
2017-01-28 01:29:02 -08:00
Jesse Squires
019c990312 fix load previous messages UI flashing bug
Summary:
More reliably prevent animations in `-[IGListAdapter performUpdatesAnimated: completion:]`.

Fixes potential UI flashing and glitches in `performUpdatesAnimated:` when suppressing animations by passing `NO`.

Reviewed By: rnystrom

Differential Revision: D4453115

fbshipit-source-id: a9418b4bc0e11a14d6a5037178bade424ef9617d
2017-01-24 13:14:02 -08:00
Sherlock
528bd33136 Added -[IGListAdapter visibleCellsForObject:] API
Summary:
- Added `-[IGListAdapter visibleCellsForObject:]` API

1. Get all visible cells
2. Get the section for the object
3. Filter cells where indexPath.section of cell is equal to the object
4. Return

- [x] All tests pass. Demo project builds and runs.
- [x] I added test(s), 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)

-------------

Purely additive, can go in 2.2.0 release? Hold off on changelog until agreed.
Wanting to learn some more ObjC so gave this a shot, would appreciate some nit picking/feedback

Closes #437
Closes https://github.com/Instagram/IGListKit/pull/442

Differential Revision: D4450259

Pulled By: jessesquires

fbshipit-source-id: 521583c669fc1160212a7c46a50d62d951cafa2e
2017-01-23 11:28:57 -08:00
Tim Oliver
6e00787eb7 Summary:
Differential Revision: D4450244

Pulled By: jessesquires

fbshipit-source-id: 05145178606bea3aeab8d1855e21eff459111134
2017-01-23 11:14:00 -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
955aff1c70 fix issue 433
Summary:
- [ ] All tests pass. Demo project builds and runs.
- [ ] 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/436

Differential Revision: D4448494

Pulled By: rnystrom

fbshipit-source-id: 09bfdff37dbe0ee718e9e8feb486204e1f55893a
2017-01-22 14:28:59 -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
Diogo Tridapalli
16be9474d2 IGListIndexSetResult and IGListIndexPathResult docs updates use old index
Summary:
Updated documentation to fix #408

- [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/413

Differential Revision: D4415035

Pulled By: rnystrom

fbshipit-source-id: 2c477c515c6f1346ce6db48d4ba865099cf197cd
2017-01-13 07:59:12 -08:00
Jesse Squires
279f348a4a Added object to single section selection delegate callback
Summary:
- Updated selectionDelegate to pass through the model object
- Changelog entry under 3.0.0 as is breaking change

Try saying single section selection 10 times quick
Dabbing my left toe into some ObjC, so apologies if I violate years of rules

- [ ] Update documentation internally

Closes #396

- [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/397

Differential Revision: D4406213

Pulled By: rnystrom

fbshipit-source-id: ba468fa49e75823796a47da6ed7f0e8957db3d75
2017-01-11 15:14:01 -08:00
Peter Edmonston
dd3b9eddcc Fix for #378 - emptyView not updated when items added
Summary:
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

- [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/395

Differential Revision: D4400155

Pulled By: jessesquires

fbshipit-source-id: 6c3422297d86947e7e2878ba1b9227ff2a2a18b4
2017-01-10 14:43:57 -08:00