50 Commits

Author SHA1 Message Date
Ethan Nagel
bf0766169b PR Feedback: Require main thread for all edit commands, various cleanup. 2015-07-20 22:08:19 -07:00
Ethan Nagel
f497639124 Add support automatically adjusting the content offset to UITableView as well as support for performing endUpdates with no animations. Additionally, there are critical bug fixes for ASDataController (begin/end updates delegates not called in correct order) and ASRangeController (failure to fully refresh internal state when inserts or delete are made.) 2015-07-20 14:05:56 -07:00
Ethan Nagel
9762e7cfe6 short-circuit editing calls after the asyncDataSource has been set to nil (ASTableView) 2015-07-16 20:26:28 -07:00
appleguy
58a55f035d Merge pull request #529 from facebook/DataControllerQueues
Overhaul ASDataController and extensively test ASTableView.
2015-07-04 21:06:34 -07:00
Scott Goodson
8fa092fb77 Complete overhaul of ASFlowLayoutController.
Introduced ASIndexPath for efficient handling of index paths in C++ vectors,
while maintaining the readability of ".section" and ".row" instead of
".first" and ".second" inside of complicated business logic.

Confirmed that the working range calls are firing appropriately during
ASTableViewStressTest, including the deallocation of the rich text placeholders
provided by ASTextNode.
2015-07-04 20:22:04 -07:00
Ethan Nagel
4963a88717 Propagate ASCellNode's clipsToBounds value to the __ASTableViewCell. This helps work around a bug we are seeing in some rare cases (selected background view overlaps other cells if size of ASCellNode has changed.) 2015-06-29 21:22:55 -07:00
Scott Goodson
57465c7fd3 Overhaul ASDataController and extensively test ASTableView.
This diff resolves all known consistency issues with ASTableView and ASCollectionView.
It includes significantly more aggressive thrash-testing in ASTableViewStressTest,
which now passes on a variety of device and simulator configurations.  It also updates
the unit tests run on every commit to ensure any regression is caught quickly.

A few of the salient changes in this diff:
- ASTableView now uses Rene's ASCollectionViewLayoutController, and actually uses a
UICollectionViewFlowLayout without any UICollectionView.  This resolves an issue where
ASFlowLayoutController was generating slightly out-of-bounds indicies when programmatically
scrolling past the end of the table content.  Because the custom implementation is likely
faster, I will revisit this later with profiling and possibly returning to the custom impl.
- There is now a second copy of the _nodes array maintained by ASDataController.  It shares
the same node instances, but this does add some overhead to manipulating the arrays. I've
filed a task to follow up with optimization, as there are several great opportunities to
make it faster.  However, I don't believe the overhead is a significant issue, and it does
guarantee correctness in even the toughest app usage scenarios.
- ASDataController no longer supports calling its delegate /before/ edit operations.  No
other class was relying on this behavior, and it would be unusual for an app developer to
use ASDataController directly.  However, it is possible that someone with a custom view
that integrates with ASDataController and ASRangeController could be affected by this.
- Further cleanup of organization, naming, additional comments, reduced code length
wherever possible.  Overall, significantly more accessible to a new reader.
2015-06-28 18:03:45 -07:00
Scott Goodson
06cfe68cbd Clean up ASDataController for readability & API naming consistency. 2015-06-27 11:06:54 -07:00
Ethan Nagel
ae523f4fce better logic for detecting when the pending index path is before or after the visible index paths 2015-06-25 09:53:36 -07:00
Ethan Nagel
baf91b4a45 validate that _pendingVisibleIndexPath is contiguous with visibleIndexPaths before appending it. Also, always return a sorted array of NSIndexPaths 2015-06-24 13:18:12 -07:00
Ethan Nagel
0e37bff7c1 Revert to using a single NSIndexPath for the pending visible item 2015-06-24 13:13:43 -07:00
Scott Goodson
c700618862 Improvements to thread safety during closely spaced edit events.
This applies primarily when beginUpdates / endUpdates is not used.
Due to user interaction-driven edits, like reloads or adding content
at the bottom, sometimes this is unavoidable in app design and thus
critical.

