Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unified squashed result of google merge. #1986

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
250 changes: 206 additions & 44 deletions AsyncDisplayKit.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,6 @@
ReferencedContainer = "container:AsyncDisplayKit.xcodeproj">
</BuildableReference>
<SkippedTests>
<Test
Identifier = "ASCALayerTests">
</Test>
<Test
Identifier = "ASTextNodePerformanceTests">
</Test>
Expand Down
6 changes: 1 addition & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ Copy and paste this to the top of your new file(s):
//
// Copyright (c) Pinterest, Inc. All rights reserved.
// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0
//
```

If you’ve modified an existing file, change the header to:
Expand Down Expand Up @@ -226,10 +225,7 @@ static void someFunction() {
- There is mostly no sense using nullability annotations outside of interface declarations.
```objc
// Properties
// Never include: `atomic`, `readwrite`, `strong`, `assign`.
// Only specify nullability if it isn't assumed from NS_ASSUME.
// (nullability, atomicity, storage class, writability, custom getter, custom setter)
@property (nullable, copy) NSNumber *status
@property(nonatomic, strong, nullable) NSNumber *status

// Methods
- (nullable NSNumber *)doSomethingWithString:(nullable NSString *)str;
Expand Down
13 changes: 10 additions & 3 deletions Podfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
platform :ios, '9.0'

target :'AsyncDisplayKitTests' do
target :'AsyncDisplayKit' do
platform :ios, '10.0'
use_frameworks!
pod 'OCMock', '~>3.6'
pod 'iOSSnapshotTestCase/Core', '~> 6.2'

pod 'Yoga'
pod 'IGListKit', '~>3.4'

target :'AsyncDisplayKitTests' do
pod 'JGMethodSwizzler'
pod 'OCMock', '=3.4.1'
pod 'iOSSnapshotTestCase/Core', '~>6.2'
end
end
26 changes: 21 additions & 5 deletions Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,20 +1,36 @@
PODS:
- IGListKit (3.4.0):
- IGListKit/Default (= 3.4.0)
- IGListKit/Default (3.4.0):
- IGListKit/Diffing
- IGListKit/Diffing (3.4.0)
- iOSSnapshotTestCase/Core (6.2.0)
- OCMock (3.6)
- JGMethodSwizzler (2.0.1)
- OCMock (3.4.1)
- Yoga (1.14.0)

DEPENDENCIES:
- IGListKit (~> 3.4)
- iOSSnapshotTestCase/Core (~> 6.2)
- OCMock (~> 3.6)
- JGMethodSwizzler
- OCMock (= 3.4.1)
- Yoga

SPEC REPOS:
trunk:
- IGListKit
- iOSSnapshotTestCase
- JGMethodSwizzler
- OCMock
- Yoga

SPEC CHECKSUMS:
IGListKit: 7a5d788e9fb746bcd402baa8e8b24bc3bd2a5a07
iOSSnapshotTestCase: 9ab44cb5aa62b84d31847f40680112e15ec579a6
OCMock: 5ea90566be239f179ba766fd9fbae5885040b992
JGMethodSwizzler: e0ea5c1c6c55304ec4ef3f54e441400c6735c899
OCMock: 2cd0716969bab32a2283ff3a46fd26a8c8b4c5e3
Yoga: cff67a400f6b74dc38eb0bad4f156673d9aa980c

PODFILE CHECKSUM: 1b4ea0e8ab7d94a46b1964a2354686c2e599c8c2
PODFILE CHECKSUM: a94ede4b4176c5971b7727c82520f4a166351fcd

COCOAPODS: 1.10.0
COCOAPODS: 1.10.1
5 changes: 1 addition & 4 deletions Source/ASButtonNode+Yoga.mm
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ @implementation ASButtonNode (Yoga)

