338 Commits

Author SHA1 Message Date
Eric Horacek
d89504e345 Fix index path arithmetic error 2016-06-05 21:38:08 -07:00
Eric Horacek
8f3e511b22 Fix warning 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
Levi McCallum
f809d4a1c9 Let ASLayout determine if a node should measure 2016-06-05 09:32:48 -07:00
Levi McCallum
19e949e02f [ASDisplayNode] Move constrainedSize to layout 2016-06-05 09:30:57 -07:00
Levi McCallum
c469ad273b [ASLayout] Cache constrained size range 2016-06-05 09:22:46 -07:00
appleguy
e5eed560e1 Merge pull request #1693 from rcancro/traitUpdate
[ASTraitCollection] Bug fixing/LayoutSpec propagation
2016-06-03 22:01:13 -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
Erekle
4f40f3c12f Merge remote-tracking branch 'facebook/master' into ASVideoPlayerNode
# Conflicts:
#	AsyncDisplayKit.xcodeproj/project.pbxproj
2016-05-26 12:15:23 +04:00
Levi McCallum
95f1ab4902 [ASDisplayNode] Rename ASDisplayNodeTransitionContext to ASLayoutTransition (#1680)
* [ASDisplayNode] Rename ASDisplayNodeTransitionContext to ASLayoutTransition

* Rename internal ivar to fit new naming

* Fix tabbing
2016-05-25 10:10:27 +07:00
ricky
59a26ee111 [ASTraitCollection] Bug fixing/LayoutSpec propagation
* Fixed bug in `ASEnvironmentMergeObjectAndState`
* New ASLayoutSpec methods for `setChild`/`setChildren`/`setChild:forIdentifier:` have been added to take in a trait collection.
* Added `setChild:`-like methods for ASLayoutSpecs take a traitCollection
* Fixed instances where nodes in a data controller were not getting their trait collections
* propagate traitCollection in ASDisplayNode on insertSubnode or addSubnode
2016-05-23 16:37:40 -07:00
Erekle
8c8fc3dba0 Adding ASVideoPlayerNode 2016-05-17 11:08:53 -07:00
rcancro
4b54144f55 Levi's comments 2016-05-11 10:21:11 -07:00
rcancro
9d622c7eac changed DisplayTraits to TraitCollection 2016-05-10 14:45:03 -07:00
rcancro
b4a6f87ca6 addressed some comments 2016-05-10 14:44:32 -07:00
rcancro
8bb4eba080 Initial attempt at implementing Display Traits
Initial attempt to get display traits working with ASEnvironment.

To get proper ASDisplayTraits support, you must use an ASViewController. The ASViewController implements UITraitCollection-related methods (`traitCollectionDidChange:`, `willTransitionToTraitCollection:withTransitionCoordinator:`, viewWillTransitionToSize:withTransitionCoordinator`) to update the internal ASDisplayTraits and propagate them to subnodes.

ASTableNode and ASCollectionNode don't actually have their cells as subnodes, so a little bit of trickery is involved (on `setEnvironment:` the table/collection node gets its data controllers completedNodes and propagates the new traits. see `ASDisplayTraitsCollectionTableSetEnvironmentState`). The data controller also passes the current display traits when creating new cells.

ASViewController also supports the ability to return a custom set of display traits. So if you have a modal dialog that should always be told it is in a compact size class, you can set the override block before displaying the VC.

A new example, called Display Traits, has been added. It shows how display traits can be used in a ASViewController with a normal ASDisplayNode as its root, as well as in ASViewControllers hosting table nodes and collection nodes. There is also an example of overriding the default display traits of a VC.

Please provide feedback!
2016-05-10 14:44:22 -07:00
Michael Schneider
d1054d6ed9 Move from ASSentinel to a atomic int 2016-05-05 20:25:07 -07:00
Michael Schneider
dc6d2e7660 Improve Transition ID handling 2016-05-05 20:25:07 -07:00
Garrett Moon
938ecd9b6f Fix deadlock when laying out on multiple threads
Summary:
We observed a deadlock which occurred when two threads were laying out the same set of nodes.

On one thread, layout would occur on a leaf node. It would lock and as part of this layout
process, ASDK walks up the node tree and calls __setNeedsLayout on its supernode until it
reaches the supernode with no supernode. When the supernode gets its call to __setNeedsLayout
it also locks. So leaf node locks and then awaits supernode lock.

On another thread, we're doing a layout pass on the supernode in the above thread. This locks
the supernode and attempts to lock the leaf node. This deadlocks (remember the above thread
is holding onto the leaf lock and awaiting the supernode lock. This thread is holding onto
the supernode lock and awaiting the leaf lock).

This is all exacerbated by the use of recursive locks.
2016-05-03 15:56:38 -07:00
appleguy
dd4853bf3a Merge pull request #1273 from aaronschubert0/tvOS
[tvOS] Add default focus states to ASControlNode & ASImageNode.
2016-04-20 13:29:31 -07:00
appleguy
b8379a07a6 Merge pull request #1563 from maicki/FollowupFixASCollectionNodeASTableNodeBackgroundColor
Follow up for ASCollectionNode and ASTableNode background color fix
2016-04-19 18:11:28 -07:00
Michael Schneider
42174210c5 Follow up for ASCollectionNode and ASTableNode background color fix 2016-04-19 16:07:42 -07:00
Garrett Moon
0fc39d1ccd Follow up to animated GIF PR 2016-04-19 13:43:41 -07:00
appleguy
39da0987a3 Merge pull request #1537 from maicki/FixASCollectionNodeASTableNodeBackgroundColor
Fix ASTableNode / ASCollectionNode backgroundColor does not apply correctly.
2016-04-19 12:30:54 -07:00
Michael Schneider
3793dc024e Improve setting special properties for certain classes directly to the UIView
- Remove duplicated code in ASCollectionNode and ASTableNode
- Fix setting the pending state to the view if applying the pending state to the view
2016-04-19 10:50:22 -07:00
Vivian Qu
ccb5860c78 Update ASSentinel to use OSAtomicAdd32 to support iOS7.0 2016-04-19 10:46:55 -07:00
Aaron Schubert
21abe8f899 Fix merge conflicts 2016-04-19 09:02:07 +01:00
Michael Schneider
9d07336c75 Fix static analyzer issue with common indexes algorithm in _asdk_commonIndexesWithArray:
The issue was: The left operand of '>=' is a garbage value in else if check for lengths[i+1][j] ... I had to rewrite the algorithm to quiet the static analyzer.
2016-04-18 14:38:32 -07:00
appleguy
30a0c471ca Merge pull request #1528 from ejensen/instancetype
[Refactoring] Replace id with instancetype in initializers
2016-04-16 20:53:41 -07:00
Huy Nguyen
3dc2ceb0ad Remove ASDisplayNodeExtraIvars 2016-04-15 21:48:11 +03:00
Garrett Moon
24c26014a7 Fix example builds 2016-04-13 14:23:02 -07:00
Eric Jensen
527397ba7e Replace id with instancetype in initializers 2016-04-13 11:20:05 -07:00
Scott Goodson
8ccef1e99f [ASEnvironment] Fix incomplete gating of upward propagation of layout properties (disabled for now). 2016-04-11 20:34:24 -07:00
appleguy
74407d50c4 Merge pull request #1513 from maicki/NodesLayerInLayerAccessiblity
[ASDisplayNode] Add handling layer backed accessibility elements within layer backed nodes
2016-04-11 17:46:19 -07:00
Michael Schneider
45d50624d1 Fix disabled state propagation for final layoutable 2016-04-11 17:41:48 -07:00
Michael Schneider
2fade63f1b Add handling layer backed accessibility elements within layer backed nodes 2016-04-11 12:59:04 -07:00
Michael Schneider
ed0ed74b72 Add switch to enable / disable layout option properties 2016-04-10 15:04:49 -07:00
Scott Goodson
974d8c8817 [ASEnvironmentState] Don't upward-propagate sizeRange or layoutPosition (this behavior, if ultimately desirable, requires additional limiting conditions). 2016-04-10 01:31:32 -07:00
appleguy
7c4db3fbc1 Merge pull request #1477 from maicki/SmallContentBatchFetch
[ASBatchContext] Fix fetch call won't occur for content smaller than bounds unless user scrolls
2016-04-09 19:15:06 -07:00
Michael Schneider
28c4fede57 Add support for newly added a11y properties in iOS 8 / 9 and tvOS
New a11y properties:
- accessibilityNavigationStyle
- accessibilityHeaderElements
- accessibilityActivationPoint
- accessibilityPath
2016-04-09 11:23:25 -07:00
Michael Schneider
f3303c1fb8 Add properties for accessibilty to ASDisplayNode to support layer backed nodes 2016-04-09 11:23:25 -07:00
Michael Schneider
9c29d0efa8 Initial commit for improved accessibility support 2016-04-09 11:23:25 -07:00
Michael Schneider
be26f0c2e5 Revert back to use UIKit version to prevent animations 2016-04-09 10:55:52 -07:00
Michael Schneider
bb110ca6e8 Readd ASDisplayShouldFetchBatchForContext 2016-04-09 10:55:52 -07:00
Michael Schneider
24ca09ee6c Move most of the batch fetching logic to a central place for ASTableView and ASCollectionView usage 2016-04-09 10:55:52 -07:00
Michael Schneider
c25a252e1c Fix fetch call won't occur for content smaller than bounds unless user scrolls 2016-04-09 10:55:52 -07:00
Levi McCallum
6f41d28dd0 Fix issue where zero was returned on idential object array lookup
Reviewers: scottg, schneider, garrett

Reviewed By: garrett

Subscribers: jenkins

Differential Revision: https://phabricator.pinadmin.com/D84131
2016-04-08 16:35:40 -07:00
Levi McCallum
2cb6969c79 Use unsigned integers for findNodes vectors
Summary: Also refector logic and naming to be simpler and more descriptive

Reviewers: schneider, chris, scottg

Reviewed By: schneider, chris, scottg

Subscribers: chris, jenkins

Differential Revision: https://phabricator.pinadmin.com/D83911
2016-04-08 10:41:49 -07:00
Michael Schneider
27cc2bec82 Add merging ASEnvironmentStateExtensions on upward propegation 2016-04-05 14:22:32 -07:00
Michael Schneider
41eb1917e4 Fix setting ASEnvironmentStateExtensions values 2016-04-05 14:22:32 -07:00