I have a diff in flight to make ASDataController / ASRangeController
robust against very aggressive thrash testing, which will be added
both to the unit test suite and this new example project.
2015-06-21 21:04:09 -07:00
Scott Goodson
ba5a6e15c0 Disable asyncDataFetching in ASTableView and ASCollectionView init methods.
It's currently unreliable for some use cases that issue editing calls while
content is displayed or being interacted with.  The performance gain is not
sufficient to sacrifice correctness for the clients that hit this issue,
so it will remain off until fully resolved.
2015-06-14 19:59:39 -07:00
appleguy
8043e36bf6 Merge pull request #430 from eanagel/astableview-programmatic-scrolling-fix-v2
Bug Fix - ASTableView sometimes fails to render cell contents when scrolling programmatically.
2015-05-21 12:54:19 -10:00
appleguy
7e50f05dfd Merge pull request #445 from levi/master
Prevent UITableView insertion/deletion animations by default
2015-05-21 12:49:48 -10:00
Levi McCallum
c8ea73b1fe Communicate conditionals clearly and document methods 2015-05-18 20:03:14 -07:00
appleguy
bf84d52bec Merge pull request #443 from eanagel/astableview-in-xib
Allow ASTableView to be loaded in a xib/storyboard
2015-05-16 23:00:50 -10:00
appleguy
d3e4db2c5c Merge pull request #444 from levi/patch-1
Fix typo in ASTableView
2015-05-13 22:55:24 -10:00
Ethan Nagel
d9acd7bb84 More fixes to catch/handle the delegate getting into an invalid state. These changes will allow setting tableView.asyncDataSource/delegate = nil. (Previously this would have no effect in dealloc thanks to ARC magic). Also added some defensive code to help identify the problem earlier. 2015-05-13 11:00:37 -07:00
Ethan Nagel
58402b6af0 change the order we tear things down in setAsyncDelegate/DataSource to avoid a random crash in UIScrollViewAccessibility. 2015-05-12 12:11:05 -07:00
Levi McCallum
1530ef2841 Prevent UITableView insertion/deletion animations by default
Fixes #292
2015-05-07 21:53:38 -07:00
Levi McCallum
4619457a1e Fix typo in ASTableView 2015-05-07 14:51:03 -07:00
Ethan Nagel
a38cf3ef37 Merge branch 'master' into astableview-in-xib 2015-05-05 09:31:31 -07:00
Ethan Nagel
c81f5d08fc refactor ASTAbleView initialization code so it also gets initialized when starting from initWithCoder: 2015-05-04 08:51:25 -07:00
Ethan Nagel
68e2e068c3 Bug Fix - ASTableVie sometimes fails to render cell contents when scrolling programatically. Root cause is because we assume UITableView's indexPathsForVisibleRows return the new item to be displayed after tableView:willDisplayCell:forRowAtIndexPath: is called. This is not always true, especially when we are scrolling programmatically. Fix is to track this "pending" visible index path and return it along with the UITableView's indexPathsForVisibleRows in rangeControllerVisibleNodeIndexPaths:. 2015-04-17 16:09:44 -07:00
Ethan Nagel
3f509dbd2f add completion block to reloadData methods 2015-03-26 16:32:44 -07:00
Nadine Salter
a79b771a85 Remove the nil-asyncDelegate proxy.
Fixes #349.
2015-03-11 17:43:45 -07:00
Ryan Nystrom
6588e7b665 Make data locking API optional 2015-03-04 10:13:32 -08:00
Ryan Nystrom
c657411a2e Batch fetch with small data sets 2015-02-26 22:29:13 -08:00
Ryan Nystrom
8d7fe334e2 Revisions based on feedback 2015-02-26 22:29:13 -08:00
Ryan Nystrom
b3ae15858a Unit tests for batch fetching 2015-02-26 22:26:25 -08:00
Ryan Nystrom
1f8001a104 ASCollectionView batch API 2015-02-26 22:24:46 -08:00
Ryan Nystrom
09ade3dd00 ASTableView batch API and context object 2015-02-26 22:23:32 -08:00
Ryan Nystrom
4fa03a01d1 Functioning Preload range
Refactor how we do ranges so they can be arbitrarily managed. Introduce the concept of a preload range.
2015-02-26 15:41:32 -08:00
Ryan Nystrom
9c877c51af Support for dynamic ranges
This refactors how we do ranges and implements tuning parameters for a "Render" range and a "Preload" range
2015-02-26 15:40:21 -08:00
Li Tan
831aa47ae0 Address comments 2015-02-11 19:15:08 -08:00
Li Tan
6a2c472910 Add asyncDataFetchingEnabled as parameter of initializer of ASTableView & ASCollectionView
Conflicts:
	AsyncDisplayKit/ASCollectionView.mm
	AsyncDisplayKit/Details/ASDataController.mm
2015-02-11 17:24:49 -08:00
Li Tan
2f88ce56a2 Move ASTableView & ASCollectionView data fetching to background thread
Conflicts:
	AsyncDisplayKit/ASCollectionView.mm
	AsyncDisplayKit/Details/ASDataController.mm

Conflicts:
	AsyncDisplayKit/ASCollectionView.mm
	AsyncDisplayKit/Details/ASDataController.mm
2015-02-11 17:22:43 -08:00
Li Tan
25bdd0d84d remove program 2015-02-06 11:44:40 -08:00
Li Tan
08bb0b5d70 remove throw umimplemented exception 2015-02-04 11:55:38 -08:00
Li Tan
b5245f7cd4 Fix group update 2015-02-04 11:49:39 -08:00
Ryan Nystrom
e6506899cb Code format cleanup 2015-01-29 10:12:12 -08:00
Dustin Shahidehpour
94cd785870 Added node access methods to ASTableView, ASCollectionView. 2015-01-26 13:57:04 -08:00
Ryan Nystrom
afb21bf8dd Default proxy object for ASTableView and ASCollectionView
fixes #231 #233
2015-01-20 13:15:39 -08:00
Li Tan
1068fdc413 Fix table view 2015-01-08 16:22:53 -08:00
Li Tan
00e2f46c8d Add batch animation 2015-01-08 16:09:27 -08:00
Ryan Nystrom
0473ed0a44 Consistent curlies on methods 2014-12-29 14:18:35 -08:00
Li Tan
3c0d4b2c42 Remove bachUpdate and begin/endUpdate 2014-12-19 08:48:10 -08:00
Li Tan
9367ccc19c Remove bachUpdate and begin/endUpdate 2014-12-18 20:35:27 -08:00
Li Tan
fee3892f95 use asyncDisplayNodePerformOnMainThread 2014-12-18 18:13:01 -08:00