- (void)updateYogaLayoutIfNeeded
{
if (!self.yoga) return;
NSMutableArray<ASDisplayNode *> *children = [[NSMutableArray alloc] initWithCapacity:2];
{
ASLockScopeSelf();

// Build up yoga children for button node again
unowned ASLayoutElementStyle *style = [self _locked_style];
[style yogaNodeCreateIfNeeded];

// Setup stack layout values
style.flexDirection = _laysOutHorizontally ? ASStackLayoutDirectionHorizontal : ASStackLayoutDirectionVertical;
Expand All @@ -50,12 +50,10 @@ - (void)updateYogaLayoutIfNeeded

// Setup new yoga children
if (_imageNode.image != nil) {
[_imageNode.style yogaNodeCreateIfNeeded];
[children addObject:_imageNode];
}

if (_titleNode.attributedText.length > 0) {
[_titleNode.style yogaNodeCreateIfNeeded];
if (_imageAlignment == ASButtonNodeImageAlignmentBeginning) {
[children addObject:_titleNode];
} else {
Expand All @@ -80,7 +78,6 @@ - (void)updateYogaLayoutIfNeeded

// Add background node
if (_backgroundImageNode.image) {
[_backgroundImageNode.style yogaNodeCreateIfNeeded];
[children insertObject:_backgroundImageNode atIndex:0];

_backgroundImageNode.style.positionType = YGPositionTypeAbsolute;
Expand Down
1 change: 1 addition & 0 deletions Source/ASButtonNode.mm
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

#import <AsyncDisplayKit/ASButtonNode+Private.h>
#import <AsyncDisplayKit/ASButtonNode+Yoga.h>
#import <AsyncDisplayKit/ASTextNode2.h>
#import <AsyncDisplayKit/ASStackLayoutSpec.h>
#import <AsyncDisplayKit/ASThread.h>
#import <AsyncDisplayKit/ASDisplayNode+Subclasses.h>
Expand Down
24 changes: 19 additions & 5 deletions Source/ASCellNode.mm
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
#import <AsyncDisplayKit/ASInsetLayoutSpec.h>
#import <AsyncDisplayKit/ASDisplayNodeInternal.h>

using namespace AS;

#pragma mark -
#pragma mark ASCellNode

Expand All @@ -34,6 +36,7 @@ @interface ASCellNode ()
ASDisplayNode *_viewControllerNode;
UIViewController *_viewController;
UICollectionViewLayoutAttributes *_layoutAttributes;
__weak id<ASCellNodeInteractionDelegate> _interactionDelegate;
BOOL _suspendInteractionDelegate;
BOOL _selected;
BOOL _highlighted;
Expand All @@ -43,7 +46,6 @@ @interface ASCellNode ()
@end

@implementation ASCellNode
@synthesize interactionDelegate = _interactionDelegate;

- (instancetype)init
{
Expand Down Expand Up @@ -111,17 +113,17 @@ - (void)layout

- (void)_rootNodeDidInvalidateSize
{
if (_interactionDelegate != nil) {
[_interactionDelegate nodeDidInvalidateSize:self];
if (auto interactionDelegate = self.interactionDelegate) {
[interactionDelegate nodeDidInvalidateSize:self];
} else {
[super _rootNodeDidInvalidateSize];
}
}

- (void)_layoutTransitionMeasurementDidFinish
{
if (_interactionDelegate != nil) {
[_interactionDelegate nodeDidInvalidateSize:self];
if (auto interactionDelegate = self.interactionDelegate) {
[interactionDelegate nodeDidInvalidateSize:self];
} else {
[super _layoutTransitionMeasurementDidFinish];
}
Expand Down Expand Up @@ -205,6 +207,18 @@ - (UIViewController *)viewController
return self.collectionElement.owningNode;
}

- (id<ASCellNodeInteractionDelegate>)interactionDelegate
{
MutexLocker l(__instanceLock__);
return _interactionDelegate;
}

- (void)setInteractionDelegate:(id<ASCellNodeInteractionDelegate>)interactionDelegate
{
MutexLocker l(__instanceLock__);
_interactionDelegate = interactionDelegate;
}

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wobjc-missing-super-calls"

Expand Down
56 changes: 56 additions & 0 deletions Source/ASCollectionNode+Beta.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,21 @@ NS_ASSUME_NONNULL_BEGIN
*/
@property (nonatomic, readonly, getter=isSynchronized) BOOL synchronized;

/**
* When bounds change in non-scrollable direction, we remeasure all cells against the new bounds. If
* this property is YES (the default, for historical reasons,) this remeasurement takes place within
* the setBounds: call on the collection view's layer. Otherwise, the remeasurement occurs inside of
* the collection view's layoutSubviews call.
*
* Setting this to NO can avoid duplicated work for example during rotation, where collection view content
* is reloaded or updated in the time between the setBounds: and the layout pass. Having it be YES
* we may remeasure nodes that will be immediately discarded and replaced.
*
* Leaving this as YES will retain historical behavior on which existing application-side collection view
* machinery may depend.
*/
@property (nonatomic) BOOL remeasuresBeforeLayoutPassOnBoundsChange;

/**
* Schedules a block to be performed (on the main thread) as soon as the completion block is called
* on performBatchUpdates:.
Expand All @@ -64,6 +79,47 @@ NS_ASSUME_NONNULL_BEGIN
*/
- (void)onDidFinishSynchronizing:(void (^)(void))didFinishSynchronizing;

/**
* Whether to immediately apply layouts that are generated in the background (if nodes aren't
* loaded).
*
* This feature is considered experimental; please report any issues you encounter.
*
* Defaults to NO. The default may change to YES in the future.
*/
@property(nonatomic) BOOL immediatelyApplyComputedLayouts;

/**
* The maximum number of elements to insert in each chunk of a collection view update.
*
* 0 means all items will be inserted in one chunk. Default is 0.
*/
@property (nonatomic) NSUInteger updateBatchSize;

/**
* Whether cell nodes should be temporarily stored in, and pulled from, a global cache
* during updates. The nodeModel will be used as the key. This is useful to reduce the
* cost of operations such as reloading content due to iPad rotation, or moving content
* from one collection node to another, or calling reloadData. Default is NO.
*/
@property (nonatomic) BOOL useNodeCache;

/**
* A way to override the default ASCellLayoutModeNone behavior of forcing all initial updates to be
* synchronous. Defaults to NO, will eventually flip to YES.
*/
@property(nonatomic) BOOL allowAsyncUpdatesForInitialContent;

/**
* Whether to defer each layout pass to the next run loop. Useful when, for example, the collection
* node is fully obscured by another view and you want to break up large layout operations such as
* rotations into multiple run loop iterations.
*
* Defaults to NO.
*/
@property (nonatomic) BOOL shouldDelayLayout;


- (instancetype)initWithFrame:(CGRect)frame collectionViewLayout:(UICollectionViewLayout *)layout layoutFacilitator:(nullable id<ASCollectionViewLayoutFacilitatorProtocol>)layoutFacilitator;

- (instancetype)initWithLayoutDelegate:(id<ASCollectionLayoutDelegate>)layoutDelegate layoutFacilitator:(nullable id<ASCollectionViewLayoutFacilitatorProtocol>)layoutFacilitator;
Expand Down
4 changes: 4 additions & 0 deletions Source/ASCollectionNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -774,6 +774,10 @@ NS_ASSUME_NONNULL_BEGIN
* @param indexPath The index path of the item.
*
* @return A constrained size range for layout for the item at this index path.
*
* NOTE: In Yoga2, the min size is ignored and always assumed to be zero. Set the min-width or
* min-height property of your content, or simply choose whatever size you prefer regardless of the
* cell node's measured dimensions.
*/
- (ASSizeRange)collectionNode:(ASCollectionNode *)collectionNode constrainedSizeForItemAtIndexPath:(NSIndexPath *)indexPath;

Expand Down
Loading