98 Commits

Author SHA1 Message Date
Scott Goodson
5b9302b681 Revert "Prevent deallocation of asyncDataSource and asyncDelegate in ASCollectionView and ASTableView"
This reverts commit 3668f45286a56a87d200aea0299caee9d2e4a880.
2016-03-22 14:38:50 -07:00
Scott Goodson
953c0f51f0 Revert "Move call of range update completion blocks to consider early returns in _updateVisibleNodeIndexPaths"
This reverts commit 41362fca3942b71cb092376e5baaa78652d1e19b.
2016-03-22 14:37:49 -07:00
Michael Schneider
41362fca39 Move call of range update completion blocks to consider early returns in _updateVisibleNodeIndexPaths 2016-03-22 12:43:09 -07:00
Michael Schneider
3668f45286 Prevent deallocation of asyncDataSource and asyncDelegate in ASCollectionView and ASTableView
Grab a strong reference for asyncDataSource and asyncDelegate in ASCollectionView and ASTableView before executing the range update to be sure they are not going away while executing the range update. This can happen in range updates while going back in the view controller hierarchy
2016-03-22 08:09:59 -07:00
appleguy
d9ef0922d8 Merge pull request #1354 from ejensen/cleanup
[Refactoring] Objective-C 2.0 / Modern syntax for arrays, dictionaries, numbers; logic simplification
2016-03-17 01:06:33 -07:00
appleguy
2ad9d83520 Merge pull request #1353 from ejensen/spelling
[Documentation] Correct spelling errors
2016-03-16 22:53:15 -07:00
Michael Schneider
e297608e2a In the first range update and the range mode is not explicitly use the automatic range mode detection
This is necessary to get out of the initial range mode state into the first defined range mode state
2016-03-16 16:44:58 -07:00
Michael Schneider
41ca796ef4 Improve logic around choosing the range mode automatically and update documentation around logic 2016-03-16 13:37:33 -07:00
Michael Schneider
d3ba80ccfd Improvements for automatic range mode
- Only update range mode if visibility changes if the node is not range controlled
- Only change explicitly set range mode if ASRangeController becomes visible
- Return interface state for range controller in ASCollectionView and ASTableView based on if the containing node is range managed
2016-03-16 11:44:56 -07:00
appleguy
b30fa8b2f6 Merge pull request #1373 from maicki/FullRangeModeOnScroll
[ASRangeController] Go into full range mode if a scroll happens
2016-03-16 11:33:43 -07:00
Eric Jensen
33fda7ab49 - Use modern Objective-C syntax.
-  Simplify comparisons.
-  Remove dead stores.
2016-03-15 22:34:29 -07:00
Eric Jensen
ddd5ff1f75 Correct spelling errors 2016-03-15 21:56:51 -07:00
Hannah Troisi
7f6ce4e9de [ASMultidimensionalArrayUtils]
- optimized ASRecursivelyFindIndexPathsForMultidimensionalArray() to remove enumerateUsingBlock:
- replaced single project call to ASIndexPathsForMultidimensionalArray() in ASRangeController with ASIndexPathsForTwoDimensionalArray()
2016-03-14 22:47:43 -07:00
Michael Schneider
13aa891ecf Improve way to go into full mode on scroll 2016-03-12 17:45:09 -08:00
Scott Goodson
f97a509541 [ASRangeController] Ensure that even if the collection view layout is inconsistent, it is impossible for a visible item to not be in the display range. 2016-03-12 16:26:33 -08:00
Michael Schneider
b4b9f0750c Improve going into full range mode on scroll 2016-03-12 16:21:29 -08:00
Michael Schneider
e4ddb7e270 Go into full range mode if a scroll happens 2016-03-12 15:44:27 -08:00
Scott Goodson
cdd1bd1e39 [ASRangeController] Ensure that visibilityDidChange: is always called on app launch for all initial cells. 2016-03-11 17:18:32 -08:00
Scott Goodson
ff8ffffb7b [ASCellNode] Upgrades to ASCellNodeVisibilityEvent to ensure it is always synchronized with visibilityDidChange: 2016-03-10 20:21:00 -08:00
Scott Goodson
0e460ca00a [ASRangeController] Don't bother asking UIKit for the visible index paths if view is zero-sized, as it triggers a reloadData. 2016-03-10 19:10:25 -08:00
Scott Goodson
c3fb665ec1 [ASWeakSet] Support -allObjects to return a retained array of contents.
Use this array while enumerating ASRangeController instances in response to UIApplication notifications,
as it is possible for these events to trigger the mutation of the ASWeakSet and cause an enumeration error.
2016-03-10 16:20:21 -08:00
Scott Goodson
21bebb9d29 [ASRangeController] Improvements to application state change and memory warning handling.
Introduces ASLayoutRangeModeVisibleOnly, allowing the preservation of decoded backing stores without any extra padding to
strictly minimize memory usage while supporting immediate re-display of content.  Set visible range controllers to this mode
upon app suspend / memory warning, while more aggressively clearing others to the ASLayoutRangeModeLowMemory mode.

