437 Commits

Author SHA1 Message Date
Michael Schneider
5226879291 Some commit 2016-11-19 06:43:45 -08:00
Michael Schneider
bc0443db02 Don’t floor space between items for ASStackLayoutJustifyContentSpaceBetween and ASStackLayoutJustifyContentSpaceAround 2016-11-17 18:05:22 -08:00
Adlai Holler
da465bf812 Merge pull request #2624 from facebook/HTDeprecateTableViewDelegates
[ASCollectionNode, ASTableNode] Deprecate asyncDelegate & asyncDataSource Properties
2016-11-17 18:41:41 +09:00
Hannah Trosi
6565b8348d collectionView 2016-11-17 16:46:07 +09:00
Adlai Holler
00f448d534 Merge pull request #2623 from facebook/AssertLog
[ASDisplayNode] Convert assertion to log so developer can see layout issues onscreen.
2016-11-17 14:55:44 +09:00
Scott Goodson
8c01fccfca [ASDisplayNode] Convert assertion to log so developer can see layout issues onscreen.
In this case, the user hasn't specified enough about the layout of a node.  We default to
0, 0 - but ideally the case should not occur at all.  So it's important to help developers
detect these cases and fix them quickly.

An assertion causes developers several problems:
- They can't see important information unless an exception breakpoint is manually added.
- They can't see their layout onscreen and so visually understanding the problem is impossible.
- They can't proceed with testing to trigger other faults in the layout and are blocked fixing one at a time.

A log fixes every one of those problems:
- They can set a breakpoint on the log line very easily if desired.
- They can see their layout display and recognize the 0,0 node even more quickly than the log text information.
- They can see if multiple logs print out, or if the log only occurs for one item in a feed, or certain types --
    This helps them debug faster by knowing if the layout is always broken or certain conditions break it.

