111 Commits

Author SHA1 Message Date
Hannah Troisi
2afd063b10 [ASRangeController] Debug overlay to show the size and direction of display + fetchData ranges during scrolling. (#2008)
* Rebase ASRangeController diff with master.

* fix Table / CollectionNode debug label names
- now returns class names rather than generic ASTableNode, ASPagerNode
- ASPagerNode will be labeled as ASPagerNodeProxy (not sure how to get around this)

* refactor layout code: use ASDk's own resizeableRoundedCorner... methods

* Fixes and cleanup for manual layout version of range controller debug overlay.

I am working on a layout spec-based version, but it has some issues, so landing this to get the near-term value is probably the best next step.

* Remove .orig and .rej files.

* One last .orig file to remove.

* Final project file cleanup and tweaks to implementation for ASTableNode.

* fix build issues

* fix arrow directions
2016-08-11 11:23:07 -07:00
Adlai Holler
1fbf8ad073 [ASDataController] Cancel if we lose our data source, fix bugs (#1987)
[ASRangeController] We're already on main thread, remove blocks

Make data source read-only, clarify what's asynchronous

[ASDataController] Clean up some interfaces

[ASDataController] A little more cleanup

[ASDataController] Cleanup

[ASDataController] Restore some changes, exit more often

[ASDataController] Use item counts that we already have rather than requerying them

[ASDataController] Revert weakifications

[ASDataController] Add a mechanism to measure how much work we avoided
2016-08-05 15:39:33 -07:00
Yue-Wang-Google
b59e368b71 [PATCH] Fix capitalizations in imports. 2016-07-27 14:17:56 -07:00
Adlai Holler
7ec6f07953 [General] Remove dead code, check optional protocol selector before calling (#1970) 2016-07-22 13:09:28 -07:00
Adlai Holler
bd0254f306 [ASRangeControllerUpdateRangeProtocol] BREAKING Remove +setRangeModeForMemoryWarnings:, replace with global method 2016-07-14 11:26:18 -07:00
Adlai Holler
edb4e45c24 [ASRangeController] Update synchronously when possible 2016-07-12 14:36:20 -07:00
Scott Goodson
f0ff9c108d Merge branch 'master' of git://github.com/kielgillard/AsyncDisplayKit into kielgillard-master 2016-07-09 15:44:31 -07:00
Huy Nguyen
312de1a084 Make sure range controller listens to node display notifications if absolutely needed 2016-07-08 12:09:47 +07:00
Kiel Gillard
6a15ab6130 * Tidy the header imports, forward declaring classes and protocols where appropriate to avoid import cycles and using the framework/system header notation for imports occuring in .h files.
* Perhaps controversially, decomposing ASRangeControllerUpdateRangeProtocol+Beta.h such that the categories on various classes are defined in the classes themselves since that's where the implementation of those categories is provided.
* Updating unit tests and import other headers the tests took for granted. The tests could probably import the umbrella header and not have to worry about this.
* Updating the "Life without Cocoapods" sample to build and run dependent on ASDK as a static library.
* Added a "Life With Frameworks" sample app to build and run dependent on ASDK as a framework, proving the framework targets work.
2016-07-07 15:12:19 +10:00
Nick Velloff
a05d3119ad [WIP] Trigger new batch fetch for collection view after layout transitions (#1697)
[Table / Collection] Trigger new batch fetch after programmatic scrolls, or layout transitions.
2016-06-22 16:21:10 -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
Luke Parham
fc5467b110 fixed typo and added backwards compatibility for 'visibilityDidChange' 2016-06-06 02:02:23 -05:00
Luke Parham
e510120031 changed '-visibilityDidChange:' to '-visiblieStateDidChange:' to match the others 2016-06-06 00:56:21 -05:00
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