Commit Graph

556 Commits

Author SHA1 Message Date
Peter
d1ab6976b5 Merge commit 'a08d9dc7328bef8cfc1b50b36cc05edb09af25a3'
# Conflicts:
#	AsyncDisplayKit.xcodeproj/project.pbxproj
#	AsyncDisplayKit/ASPagerFlowLayout.m
#	AsyncDisplayKit/AsyncDisplayKit.modulemap
#	AsyncDisplayKit/Details/ASCollectionDataController.h
#	AsyncDisplayKit/Details/ASCollectionDataController.mm
#	AsyncDisplayKit/Details/ASDataController.mm
#	AsyncDisplayKit/Private/ASDataController+Subclasses.h
#	AsyncDisplayKit/module.modulemap
#	Source/Debug/AsyncDisplayKit+Debug.h
#	Source/Details/ASCollectionElement.mm
#	Source/module.modulemap
2017-03-01 15:57:40 +04: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
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
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
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
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
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
Peter
6b0454ccf5 Merge commit 'ec59c3161adb37d4b5b908019250dddce1c27d84'
# Conflicts:
#	AsyncDisplayKit/Debug/ASLayoutElementInspectorCell.h
#	AsyncDisplayKit/Debug/ASLayoutElementInspectorCell.m
#	AsyncDisplayKit/Debug/ASLayoutElementInspectorNode.m
#	AsyncDisplayKit/Details/ASFlowLayoutController.h
#	AsyncDisplayKit/Details/ASFlowLayoutController.mm
2017-02-11 17:00:16 +03:00
Michael Schneider
2dca7a0c8d [Debug] Remove not used code around visualizing layout specs (#2991)
* Remove not used code around visualizing layout specs

* This is sad to see but let’s remove the LayoutSpecPlayground for now
2017-02-10 13:09:09 -08:00
appleguy
f91265757e [Yoga] Initial commit for supporting Yoga-powered layout calculation. (#2982)
* [Yoga + AsyncDisplayKit] Initial commit for supporting Yoga-powered layout calculation.

Because this results in ASLayout objects, it preserve support for automaticallyManagesSubnodes
as well as the animated transition system. More work remains to vet performance of the new mode,
and it will remain in +Beta for the forseeable future.

I'm not sure that this should ever be used as the primary ASDK layout system, but it should remain an
option for some apps to experiment with if they require an implementation that more strictly mirrors
W3C standard Flexbox.

* [Yoga] Improve usage of ASHierarchyState to ensure simultaneous yoga layouts can't happen.

* [Yoga] Strictly minimize the impact of the Yoga integration on existing code.

Created new file ASDisplayNode+Yoga.mm, reduced size and number of integration points in core code.

* [Yoga] Figured out how to further reduce ASDisplayNode.mm impact by allocating _yogaNode in property accessor, and changing all accesses to use the property.
2017-02-09 16:10:29 -08:00
Adlai Holler
a13b36d63f Allow UICollectionViewLayout to Provide Layout Inspector, Always Update Delegate (#3003)
* Allow UICollectionViewLayout to give us a layout inspector, always call the didChangeDelegate/didChangeDataSource on binding

* Make an assertion

* Update the tests

* Tests use actual layout inspector

* Be more consistent
2017-02-08 22:03:13 -08:00
Scott Goodson
1adfb005ca [Build] Tiny fix to cast intValue to the enume type we're using it as (strict compiler settings can fail without the cast). 2017-02-08 20:30:28 -08:00
Michael Schneider
d2da941960 Fix some static analyzer warnings (#2999) 2017-02-07 10:33:34 -08:00
Adlai Holler
abd9851ddd Restore IGListKit Build & Function (#2988) 2017-02-06 20:00:22 -08:00
Adlai Holler
e4c9878de7 Fix the CI (#2992) 2017-02-06 14:45:07 -08:00
Scott Goodson
f71eba77af [ASCollectionView] Finish support for interoperability with base-class UICollectionViewCells.
This also supports supplementary nodes. It builds off of Adlai's .interop flag but makes necessary
improvements for all of the delegate methods to work in practice with heterogenous cell types.
2017-02-04 20:40:44 -08:00
Michael Schneider
12e4e5b048 [Layout] Improve Layout System Abstraction (#2941)
* Improve Layout Abstraction

* Address naming comments

- Rename ASPrimitiveTraitEnvironment to ASTraitEnvironment
- Rename ASPrimitiveTraitCollectionPropagateDown to ASTraitCollectionPropagateDown
- Rename progagateNewPrimitiveTraitCollection: to propagateNewTraitCollection:
2017-02-03 13:04:20 -08:00
Peter
e7b34f5811 Merge commit '404795dc02aa57b167223bfaee7c380907022ca1'
# Conflicts:
#	AsyncDisplayKit.xcodeproj/project.pbxproj
#	AsyncDisplayKit/ASCellNode+Internal.h
#	AsyncDisplayKit/ASCellNode.mm
#	AsyncDisplayKit/ASCollectionNode+Beta.h
#	AsyncDisplayKit/ASCollectionNode.mm
#	AsyncDisplayKit/ASCollectionView.mm
#	AsyncDisplayKit/ASCollectionViewProtocols.h
#	AsyncDisplayKit/ASDisplayNode.mm
#	AsyncDisplayKit/ASMultiplexImageNode.h
#	AsyncDisplayKit/ASMultiplexImageNode.mm
#	AsyncDisplayKit/ASNavigationController.m
#	AsyncDisplayKit/ASNetworkImageNode.mm
#	AsyncDisplayKit/ASPagerFlowLayout.m
#	AsyncDisplayKit/ASPagerNode.m
#	AsyncDisplayKit/ASTabBarController.m
#	AsyncDisplayKit/ASTableNode.h
#	AsyncDisplayKit/ASTableNode.mm
#	AsyncDisplayKit/ASTableView.mm
#	AsyncDisplayKit/ASTableViewProtocols.h
#	AsyncDisplayKit/ASVideoNode.h
#	AsyncDisplayKit/ASVideoNode.mm
#	AsyncDisplayKit/ASVideoPlayerNode.mm
#	AsyncDisplayKit/ASViewController.mm
#	AsyncDisplayKit/Debug/ASLayoutElementInspectorCell.m
#	AsyncDisplayKit/Debug/ASLayoutElementInspectorNode.m
#	AsyncDisplayKit/Details/ASBasicImageDownloader.mm
#	AsyncDisplayKit/Details/ASBatchContext.mm
#	AsyncDisplayKit/Details/ASChangeSetDataController.h
#	AsyncDisplayKit/Details/ASChangeSetDataController.mm
#	AsyncDisplayKit/Details/ASCollectionDataController.mm
#	AsyncDisplayKit/Details/ASCollectionViewLayoutController.mm
#	AsyncDisplayKit/Details/ASCollectionViewLayoutInspector.m
#	AsyncDisplayKit/Details/ASDataController.mm
#	AsyncDisplayKit/Details/ASFlowLayoutController.h
#	AsyncDisplayKit/Details/ASFlowLayoutController.mm
#	AsyncDisplayKit/Details/ASIndexedNodeContext.mm
#	AsyncDisplayKit/Details/ASPhotosFrameworkImageRequest.h
#	AsyncDisplayKit/Details/ASPhotosFrameworkImageRequest.m
#	AsyncDisplayKit/Details/ASRangeController.mm
#	AsyncDisplayKit/Details/ASRangeControllerUpdateRangeProtocol+Beta.h
#	AsyncDisplayKit/Details/ASSectionContext.h
#	AsyncDisplayKit/Private/ASBatchFetching.m
#	AsyncDisplayKit/Private/ASCollectionView+Undeprecated.h
#	AsyncDisplayKit/Private/ASCollectionViewFlowLayoutInspector.h
#	AsyncDisplayKit/Private/ASCollectionViewFlowLayoutInspector.m
#	AsyncDisplayKit/Private/ASDisplayNode+UIViewBridge.mm
#	AsyncDisplayKit/Private/_ASPendingState.mm
#	examples/SocialAppLayout-Inverted/Sample.xcodeproj/xcshareddata/xcschemes/Sample.xcscheme
2017-02-02 11:46:47 +03:00
Adlai Holler
404795dc02 Remove Support for iOS 7 (#2930)
* Drop support for iOS 7

* Copy reference images

* Update deployment for sample projects

* Update version

* Update "Life Without Cocoapods"
2017-02-01 14:40:37 -08:00
Adlai Holler
d7670780b2 Fix Deleting Sections Issue (#2962)
* Add data source to main project

* Remove the idea of deletingSectionsOfKind – always delete all kinds

* Move comment into assertion
2017-01-31 15:39:10 -08:00
Hannah Troisi
7f7f28385d [ASNodeController] First implementation of node controller class (#2945)
* [ASNodeController] initial commit for node controller class

* create <ASInterfaceState> protocol, -[ASDisplayNode interfaceDelegate], and use these to forward to ASNodeController

* rename ASInterfaceStateDelegate, fix setting in it ASNodeController.mm
2017-01-31 14:27:02 -08:00
Adlai Holler
38aac9d019 IGListKit Support II: Electric Boogaloo (#2942)
* Reimplement IGListKit support in a cleaner way

* Rename and fix some stuff

* Fix supplementaries more

* Update docs

* Update test

* Cleanup minor things

* Tweak it

* Indentation

* Remove irrelevant changes

* Break out cell into its own file

* Fix indentation

* Address feedback
2017-01-30 11:16:59 -08:00
Michael Schneider
e143942d22 [ASDisplayNode] Overall code cleanup and restructuring (#2931)
* First round of ASDisplayNode cleanup: Move together sections that are related

* Cleanup hierarchy and interface state
2017-01-25 16:41:42 -08:00
appleguy
b8872c24db [AsyncDisplayKit] Fix a few comment typos and minor compiler strictness warnings. (#2932) 2017-01-25 12:53:13 -08:00
Huy Nguyen
38f1efd448 [ASDataController] Simplify data controller (#2923)
* Start removing ASChangeSetDataController

* Continue removing ASChangeSetDataController

* Remove unnecessary change

* ASDataController is no longer an abstract class, remove its assertion

* Get back beginUpdates and endUpdatesAnimated:completion in ASCollectionNode
2017-01-24 17:41:19 -08:00
Michael Schneider
d9be4783e5 [ASLayout] General Layout Cleanup (#2920)
* Remove duplicate import

* Move `ASLayoutController` related code out of CoreGraphics+ASConvenience

* Further cleanup

* Move private layout files to Privat/Layout

* Move ASLayoutElementStylePrivate into Private/Layout

* Further cleanup

* Move tvOS related files to tvOS folder

* Further cleanup
2017-01-24 11:54:05 -08:00
aaronschubert0
b3be451486 [ASTableNode/ASCollectionNode] Inversion (#2891)
* Add inverted property to ASTableNode

* Add inverted property to ASCollectionNode

* Add example

* De-inform data controller and use different CATransform3D

* Add logic to pending state

* Add accessor for inverted property
2017-01-19 18:16:01 -08:00
Huy Nguyen
6736367627 [ASStackLayoutSpec] Refactor baseline alignment algorithm (#2892)
* Add tests for baseline alignments

* Merge baseline alignment algorithm to the main stack algorithm
- Baseline alignment is now part of the main stack algorithm.
- ASStackBaselinePositionedLayout is no longer needed and removed.

* All snapshot test cases of ASStackLayoutSpec are passing now

* Remove baselineRelativeArrangement

* Remove TODO

* Minor fixes in cross size determination step
2017-01-18 11:12:10 -08:00
Peter
81076bdde4 Merge commit '89156ebbc750a2d28b8d4594ccad62ef4c73127e' 2017-01-18 02:13:01 +03:00
Michael Schneider
89156ebbc7 Add availability check for noescape attribute (#2897) 2017-01-13 11:32:33 -08:00
Huy Nguyen
c1157084ca Clean up ASStackPositionedLayout (#2817)
- Remove lastChildOffset. It's unncessary after #2627.
- Remove the version of `stackedLayout()` that takes 1 less param. Isn't worth the complexity.
2016-12-22 16:02:57 -05:00
Peter
c0b31e7eba Merge commit '7872cfb5a40c5483c23c810096f69d315d8b54bc'
# Conflicts:
#	AsyncDisplayKit/ASImageNode.mm
2016-12-22 03:21:26 +03:00
Adlai Holler
bdd1077c18 Use NS_ENUM for video enumerated types (#2819) 2016-12-21 13:30:16 -05:00
haritowa
64ee8dbffb [ASDisplayNode Deallocation] Fix for crash when certain types are used as instance variables. (#2803)
* Fix https://github.com/facebook/AsyncDisplayKit/issues/2802

* Change nil to NULL
2016-12-19 17:06:23 -05:00
Andrey Konstantinov
3cb1112440 [ASDisplayNode] Add nullability declarations in ASDisplayNodeInternal.h (#2721)
* Add nullability declarations in ASDisplayNodeInternal.h

Fixes #2701

* Use NS_ASSUME_NONNULL macros in ASDisplayNodeInternal.h

It reduce visual clutter and keep file in line with most other header
files.
2016-12-14 12:39:34 -05:00
appleguy
eeb977e145 [ASDisplayNode] Ensure all subclasses are using base class __instanceLock__ and not re-defining their own. (#2754)
* [ASDisplayNode] Ensure all subclasses are using base class __instanceLock__ and not re-defining their own.

This also moves the @package definition of the instance variable to +FrameworkPrivate instead of Internal.h,
because Internal.h should ideally not be used outside of the ASDisplayNode file setup.  This has greatly reduced
the number of imports of Internal.h.

* [ASDisplayNode] Add ASDisplayNode+FrameworkSubclasses.h to share __instanceLock__ definition.
2016-12-12 19:42:41 -08:00
Peter
a7c21c60a6 Merge commit '5b80a641afae4cee6dcf0e4cf5a829dffeb1e8d6' into debug-drawrect 2016-12-12 01:21:05 +03:00
Peter
a2ca258b6b Merge commit 'aec8dbfb33832cafdd183f5818ddb01c8b1c3997' into debug-drawrect 2016-12-12 01:07:18 +03:00
Peter
bef812c50b no message 2016-12-12 01:02:45 +03:00
Peter
3121ecf636 Merge commit 'd9209e69c25657586b43a72def4c5ac537956e40' into debug-drawrect
# Conflicts:
#	AsyncDisplayKit/ASCollectionNode.mm
#	AsyncDisplayKit/ASDisplayNode.mm
#	AsyncDisplayKit/ASTableNode.mm
#	AsyncDisplayKit/Details/ASCollectionViewFlowLayoutInspector.h
#	AsyncDisplayKit/Details/ASCollectionViewLayoutInspector.h
#	AsyncDisplayKit/Details/ASCollectionViewLayoutInspector.m
2016-12-12 01:02:23 +03:00
Peter
7bf7235e0c no message 2016-12-11 22:59:02 +03:00
Adlai Holler
5b80a641af Improve Handling of Rasterized Node Interface & Hierarchy States (#2731)
* Improve handling of rasterize node interface states and testing

* Fix harder

* Finish fixes and move rasterization flag into beta header

* Re-enable rasterization in ASDKgram

* Re-enable working test

* Only do it in debug
2016-12-08 09:52:21 -08:00
Adlai Holler
9bc58dc024 When not visible, only batch fetch to fill visible area 2016-12-05 15:00:39 -08:00
Adlai Holler
21cad90355 Ensure we always fill leading screens for batching 2016-12-05 14:51:07 -08:00
Adlai Holler
8e90a31cc1 Merge pull request #2687 from maicki/MSBetterErrorMessageForDeallocatedDisplayNodeInLayout
Better error message if a display node is created in layoutSpecThatFits: and deallocated before it was added to a subnode
2016-12-01 17:39:56 -08:00
Adlai Holler
051b738236 Inject data source class name into update validation exceptions, deprecate suppression flag (#2692) 2016-12-01 17:30:36 -08:00