Since developing with ASLayoutSpecs is an iterative process, it's crucial that we let developers have the
freedom to experiment and test without hitting too many assertions.  Fortunately it will be impossible to ignore
these huge logs (full recursive description) and their nodes will be 0, 0 size, so they will get fixed.
2016-11-16 21:14:15 -08:00
Adlai Holler
4a48ba8be2 Improve our event logging greatly 2016-11-17 12:04:30 +09:00
Adlai Holler
e2e32870ed Reduce Flashing & Optimize ASTableNode/ASCollectionNode Data Loading (#2541)
* Optimize data controller loading by combining section updates with first set of item updates

* Update call pattern test

* Add some explanation about the approach
2016-11-14 14:30:41 +09:00
Michael Schneider
44aa582ceb Fix crash if batch update blocks are nil although method declaration allows nullable (#2599) 2016-11-14 10:15:11 +09:00
Adlai Holler
171cc2f527 Improve Automatic Subnode Management Node Ordering (#2589)
* Add failing tests for subnode ordering

* Ensure that subnode ordering matches layout spec tree ordering
2016-11-10 09:22:53 +09:00
Adlai Holler
88fecbe3eb Fix Issue in ASPagerNode Flags Handling, Restore Disabled Test (#2582)
* Fix ASPagerNode flags handling, restore affected test

* Rejigger ASPagerNode's flag handling to ensure it handles edge case in production
2016-11-09 14:20:07 +09:00
Adlai Holler
5c15869087 Disable Text Node Fast Path (#2581)
* Disable text node fast path

* Actually commit the test change
2016-11-09 10:25:02 +09:00
Huy Nguyen
fb6d1830a0 Beter table/collection update history (#2562)
- Introduce thread-safe ASEventLog
- ASCollectionNode and ASTableNode share their event log with their ASDataController. The controller uses it to log change set submitting and finishing events.
- ASCollectionNode and ASTableNode print their data source and delegate in their debug description.
2016-11-08 16:44:49 -08:00
Scott Goodson
d3e942acf7 [Build] Disable failing test in ASViewController until it can be investigated. 2016-11-08 15:25:05 -08:00
Luke Parham
2754af3858 added index of page with node method to ASPagerNode along with some tests (#2561) 2016-11-07 16:07:54 -08:00
Garrett Moon
68990cb6cc Deprecations should be re-enabled. If there are specific deprecations… (#2519)
* Deprecations should be re-enabled. If there are specific deprecations we'd like to hold off on, we should address those specifically.

* Fix decleration

* Move select to undeprecated

* Fix deprecations
2016-10-31 17:30:40 -07:00
Michael Schneider
4464b7de60 Improve deprecation situation for 2.0 (#2514)
* Improve deprecations for 2.0

- Add deprecations for node / layoutSpec style properties
- Implement missing methods on ASDisplay from deprecation header
- Cleanup all of the deprecation categories

* Remove DeprecatedProtocolMethods

* Fix "Life without Cocoapods"

* Update comments
2016-10-31 16:46:21 -07:00
Adlai Holler
3eb7a307fa Share a singleton shadower for all cases when shadow isn't drawn, fix issues (#2511) 2016-10-30 15:34:29 -07:00
Tamás Kárai
ca203158da [ASControlNode] Invoke target actions in the same order as they were added (#2456)
* added control node test

* fix tests

* target action pair

* go back to class

* move ASControlTargetAction to Private

* added ASControlTarget to cimpole sources

* add ASControlTargetAction to framework target as well

* init local variables with nil

* removed comment with private Apple class name

* isEqual implementation for ASControlTargetAction

* eliminate retain cycle

* use ASControlTargetAction isEqual

* change to NSMutableOrderedSet

* Use OrderedSet and isEqual

* Use that NSMutableOrderedSet stored the same object only once

* Moving back to NSMutableArray

* minor improvements
2016-10-30 11:44:50 -07:00
Adlai Holler
f066efd49e Improve Table Performance, Especially When Using Section Index Bar (#2506)
* Only trigger table view height requery if row-node height changed

* Make ASTableView handle the section index bar better

* Remove outdated comment

* Add a main thread assertion
2016-10-30 09:18:13 -07:00
Michael Schneider
c4451edab1 Add assertion for invalid constrainedSize in calculateSizeThatFits: (#2507) 2016-10-28 16:45:22 -07:00
Michael Schneider
fb92b448e0 [ASDisplayNode] Proper handling of constrainedSize (#2505)
* Check in ASLayout if size is valid for sizing instead of valid for layout

* Return constrainedSize from calculateSizeThatFits:

Remove invalid constrainedSize check within ASNetworkImageNode. Furthermore as ASDisplayNode does not return CGSizeZero anymore we have to give the display nodes we use in tests and are involving a stack spec an intrinsic content size.

* Remove extra constrainedSize handling in ASNetworkImageNode handling

* Change test to use FLT_MAX
2016-10-28 15:39:03 -07:00
Adlai Holler
8add4619cf Reduce Traffic to Table/Collection View When Updating (#2496)
* Improve the call pattern when loading table/collection data

* When deleting sections, no need to delete rows first

* Clean up a couple things
2016-10-28 09:42:45 -07:00
george-gw
54cda5fdbb [ASCellNode] Added indexPath property. (#2468)
* [ASCellNode] Added indexPath property.

* [ASCellNode] Cached the type of scrollView we're using in the node, and placed that logic in setScrollView.

* [ASCellNode] Removed table and collection view from indexPath, since they return the index paths from the view-space.

* Changed the logic for getting indexPath so that it works even when the cell is not displayed.

* [VerticalWithinHorizontalScrolling] Explicitally synthesized indexPath property.
2016-10-27 16:56:00 -07:00
Michael Schneider
021f5ebdbb Add initial snapshot tests for ASWrapperSpec (#2482) 2016-10-27 16:27:09 -07:00
Michael Schneider
eb6cf0689d Only throw if ASLayoutElement style width or height are ASDimensionUnitFraction (#2484) 2016-10-26 17:17:09 -07:00
george-gw
ea9d785180 Call reloadData if necessary when accessing specific methods. (#2479)
Added test case.
2016-10-26 11:38:21 -07:00
Adlai Holler
0d439a43b6 [ASTextNode] Add Fast-Paths For Text Measurement and Drawing (#2392)
* Add test case for TextKit truncation style

* Add fast path for text node measurement with default truncation

* Use fast path more often

* Reverse options order

* Simplify implementation – no functional change

* Share "isScaled" variable

* Intersect with constrained rect

* Add a failing test case for fast-path truncation

* Add some more truncation tests, using slow path as reference image

* Update the tests

* In ASTextKitRenderer, intersect bounds with constrained rect

* Add test case for TextKit truncation style

* Add fast path for text node measurement with default truncation

* Use fast path more often

* Reverse options order

* Simplify implementation – no functional change

* Share "isScaled" variable

* Intersect with constrained rect

* Add a failing test case for fast-path truncation

* Add some more truncation tests, using slow path as reference image

* Update the tests

* In ASTextKitRenderer, intersect bounds with constrained rect

* Use maximumNumberOfLines property in text kit fast path

Add reference images

Disable fast-path for max-one-line case

* Remove unneeded snapshot files
2016-10-24 17:05:59 -07:00
george-gw
3638feffd4 Added selection API to ASTableNode and ASCollectionNode (#2453)
* Added selection API to ASTableNode and ASCollectionNode (#2450)

* Updated test case to use collectionNode instead of collectionView for the selection tests.

* Fixed typos.
Added asserts for main thread.
Updated ASCollectionViewTests for multiple selections for nodes.

* Added assigns to the different properties.
2016-10-24 09:30:09 -07:00
appleguy
2c6f8b0506 [AsyncDisplayKit 2] Final changes to ease migration of clients to 2.0 APIs. (#2460) 2016-10-21 13:12:13 -07:00
Hannah Troisi
e87ac54138 disable flaky table thrash test (#2458) 2016-10-21 12:43:51 -07:00
Hannah Troisi
9719357901 [ASLayoutElement] Move ASDisplayNode's .name property to ASLayoutElement (renamed to .debugName) (#2395)
* Move ASDisplay .name property to ASLayoutElement

* keep ASDisplayNode.name deprecated

* address @appleguy's comments
2016-10-20 17:27:31 -07:00
Adlai Holler
41c0781aa9 Update exception test for new constrainedSize method (#2445) 2016-10-20 14:41:11 -07:00
Michael Schneider
4b914f8e15 Add preferredSize as getter to ASLayoutElementStyle (#2427) 2016-10-19 12:55:19 -07:00
Adlai Holler
67489492ee Fix Uncalled Collection Delegate Methods (#2433)
* Fix batch fetching

* Fix not calling constrainedSizeForItemAtIndexPath:

* Fix constrainedSizeForItemAtIndexPath: not being called
2016-10-19 11:49:49 -07:00
Michael Schneider
6fcbf642c9 Remove all 3x snapshot test images (#2417) 2016-10-18 13:12:24 -07:00
Michael Schneider
ba80b83695 [ASRelativeLayoutSpec] Fix ASRelatativeLayoutSpec behavior for ASRelativeLayoutSpecPositionStart (#2393)
* Fix ASRelatativeLayoutSpec behavior for ASRelativeLayoutSpecPositionStart

* Add updated images for snapshot tests
2016-10-18 12:00:01 -07:00
Adlai Holler
6e76daf279 [Layout] Check Layout Spec Tree for Duplicated Elements (#2408)
* Check layout spec tree for duplicated elements

* Enable layout spec tree dedupe only in debug
2016-10-18 09:33:37 -07:00
Adlai Holler
925e343e32 Make ASNetworkImageNode test wait (#2406) 2016-10-17 11:28:48 -07:00
Adlai Holler
0ed8ecb677 Test and improve the ASNetworkImageNode progress block handling (#2386) 2016-10-15 17:50:16 -07:00
Adlai Holler
c2ea7cfeac [Umbrella] ASCollectionView -> ASCollectionNode Migration, Separate Index Spaces (#2372)
* Separate dataSource & UIKit index spaces

Beef up our supplementary node support

Make the API way better

Go nuts

Add a unit test for UICollectionView's handling of reloadData inside batch updates

Wrap indexPathForNode: in a cache

Convert index paths in delegate methods

Go back on table view

Put collection view back

Switch up the API

Move most ASCollectionView API to ASCollectionNode

Move most table logic over to ASTableNode

Do the things

More conversion work

Keep on keepin' on

Get table view delegate API done

More porting

Simplify

Clear the delegate

More cleanup

Move more stuff around

Remove pointless file

Re-add some API

Put back more API

Use the right flag

* Some cleanup

* Remove incorrect comment

* Tweak the API

* Put back a couple methods

* update example projects (note: ASCollectionView deprecation warnings expected)

* change reloadDataWithCompletion:nil --> reloadData

* Clean up rebase

* Make deprecated numberOfItemsInSection methods optional

* Use the right flag

* Address nits

* update ASDKTube, ASDKgram & ASViewController examples
2016-10-14 17:21:16 -07:00
Adlai Holler
fb768683bc Fix test method name (#2380) 2016-10-14 09:58:32 -07:00
Michael Schneider
8f8df537d2 Rename ASRelativeSize to ASLayoutSize (#2369) 2016-10-11 16:36:40 -07:00
Michael Schneider
507bc55504 [Layout] Add ASLayoutElementStylability protocol (#2366)
* Add ASLayoutElementStylability protocol

* Rename to styledWithBlock:, add instancetype and add noescape
2016-10-11 09:16:18 -07:00
Michael Schneider
6f2c7caac3 [Layout] Improve ASDimensionMake via NSString (#2351)
* Improve ASDimensionMake via NSString

- ASXCTAssertEqualDimensions
- Add support for "auto"
- Assert if given an empty or invalid string

* Address comments

* Add ASCGFloatFromString and ASCGFloatFromNumber

* Rename CGRect+ASConvenience to CoreGraphics+ASConvenience
2016-10-06 16:29:33 -07:00
Michael Schneider
94f958c4a3 [Layout] Treat flex factors as true factors (#2349)
* Treat flex factors as factors

* Add snapshot tests

* Address comments
2016-10-06 16:53:26 -04:00
Michael Schneider
271ab20de5 Fix ASDimension creation of type ASDimensionUnitFraction via a NSString (#2347) 2016-10-05 18:30:24 -07:00
Adlai Holler
bb366d14f0 [ASCellNode] Restore Layout Attributes Fix + iOS 10 Modification (#2335)
* [ASCellNode] Fix applyLayoutAttributes not called, add readonly layoutAttributes property (#2321)

* Clear cell node layout attributes in didEndDisplayingCell: also
2016-10-05 17:31:46 -04:00
Michael Schneider
d6e5e27c39 [Layout] Add helper properties for setting sizes via CGSize and ASRelativeSize (#2324)
* Remove set layout style size helper

* Update API to set and get a CGSize / ASRelativeSize from an ASLayoutElementStyle

- Expose ASRelativeSize type
- Add new helper properties to set a size / relative size to ASLayoutElementStyle
- Don't expose the size in ASLayoutElementStyle anymore and move into ASLayoutElementStylePrivate

* Update examples

* Update comments for size helpers
2016-10-04 12:35:45 -04:00
Adlai Holler
0a2e35af38 [ASCollectionView] Allow User to Submit Updates Before Initial Data Load (#2337)
* Add tests for how UICV/ASCV will throw if you update before the initial data load

* Allow user to submit updates before initial data load to workaround UICollectionView bug

* Add some info
2016-10-03 19:13:50 -04:00