69 Commits

Author SHA1 Message Date
Huy Nguyen
74c6cca0b6 [ASDataController] Refactor ASDataController (#3017)
* Refactor ASDataController

Check optional methods in ASDataControllerSource

* Reimplement reloadData

* Refactor new code
- No more new/inserted contexts flag
- Encapsulate code shared between reloadData and updateWithChangeSet
- Remove dataControllerWillDeleteAllData delegate method
- Hierarchy changes no longer needs to conform to NSCopying
- Reword TODOs

* Forgot to call completion block of reloadData :P

* Completion block of -[ASDataController reloadDataWithCompletion:] is nullable

* Data queried from ASCollectionNode and ASTableNode should be in UIKit index space
- This helps to avoid immature node allocation, especially when node virtualization is a thing
- However, this means that -reloadDataInitiallyIfNeeded in ASCollectionNode and ASTableNode must wait until all updates are finished.

* ASDataController shouldn't assume that allocated nodes were also laid out

* Revert "Data queried from ASCollectionNode and ASTableNode should be in UIKit index space"

This reverts commit 7bc977b3808a92f484b297781d0f5b30aa258e17.

* -nodeAtIndexPath: of ASDataController now forces node allocation, with the assumption that clients absolutely need it.
- Revisit this when node virtualization is implemented.

* ASDataController only grab changeSet.completionHandler when needed because it'll be niled out

* Fix ASTableViewTests related to reloadData

* Fix testThatDeletedItemsAreMarkedInvisible in ASCollectionViewTests

* Minor changes in ASCollectionView and ASTableView

* ASCollectionView and ASTableView shouldn't call [super reloadData] before their data controller does anything

* Address comments

* Fuse reloadData into -updateWithChangeSet: of ASDataController

* reloadData shouldn't be called as if it's inside a batch
- It can't be used in conjuntion with other updates.
- Calling it inside a batch update during the initial load can cause data inconsistency thrown by UICollectionView/UITableView

* Refactor ASDataControllerDelegate and ASRangeControllerDelegate
- Replace delegate methods in these protocols with -willUpdateWithChangeSet and -didUpdateWithChangeSet.
- ASRangeController, ASCollectionView and ASTableView are simplified because of this.

* Fix mismatch between sorting orders in ASDataController

* Forgot to call completion handler of reload change sets

* Make sure ASCollectionView is compatible with the behavior of UICollectionView's reloadData
- Since UICollectionView's reloadData doesn't requery data source but defers until the next layout pass,  we need to wait until then to update range controller and do batch fetching.
- `-[ASCollectionView waitUntilAllUpdatesAreCommited]` needs to force a layout pass to make sure
everything is ready after it returns.

* testSectionIndexHandling of ASTableViewTests should only check visible nodes. Other nodes will be re-measured later.

* ASTableView is not ready until the first layout pass finished

* Address comments

* Bug fixes
2017-02-22 13:50:07 -08:00
Vadim Novoseltsev
b6935448d6 selectedBackgroundView (#2875) 2017-02-15 10:37:45 -08:00
Saif Al-Dilaimi
c85aa11dbb Adding section to passthrough properties (#2847)
* added accessoryType to ASCellNode

* Moved the passthrough properties in an own section in ASEditableTextNode

* added documentation and reverted ASEditableCellNode changes

* fixed code signing

* adding seperatorInset property as a passthrough property

* revert changes to project file

* moved setting properties to setNode:

* moved clipsToBounds to setNode
2017-01-09 18:26:51 -08:00
Adlai Holler
2f7925544b Add a failing unit test for the automatic subnode management range issue (#2826) 2016-12-28 11:22:43 -06:00
Marvin Nazari
31ffea40c2 [ASCellNode] implement a .viewController property 2016-11-17 11:26:55 +01: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
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
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
Scott Goodson
a25f4a7b85 Revert "[ASCellNode] Fix applyLayoutAttributes not called, add readonly layoutAttributes property (#2321)"
This reverts commit f9ee1dd4b6b4d8a062c5453623bc6fde1840cd91.

This appears to have caused a test failure:
https://travis-ci.org/facebook/AsyncDisplayKit/jobs/164532435
2016-10-02 19:36:06 -07:00
Adlai Holler
f9ee1dd4b6 [ASCellNode] Fix applyLayoutAttributes not called, add readonly layoutAttributes property (#2321) 2016-09-29 16:41:28 -04:00
Adlai Holler
ce1d21dc63 [ASCellNode] Document cell node event callback behavior for plain-node cases (#2281) 2016-09-23 13:30:30 -04:00
David Rodrigues
70574243f7 Prevent API misuse at compile time (#2035)
Using Objective-C attributes, in this case `unavailable`, we can hide
unsupported APIs at compile time instead of detecting and warn about it
at runtime with a set of asserts.
2016-08-04 19:00:46 -07:00
Hannah Troisi
f5b3a282af Fix Pinterest Xcode 7.3.1 Analyzer Warnings (#1988) 2016-07-27 08:23:16 -07:00
Hannah Troisi
abf8d5b9aa [Infer] change atomic properties to nonatomic (#1932) 2016-07-16 10:46:55 -07:00
Michael Schneider
e30c76c5ad Remove deprecated selected and highlighted methods (#1909) 2016-07-13 10:13:31 -07:00
Hannah Trosi
f6d30b668d add comments to deprecated getter methods, remove extraneous if statements 2016-07-05 21:30:09 -07:00
Hannah Trosi
7ddef95946 fix compile errors 2016-06-25 01:05:23 -07:00
Hannah Trosi
2e4b1ea053 [ASCellNode] Fix selection / highlight implementation 2016-06-25 00:22:28 -07:00
Hannah Troisi
da27d36b4a Add comments 2016-06-18 12:54:55 -07:00
Hannah Troisi
46421f8684 [ASCollectionView] support UICollectionViewLayoutAttributes 2016-06-17 10:17:52 -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
Scott Goodson
5289b1e11e [ASCellNode] Restore new enum values that should have been part of the last commit, but were lost by rebasing. 2016-06-04 22:21:00 -07:00
Adlai Holler
ea777456b6 [ASCellNode] Apply layout delegate behavior in -__setNeedsLayout, not -setNeedsLayout 2016-04-22 12:07:37 -05:00
Eric Jensen
057ec55941 Correct documentation comments 2016-03-24 20:08:03 -07:00
Eric Jensen
b733936133 Improve Swift compatibility of ASCellNodeVisibilityEvent by using NS_ENUM macro 2016-03-21 11:10:28 -07:00
Eric Jensen
ddd5ff1f75 Correct spelling errors 2016-03-15 21:56:51 -07:00
Huy Nguyen
1dffc20e4d Address documentation of ASCellNodeVisibilityEvent 2016-03-01 15:56:08 -08:00
Huy Nguyen
c64f23725f Update ASCellNode visibility API 2016-02-29 20:26:16 -08:00
Michael Schneider
45c616d916 Improve ASTextCellNode customization 2016-02-26 06:31:09 -08:00
Adlai Holler
afc70b90ab [ASCellNode] Improve documentation, remove unused ivar 2016-02-22 15:10:02 -08:00
Scott Goodson
d899f12f70 [ASCellNode] Layout delegate should not be public as it must not be reset externally.
Do not call layout delegate method before the cell node is loaded.  This can happen if
application code calls -setNeedsLayout on the cell manually, and can confuse UIKit state
because we submit an empty batch update call on the next runloop.
2016-02-20 15:24:44 -08:00
Max Gu
115fc2b3da Adding visibility monitoring for ASTableVieww 2016-02-19 22:15:44 -08:00
Max Gu
382509fac8 Letting ASCellNode and its subclasses handle didScroll 2016-02-19 21:30:36 -08:00
Max Gu
53cbd643de Removing ASCellNode+Internal 2016-02-19 14:56:02 -08:00
Max Gu
274029a5e0 Removing an unnecessary property 2016-02-19 13:02:02 -08:00
Max Gu
650b500f92 Merge branch 'master' of https://github.com/Xinchi/AsyncDisplayKit 2016-02-19 12:52:03 -08:00
Max Gu
03446d97e1 Adding scroll visibility 2016-02-19 12:46:12 -08:00
Max Gu
75eab1db07 Adding scroll visibility 2016-02-18 18:00:37 -08:00
Adlai Holler
69767d558e Merge branch 'master' into update-objc
Conflicts:
	AsyncDisplayKit/Private/ASDisplayNode+FrameworkPrivate.h
2015-12-22 00:28:21 -05:00
Luke Parham
322caaeb6a wip after review 2015-12-21 01:24:46 -06:00
Luke Parham
6cbc51dc61 cleaned up comments 2015-12-16 23:44:17 -06:00
Luke Parham
eeb49859f0 view controller node is resized to match layoutspec for cells 2015-12-09 13:13:39 -06:00
Adlai Holler
b16a9e294e Merge branch 'master' into update-objc
Conflicts:
	AsyncDisplayKit/ASDisplayNode+Subclasses.h
2015-12-06 12:25:13 -08:00
Adlai Holler
0ee1fd82dc Refactor nodeDidRelayoutWithSizeChange: -> nodeDidRelayout:sizeChanged: 2015-11-30 19:29:27 -08:00
Adlai Holler
04d93532bc Only require node sizes once per run loop, and only if a node's size has changed 2015-11-30 17:20:32 -08:00
Adlai Holler
ab326fc683 touchesCancelled:withEvent: has a nullable touches argument in UIKit for some reason 2015-11-13 12:17:17 -08:00
Adlai Holler
7922895b60 (Re?)add type annotations on touchesBegan:withEvent: et al 2015-11-13 12:11:24 -08:00
Adlai Holler
762be97a51 Merge branch 'master' into update-objc 2015-11-13 12:03:30 -08:00
Adlai Holler
bfe3040f57 Update nullability in ASCellNode.h 2015-11-09 10:10:37 -08:00
Huy Nguyen
a6807ef477 Address comments in #793 2015-11-04 16:53:36 +02:00