Commit Graph

4846 Commits

Author SHA1 Message Date
Michael Schneider
d0ad24808b Fix setting selectedBackgroundView in collection view (#3131) 2017-03-06 07:19:44 -08:00
Michael Schneider
2df392261e [ASVideoPlayerNode] Fixes and improvements (#3135)
* Improvements for ASVideoPlayer, especially around asset handling and API

* Change legacy URL of videos

* Address comments
2017-03-05 19:28:03 +00:00
Adlai Holler
f5951d906e Use fast enumeration for ASElementMap enumerating (#3137) 2017-03-04 15:18:41 -08:00
Adlai Holler
fad40c26c2 Remove ASTableView's pendingVisibleIndexPath system (#3125) 2017-03-04 12:52:28 -08:00
Adlai Holler
2785a0bcd8 Pager should invalidate flow layout metrics on bounds change (#3133) 2017-03-04 11:01:09 -08:00
Adlai Holler
0de270fdfb Revert "Improve designated initializer usage (#3132)"
This reverts commit eaa875c7f2.
2017-03-03 15:31:28 -08:00
Michael Schneider
eaa875c7f2 Improve designated initializer usage (#3132)
* Improve designated initializer usage

* Some more changes

* Add some whitespace

* Fix some warning
2017-03-03 14:49:34 -08:00
Michael Schneider
62d7e14ce1 Improve measurement code for cell nodes (#3119) 2017-03-03 09:24:04 -08:00
Adlai Holler
93809bd4e7 Add a Convenience Property to Get Owning View Controller (#3076)
* Add a convenience property -closestViewController

* Address comments
2017-03-02 11:51:16 -08:00
Adlai Holler
012b378a22 Fix a Compiler Warning from ASAbstractLayoutController.mm (#3123)
* Fix a compiler warning about ASAbstractLayoutController

* Fix merge
2017-03-02 10:59:26 -08:00
Adlai Holler
9c7081f2d7 Majorly Simplify ASTableLayoutController (#3124)
* Majorly Simplify ASTableLayoutController

* Remove the setVisibleNodeIndexPaths: API
2017-03-02 10:59:13 -08:00
Huy Nguyen
415005b6fc ASStackLayoutSpec utilizes multiple threads if it runs on main (#3116) 2017-03-02 10:12:53 -08:00
Adlai Holler
bccfc6c779 Don't Load Table/Collection Node Just Because User Updated (#3120)
* Allow user to update collection/table without forcing view to load

* Capture animation enabledness
2017-03-02 10:11:30 -08:00
Michael Schneider
62c5138676 [ASDisplayNode] Fix node is showing up as black box if wrapping an UIActivityIndicatorView (#3121)
* Set the node to not opaque if it’s wrapping an UIActivityIndicatorView

* Add check for subclass of UIVisualEffectView to see if the node needs to be opaque
2017-03-02 08:57:17 -08:00
Adlai Holler
18dc91ccc2 Remove ASRangeController's viewport API (#3122) 2017-03-02 08:38:01 +00:00
appleguy
edd2ce98f7 [ASRangeController] Optimize calls into UICollectionViewLayout via union rect technique. (#3102)
Details in https://github.com/facebook/AsyncDisplayKit/issues/3082
2017-03-01 21:06:18 -08:00
appleguy
f7dbb2013e [ASCollectionView] Interop mode should always call sizeForItem: method for index paths that don't use ASCellNodes. (#3115) 2017-03-01 19:57:51 -08:00
Garrett Moon
40d3a1de7a Trying to set the progress block with a nil identifire doesn't make sense. (#3117) 2017-03-01 19:51:16 -08:00
Michael Schneider
67baa44fb5 Fix -Wdocumentation warnings (#3113) 2017-03-01 11:25:37 -08:00
Michael Schneider
71ebf6b029 Fix ASImageDownloaderProtocol method that changed (#3108) 2017-03-01 11:13:19 -08:00
Garrett Moon
06b0cba68d It doesn't appear that this method needs to be protected by thread affinity? It has locking and is backed by an ivar, not UIKit. (#3107) 2017-03-01 10:57:18 -08:00
Michael Schneider
a08d9dc732 Fix warning (#3104) 2017-02-27 21:25:42 -08:00
Michael Schneider
1c1a1468d8 Remove all _cellsForLayoutUpdates after relayout pass happened (#3103) 2017-02-27 20:20:32 -08:00
Michael Schneider
973630adc6 [ASCellNode] New way to measure ASCellNode's if layout was invalidated (#3099)
* New way to informing interaction delegate if ASCellNode get’s a setNeedsLayout call

* Remove nodeDidGetNeedsLayout as optional and better check if cell updates need to happen

* Differentiate between letting a normal display node and a cell node know that the size could have changed

* Check for _interactionDelegate is nil

* Add nullability to out pointer

* Adress comments and some renaming
2017-02-27 17:19:01 -08:00
Adlai Holler
8b08b706b2 Make ASCellNode Visibility Accesses Thread-Safe (#3100)
* Make ASCellNode visibility accessing thread-safe

* Strong types!
2017-02-27 17:03:08 -08:00
Adlai Holler
25bc97c5c8 Fix Issues Repopulating Supplementary Elements (#3098)
* Fix issues repopulating supplementary elements

* Remove unrelated change

* Update comments
2017-02-27 16:06:06 -08:00
Adlai Holler
774f3ffa9e Remove declaration of ASPhotosFrameworkImageRequest.isEqual (#3097) 2017-02-27 14:32:42 -08:00
Marvin Nazari
a9a3e8e40c [IGListKit] Search example (#3047)
* Search example with IGListKit

* Cleanup

* updated to use new class methods [ASIGListSectionControllerMethods]
2017-02-27 12:52:48 -08:00
Andy Madan
c7888672c8 Fix cell selection state issues (#3081)
Resolves #3037

This is a do-over of c85aa11, with the following differences:
- Fixed `_ASTableViewCell` properties **always** being mutated to match corresponding `ASCellNode` passthrough properties, even when the hosted `ASCellNode` is currently `nil`. Now only inheriting passthrough properties when there’s an actual instance of `ASCellNode` to read them from.
- Corrected spelling of `ASCellNode`’s `separatorInset` property.
- Reverted `_ASCollectionViewCell` inheriting the hosted cell node’s `backgroundColor` & `clipsToBounds` properties. This seems to be surprising and unwanted behavior to some, as seen in #3053 and #3044.
- Moved passthrough of `UITableViewCell`’s `selectedBackgroundView` into `_ASTableViewCell`’s `-setNode:` for consistency.
2017-02-27 12:02:14 -08:00
Adlai Holler
7763356b8a Replace IGListKit Method Macros with Actual Methods (#3094)
* Replace IGListKit macros with methods

* Remove docs in impl

* Update example
2017-02-27 11:08:39 -08:00
Huy Nguyen
9876875d4f Allow users to set (primary) child directly on overlay and background specs (#3092) 2017-02-27 09:16:34 -08:00
Huy Nguyen
421a896713 Clean up snapshot test cases (#3091)
* Clean up snapshot test cases:
- Drop 32bit snapshots
- Update iOS 9 snapshots and move some others to the correct directory
- Remove `setUp` overrides in subclasses of `ASLayoutSpecSnapshotTestCase` that set `recordMode` flag. Doing so in multiple places make it difficult to enable/dis
able the flag for all layout spec test cases. It can always be overridden locally if need
to.
- Fix BUCK build

* Fix testThatOnDidLoadThrowsIfCalledOnLoadedOffMain of ASDisplayNodeTests
2017-02-27 09:14:40 -08:00
Huy Nguyen
dc23aca30d Fix crashes in ASElementMap and ASMutableElementMap (#3090)
* Fix crashes in ASElementMap and ASMutableElementMap

* testInitialRangeBounds to have a 10% maximum difference
2017-02-27 09:07:23 -08:00
Adlai Holler
73ca6ab514 Shuffle & Cleanup Stuff (#3080) 2017-02-26 18:14:13 -08:00
Huy Nguyen
e48edef4e7 [ASStackLayoutSpec] Implement flex wrap (#2914)
* Implement flex wrap

* Add tests for content alignments

* Revert unnecessary changes

* More flex wrap tests

* Define FB_REFERENCE_IMAGE_DIR in scheme

* Clean up ASStackPositionedLayout
2017-02-26 11:48:32 -08:00
appleguy
61cab6f643 [ASCollectionView] Allow mixing supplementaryViews and Nodes by relaxing assertions. (#3079)
These changed recently with the addition of the ability to provide nodeBlocks.

It might be more strict to assert that nil can't be provided unless the datasource supports
inter-op, but I think it is also pretty reasonable to just use an empty ASCellNode in this case.

Either way, I'm really amazed / surprised to see all the improvements that appeared in ASDataController!
2017-02-25 14:51:36 -08:00
Adlai Holler
2fd487b447 Add collectionNode:nodeBlockForSupplementaryElementOfKind:atIndexPath: (#3078)
* Add optional support for nodeBlockForSupplementaryElementOfKind:

* Update example

* Update harder
2017-02-24 18:47:01 -08:00
Adlai Holler
9c82ae9284 Add ASRectTable (#3077) 2017-02-24 16:38:17 -08:00
Adlai Holler
1775bf29f5 ASDataController: Adopt ASElementMap (#3073)
* Build ASElementMap and use it

* Keep building!

* Clean up

* Restrict ASDataController subclassing

* Clean up more

* More rearranging

* Dear lord it's time for bed

* Make things clearer

* Sadly remove subclassing restriction for ASDataController

* Remove dead initializer
2017-02-24 13:23:29 -08:00
Garrett Moon
42a2959f1f The 'ol [nil isEqual:nil] is NO… (#3075)
* The 'ol [nil isEqual:nil] is NO…

* Ah, this is better, thanks @Adlai-Holler!
2017-02-24 10:55:26 -08:00
Huy Nguyen
704d2adf40 [ASDisplayNode] Avoid holding instance lock while calling layout subclass hooks (#3064)
* Fix deadlock occurs during layout of ASDisplayNode that triggered a change set update in ASDataController

* Access _transitionInProgress ivar directly if already locked
2017-02-24 10:09:39 -08:00
appleguy
5b31cd6631 [ASRunloopQueue] Improve logging output of runloop queue when enabled. (#3072) 2017-02-24 10:03:38 -08:00
Adlai Holler
9f45788594 ASDataController: Eliminate Mutable State (#3071)
* Finish renaming

* ASDataController: Reduce mutable state

* Update comments
2017-02-23 15:37:21 -08:00
Huy Nguyen
230bfb578e Support native item and section reloads (#3066) 2017-02-23 14:57:43 -08:00
Garrett Moon
bf2ed841c2 Don't keep clearing the image if it's already been cleared. (#3069) 2017-02-23 13:10:39 -08:00
Adlai Holler
1d21c0bd55 Clean up actionForLayer:forKey: (#3063) 2017-02-23 11:32:01 -08:00
Garrett Moon
6a9781f64c Update for 2.2 (#3068) 2017-02-23 11:09:54 -08:00
Adlai Holler
6ab92dbd3f Prevent Adding View-Backed Nodes to Layer-Backed Hierarchies (#3062)
* Prevent adding view-backed nodes to layer-backed nodes

* Do that in a different diff

* Fix the message

* Update tests

* Fix the fix
2017-02-22 17:48:13 -08:00
Adlai Holler
86dd918143 Promote ASIndexedNodeContext -> ASCollectionElement (#3061)
* Remove indexPath field from ASIndexedNodeContext

* Rename ASIndexedNodeContext -> ASCollectionItem

* Name it ASCollectionElement
2017-02-22 16:55:02 -08:00
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