By default, when the app is running and recieves a memory warning, we set the range mode for non-visible controllers to
ASLayoutRangeModeVisibleOnly.  This is because, unlike in the app suspend case where on app resume we can restore controllers
from LowMemory to VisibleOnly, the memory warning doesn't provide a good opportunity to do this.

A new +Beta API to control this behavior is called +setRangeModeForMemoryWarnings:, as some apps may prefer to use LowMemory
in the memory warning scenario.  For these apps, optimal user experience will require manually setting the range mode back
to some larger value as the user navigates the app, or they will encounter controllers that are temporarily blank and need
a moment to re-display their contents as they start to become visible.
2016-03-09 21:22:45 -08:00
Scott Goodson
27b8bcc3c6 [ASRangeController] Support observing UIApplicationState methods, notifying cells of invisibility & freeing memory on backgrounding. 2016-03-09 19:22:57 -08:00
Michael Schneider
f45d4ac4fb Cleanup code 2016-03-09 18:56:39 -08:00
Michael Schneider
13207dc2da Change memory notification method name 2016-03-09 14:53:37 -08:00
Michael Schneider
bf822dee37 Add ASLayoutRangeModeLowMemory 2016-03-09 14:40:40 -08:00
Michael Schneider
568aa6c2fb Update automatic range mode at the beginning of the update pass to consider new information in a possible next pass 2016-02-29 11:39:50 -08:00
Michael Schneider
aca5b14c2b Move automatic range update to a private API 2016-02-29 11:39:50 -08:00
Michael Schneider
60889f555e Add API to update the current range mode of a table or collection view range controller 2016-02-29 11:39:49 -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
Michael Schneider
28207c678d Remove ASRangeHandler protocol with all classes that implement it
With the move to the new ASRangeController we don't need the ASRangeHandler protocol anymore
2016-02-08 12:57:05 -08:00
Michael Schneider
026761c610 Rename ASRangeControllerBeta to ASRangeController and use exclusively 2016-02-07 15:03:24 -08:00
Michael Schneider
5d474bcb1a Remove ASDisplayNode -shouldUseNewRenderingRange method and ASRangeControllerStable class 2016-02-07 15:03:23 -08:00
Huy Nguyen
e5e34313ed ASRangeController (stable) doesn't handle visible range now because the range is gone 2016-02-04 16:52:33 -08:00
Huy Nguyen
19335d8c9e Add rangeMode APIs 2016-02-02 11:58:18 -08:00
Huy Nguyen
69e674c1c8 Range controller registers to rendering engine and extern to full range if needed 2016-02-02 01:23:04 -08:00
Huy Nguyen
0b188c7a95 Add minimum tuning params 2016-02-01 16:24:19 -08:00
Huy Nguyen
56c6bd681b Revert "Revert commit 83aaa46, thus bring 2e4d716 back"
This reverts commit 209425c22ce84ecbb7ab631753ec8fc34dd9cbb0.
2016-01-26 12:05:02 -08:00
Huy Nguyen
209425c22c Revert commit 83aaa46, thus bring 2e4d716 back 2016-01-24 23:38:05 -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
Adlai Holler
a19ba586f7 Revert change that seems to have caused internal inconsistency in range controller 2016-01-13 13:34:20 -07:00
Scott Goodson
b273f358f5 [ASRangeController] Initial implementation of functional-style, ASInterfaceState-based range controller. 2016-01-01 00:48:44 -08:00
Scott Goodson
ffcddf36e2 Ensure that ASRangeController immediately removes any deleted nodes from its range state. 2015-12-30 22:42:11 -08:00
Scott Goodson
936730d46b ASInterfaceStateVisible is now being driven by a new ASRangeHandlerVisible. 2015-11-29 13:24:42 -08:00
Levi McCallum
e05c4b7419 Separate range controller delegate methods into separate data source 2015-11-19 16:01:38 -08:00
Levi McCallum
09a2e086b0 Clean up syntax and method ordering in ASRangeController 2015-11-19 14:03:53 -08:00