4229 Commits

Author SHA1 Message Date
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
Hannah Troisi
ea09ad75ef [Sample] Move example screenshot assets to AsyncDisplayKit/docs repo (#3058)
* move example app screenshot assets to AsyncDisplayKit/docs repo & update links

* Update README.md

* Update README.md

* Update README.md
2017-02-22 10:32:51 -08:00
appleguy
36538996c7 [Yoga] Fix ASLayout hierarchy to only include immediate subnodes. (#3054)
This patch also adds ASEdgeInsetsZero, and one fix to passthrough of UIKit Supplementary Views.
2017-02-21 16:47:07 -08:00
Garrett Moon
75fddb1f77 Upgrades to latest PINRemoteImage which should fix GIF rendering. (#3057) 2017-02-21 11:43:36 -08:00
Garrett Moon
4e779eeed8 Need to set defaultImage, not image if we're a network image node. (#3041) 2017-02-17 13:16:57 -08:00
Adlai Holler
b616248c20 Majorly Improve automaticallyAdjustsContentOffset (#3033)
* Majorly improve automaticallyAdjustsContentOffset

* Remove nodes from ASDataControllerDelegate & ASRangeControllerDelegate

* Do it after -endUpdates
2017-02-15 11:57:39 -08:00
Jason Yu
8e18f1562c [TextKit] Fix text layout issue for CJK laungages (#3026)
* [TextKit] Fix text layout issue for CJK laungages

* [ASTextKitContext] Delay filling _textStorage with attributedString until calling addLayoutManager.
2017-02-15 11:54:55 -08:00
Garrett Moon
a6e74900c0 Hopefully this makes the comment clearer (#3036) 2017-02-15 10:56:33 -08:00
Vadim Novoseltsev
b6935448d6 selectedBackgroundView (#2875) 2017-02-15 10:37:45 -08:00
Adlai Holler
6af131b093 Undeprecate -[ASCollectionView indexPathForNode:] (#3032) 2017-02-14 22:31:24 -08:00
Adlai Holler
a4c6d8912e Don't Skip Remeasurement On First Layout Pass (#3031)
* Don't Skip Remeasurement if Initial Bounds are Zero

* Remove misleading unit test
2017-02-14 16:28:26 -08:00
Adlai Holler
fab98b32ef Fix Pager Node Issues (#3028)
* Fix pager node and deprecate zeroContentInsets flag

* Do it with the visible state callback

* There we are

* Put viewController in node debug description
2017-02-14 14:10:51 -08:00
Michael Schneider
aecd36a4df [ASViewController] Support optional node (#3021)
* ASViewController can be used without a node
- If a node isn't provided by developers via -initWithNode:, a default one will be created and used internally.
- This allows developers to use ASViewController like a normal UIViewController and as a base class for all view controllers among which some use a node hierarchy and some don't.

* Update ASDKgram to use a shared base ASViewController

* Minor fixes in ASViewController:
- If its node isn't provided by users, don't replace the view controller's view with the default node's view because it might be loaded from a nib.
- Init a vanilla ASDisplayNode if a node isn't provided.

* Some smaller cleanup

* Remove dummy node for ASViewController if it’s used without a node
2017-02-14 13:18:59 -08:00
Adlai Holler
cd448a105e Add lock on ASTextNode.attributedText (#3025) 2017-02-13 15:03:57 -08:00
Rocir Santiago
1bf8488a0f Safer checks in ASDisplayNode’s setFrame before assigning bounds and position (#2773)
* Safer checks in ASDisplayNode’s setFrame before assigning bounds and position

* Consolidate checks in one place

* Assert with ASDisplayNodeNonFatal

* Allow position to be negative
2017-02-13 13:35:37 -08:00
Adlai Holler
bbc1aecf95 Deprecate shouldRasterizeDescendants (#3024)
* Deprecate shouldRasterizeDescendants

* Set superclass right
2017-02-13 13:34:53 -08:00
appleguy
fe0bcec98f [NSArray+Diffing] Use heap-based allocation for array diff. (#2926)
This avoids compiler warnings when using the strictest clang settings.
It also ensures that stack overflow can't occur even with the largest datasets.
2017-02-13 10:43:46 -08:00
Calum Harris
7205ea0448 [Examples] Add ASDKgram-swift to examples_extra (#2910)
* add ASDKgram-swift to examples_extra

* Refactor ASDKgram-Swift as suggested by Adlai-Holler
2017-02-13 10:42:47 -08:00