60 Commits

Author SHA1 Message Date
Adlai Holler
8edc9fe08f Ensure supplementary section count tracks item section count (#2118) 2016-08-22 20:50:09 -07:00
Adlai Holler
69e73065e5 Avoid accessing itemCountsFromDataSource off-main (#2106) 2016-08-19 12:10:19 -07:00
Adlai Holler
0bd664f9ed Remove numberOfSectionsForSupplementaryNodeOfKind: Method (#2102)
* Add unit test to confirm that supplementary items must be contained within actual sections

* [ASLayoutInspecting] Deprecate collectionView:numberOfSectionsForSupplementaryNodeOfKind:

* Add another test to dig deeper into UICollectionView
2016-08-19 11:18:31 -07:00
Adlai Holler
1fbf8ad073 [ASDataController] Cancel if we lose our data source, fix bugs (#1987)
[ASRangeController] We're already on main thread, remove blocks

Make data source read-only, clarify what's asynchronous

[ASDataController] Clean up some interfaces

[ASDataController] A little more cleanup

[ASDataController] Cleanup

[ASDataController] Restore some changes, exit more often

[ASDataController] Use item counts that we already have rather than requerying them

[ASDataController] Revert weakifications

[ASDataController] Add a mechanism to measure how much work we avoided
2016-08-05 15:39:33 -07:00
Adlai Holler
8eb25e737b [ASCollectionDataController] Use block-based enumeration with dictionaries 2016-07-12 15:17:57 -07:00
Adlai Holler
6aad142f2e [ASCollectionDataController] Some optimizations 2016-07-12 15:11:13 -07:00
Adlai Holler
2e19d11350 Reduce block invocations, other small performance bumps 2016-07-12 15:11:13 -07:00
Eric Horacek
3efd01a781 [ASCollectionDataController] Repopulate deleted supplementary nodes if necessary (#1773)
* Repopulate deleted supplementary nodes if necessary

Fixes 1771

* Fix warning
2016-07-09 22:46:29 -07:00
appleguy
3b2af7eb6d [Build] Remove Unused Imports across all of AsyncDisplayKit. This uses a feature of AppCode. (#1875)
Details on the tool are here: https://www.jetbrains.com/help/idea/2016.1/optimizing-imports.html
2016-07-09 17:20:59 -07:00
Adlai Holler
b1626b0f69 Merge pull request #1791 from colinmcardell/ASCollectionDataController_supplementaryNodeOfKind-fix
[ASCollectionDataController] Exposing -supplementaryNodeOfKind
2016-07-08 12:50:32 -07:00
Colin McArdell and Robin Chou
488ded2fe8 ASCollectionDataControllers supplementaryNodeOfKind:atIndexPath: now returns nil instead of an assertion if the supplementary node of kind doesn't exist within completedNodesOfKind 2016-06-27 11:05:37 -04:00
Adlai Holler
35056f708b [ASDataController] Improve update handling 2016-06-24 11:12:37 -07:00
Adlai Holler
457e08005f [ASDataController] Remove asyncDataFetching Option, Cleanup (#1794)
* [ASDataController] Add some assertions to clarify what queues things happen on

* [ASCollectionDataController] Optimize willReloadData

* [ASDataController] Minor optimizations, no functional changes

* [ASDataController] Always reload data on _editingTransactionQueue

* [ASDataController] Remove async data fetching option, deprecate callbacks

* [ASDataController] Not mutable

* [ASMultidimensionalArrayUtils] Use fast enumeration

* Optimize ASMultidimensionalArrayUtils
2016-06-23 21:08:44 -07:00
Hannah Troisi
c857e809f4 Clean up header comments (for consistent Facebook licensing info) (#1741)
[Licensing] Clean up header comments (for consistent Facebook licensing info)
2016-06-11 23:31:39 -07:00
Eric Horacek
70fbbe00a3 Whitespace 2016-06-05 21:55:57 -07:00
Eric Horacek
ed9fcdc2d7 Rebase 2016-06-05 21:53:04 -07:00
Eric Horacek
30dba283e2 Remove _pendingContexts dictionary mutation during enumeration 2016-06-05 21:43:05 -07:00
Eric Horacek
dc7f67c478 Populate more aggresively 2016-06-05 21:38:08 -07:00
Eric Horacek
fc5eef3269 Repopulate supplementary views on item-level changes
Currently within `ASCollectionView`, there is an assumption that there will always be a static number of supplementary views per section—even when additional items are added or removed from that section. This is evidenced by the fact that when you invoke -[ASCollectionView insertItemsAtIndexPaths:], the data source method -[ASCollectionDataSource collectionView:nodeForSupplementaryElementOfKind:atIndexPath:] is not invoked, preventing consumers from specifying a new number of supplementary nodes for the new set of items.

With this change, the set of supplementary nodes for a section is now recalculated not only on section-level mutations, but also on item-level mutations as well. This adds item-level counterparts to the section-level `-prepareFor...` subclassing hooks in `ASDataController+Subclasses.h` to make this possible.

This should fix #1278 and #1322

This has been tested in my project and seen to fix the assertion. Open to suggestions on how to test in a more universal way.
2016-06-05 21:38:08 -07:00
ricky
01dbc86778 First pass of comments
* make variable naming reflect ASEnvironmentTraitCollection vs ASTraitCollection
* move trait propagation to cell allocation instead of via a nested block
* move trait propagation when setting a displaynode's supernode instead of when adding a subnode
* fixed misspelling of "colection"
2016-06-03 09:59:24 -07:00
Henish Shah
41a53887d7 [Sample] Resolve mutation during enumeration issue
- Mutating a dictionary using -enumerateKeysAndObjectsUsingBlock:
  can have unintended consequences.
- Using a copy of the keys to iterate over the values inside the
  dictionary instead.
2016-05-13 16:14:19 -04:00
Henish Shah
8e38e225c8 [Sample] Resolve mutation during enumeration issue
- Mutating a dictionary using -enumerateKeysAndObjectsUsingBlock:
  can have unintended consequences.
- Using a copy of the keys to iterate over the values inside the
  dictionary instead.
2016-05-13 11:51:01 -04:00
Huy Nguyen
5ecc9b16a9 Remove unncessary batch layout calls in ASCollectionDataController
- These calls cause supplementary nodes to be allocated and laid out, but not inserted afterward. So the nodes are thrown away.
- Next time when it is the right time to allocate these nodes, it is the second allocation request and triggers assertion in ASIndexedNodeContext #1296.
2016-03-01 15:42:53 -08:00
Huy Nguyen
54cde1a3db Introduce ASIndexedNodeContext
- It is a container object that holds enough information to construct and measure a cell node
- All information is gathered on main thread. This allows ASDataController to capture the correct state of its data source before going to background.
2016-02-29 01:00:16 -08:00
appleguy
b75d6627bb Revert "Revert "Revert "[ASCollectionView / ASTableView] Optimize reloadData and reloadSection: methods.""" 2016-02-19 23:26:29 -08:00
Scott Goodson
a1061301e0 [ASDataController] Revert the reloadData optimizations again - need to fix apps relying on prior behavior.
The optimization seems correct now, but apps like Pinterest have some core code relying on edit operation
order that is actually not permitted by UIKit (and this diff) but were tolerated previously.  We will
re-land this once we have time to adapt the code.
2016-02-19 21:31:39 -08:00
appleguy
32aa333c21 Revert "[ASCollectionView / ASTableView] Optimize reloadData and reloadSection: methods." 2016-02-18 19:50:06 -08:00
Luke Zhao
40791dd859 optimize reload data, reload sections, & move nodes performance & logic 2016-02-18 14:44:16 -08:00
Rahul Malik
3e5daf4ccd Update data source protocols to make synchronous node creation api methods optional. 2016-02-09 22:47:43 -08:00
Rahul Malik
c4f489b074 Address comments. 2016-02-04 16:56:29 -08:00
Rahul Malik
521c3fa1c1 Move ASCellNode allocation off the main thread by the addition of a node block
API in ASDataController. Move allocations and loaded node layouts to occur
during batch layout phase.
2016-02-04 10:38:59 -08:00
Scott Goodson
83aaa4637e Revert "ASDataController now handles reloadData more efficiently and notify its delegate once instead of a series of deletes and inserts"
This reverts commit 2e4d716e0b65465d9c65b5821668c38e5fa956c9.

Possible issue with this commit.
2016-01-22 20:33:33 -08:00
Huy Nguyen
2e4d716e0b ASDataController now handles reloadData more efficiently and notify its delegate once instead of a series of deletes and inserts 2016-01-21 11:21:21 -08:00
Scott Goodson
690f90a899 Supplementary nodes must be added to the completed nodes after their measurement completes following individual section reloads. 2015-12-27 15:34:26 -08:00
Levi McCallum
223cac1784 Inline supplementary kind iteration in data controller 2015-12-06 21:31:40 -08:00
Levi McCallum
64da9e7ece Ensure that new section supplementary nodes are inserted into backing store 2015-12-06 20:07:29 -08:00
Levi McCallum
5ca14486b6 Make array instantiation consistent 2015-10-21 23:17:37 -07:00
Levi McCallum
9a37538582 Clean up and test registration of internal supplementary node kinds 2015-10-15 11:40:53 -07:00
Levi McCallum
12194199cd Clean up layout delegate protocol API 2015-10-15 11:40:53 -07:00
Levi McCallum
ee0cc2001a Add support for loaded node layout for supplementary views 2015-10-15 11:40:52 -07:00
Levi McCallum
952a66a924 Remove initial data loading subclass hook 2015-10-15 11:40:52 -07:00
Levi McCallum
fddb0061b0 Use ASCellNodes for supplementary nodes 2015-10-15 11:40:52 -07:00
Levi McCallum
848dc26a0d Fix hook method naming 2015-10-15 11:40:52 -07:00
Levi McCallum
3f0092435a Add support to move supplementary nodes with section position changes 2015-10-15 11:40:51 -07:00
Levi McCallum
9235ce5ac2 Support reloading supplementary nodes when sections reload 2015-10-15 11:40:51 -07:00
Levi McCallum
d77df45bfd Delete supplementary nodes when section is deleted 2015-10-15 11:40:51 -07:00
Levi McCallum
e1ea2d2151 Handle supplementary node generation during insertion of new section 2015-10-15 11:40:51 -07:00
Levi McCallum
2cc55513a4 Nil out pending store kinds after processing 2015-10-15 11:40:51 -07:00
Levi McCallum
d36c8a36c6 Introduce ability to populate internal supplementary nodes at specific sections 2015-10-15 11:40:51 -07:00
Levi McCallum
f9bba315df Stub out subclass hooks for section insert/remove/update/moving 2015-10-15 11:40:51 -07:00