Merge branch 'master' into patch-3
@@ -1,11 +1,11 @@
|
||||
Pod::Spec.new do |spec|
|
||||
spec.name = 'AsyncDisplayKit'
|
||||
spec.version = '1.9.73'
|
||||
spec.version = '1.9.74'
|
||||
spec.license = { :type => 'BSD' }
|
||||
spec.homepage = 'http://asyncdisplaykit.org'
|
||||
spec.authors = { 'Scott Goodson' => 'scottgoodson@gmail.com', 'Ryan Nystrom' => 'rnystrom@fb.com' }
|
||||
spec.summary = 'Smooth asynchronous user interfaces for iOS apps.'
|
||||
spec.source = { :git => 'https://github.com/facebook/AsyncDisplayKit.git', :tag => '1.9.73' }
|
||||
spec.source = { :git => 'https://github.com/facebook/AsyncDisplayKit.git', :tag => '1.9.74' }
|
||||
|
||||
spec.documentation_url = 'http://asyncdisplaykit.org/appledoc/'
|
||||
|
||||
|
||||
@@ -9,8 +9,11 @@
|
||||
#import "ASViewController.h"
|
||||
#import "ASAssert.h"
|
||||
#import "ASDimension.h"
|
||||
#import "ASDisplayNodeInternal.h"
|
||||
#import "ASDisplayNode+FrameworkPrivate.h"
|
||||
#import "ASDisplayNode+Beta.h"
|
||||
#import "ASTraitCollection.h"
|
||||
#import "ASEnvironmentInternal.h"
|
||||
#import "ASRangeControllerUpdateRangeProtocol+Beta.h"
|
||||
|
||||
#define AS_LOG_VISIBILITY_CHANGES 0
|
||||
@@ -46,10 +49,21 @@
|
||||
_node = node;
|
||||
|
||||
_automaticallyAdjustRangeModeBasedOnViewEvents = NO;
|
||||
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
if (_traitColectionContext != nil) {
|
||||
// The setter will iterate through the VC's subnodes and replace the traitCollectionContext in their ASEnvironmentTraitCollection with nil.
|
||||
// Since the VC holds the only strong reference to this context and we are in the process of destroying
|
||||
// the VC, all the references in the subnodes will be unsafe unless we nil them out. More than likely all the subnodes will be dealloc'ed
|
||||
// as part of the VC being dealloc'ed, but this is just to make extra sure.
|
||||
self.traitColectionContext = nil;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)loadView
|
||||
{
|
||||
ASDisplayNodeAssertTrue(!_node.layerBacked);
|
||||
@@ -171,4 +185,80 @@ ASVisibilityDepthImplementation;
|
||||
return _node.interfaceState;
|
||||
}
|
||||
|
||||
#pragma mark - ASEnvironmentTraitCollection
|
||||
|
||||
- (void)setTraitColectionContext:(id)traitColectionContext
|
||||
{
|
||||
if (_traitColectionContext != traitColectionContext) {
|
||||
// propagate first so that nodes aren't hanging around with a dealloc'ed pointer
|
||||
ASEnvironmentTraitCollectionUpdateDisplayContext(self.node, traitColectionContext);
|
||||
|
||||
_traitColectionContext = traitColectionContext;
|
||||
}
|
||||
}
|
||||
|
||||
- (ASEnvironmentTraitCollection)displayTraitsForTraitCollection:(UITraitCollection *)traitCollection
|
||||
{
|
||||
if (self.overrideDisplayTraitsWithTraitCollection) {
|
||||
ASTraitCollection *asyncTraitCollection = self.overrideDisplayTraitsWithTraitCollection(traitCollection);
|
||||
self.traitColectionContext = asyncTraitCollection.traitCollectionContext;
|
||||
return [asyncTraitCollection environmentTraitCollection];
|
||||
}
|
||||
|
||||
ASEnvironmentTraitCollection asyncTraitCollection = ASEnvironmentTraitCollectionFromUITraitCollection(traitCollection);
|
||||
asyncTraitCollection.displayContext = self.traitColectionContext;
|
||||
return asyncTraitCollection;
|
||||
}
|
||||
|
||||
- (ASEnvironmentTraitCollection)displayTraitsForWindowSize:(CGSize)windowSize
|
||||
{
|
||||
if (self.overrideDisplayTraitsWithWindowSize) {
|
||||
ASTraitCollection *traitCollection = self.overrideDisplayTraitsWithWindowSize(windowSize);
|
||||
self.traitColectionContext = traitCollection.traitCollectionContext;
|
||||
return [traitCollection environmentTraitCollection];
|
||||
}
|
||||
return self.node.environmentTraitCollection;
|
||||
}
|
||||
|
||||
- (void)progagateNewDisplayTraits:(ASEnvironmentTraitCollection)traitCollection
|
||||
{
|
||||
ASEnvironmentState environmentState = self.node.environmentState;
|
||||
ASEnvironmentTraitCollection oldTraitCollection = environmentState.traitCollection;
|
||||
|
||||
if (ASEnvironmentTraitCollectionIsEqualToASEnvironmentTraitCollection(traitCollection, oldTraitCollection) == NO) {
|
||||
environmentState.traitCollection = traitCollection;
|
||||
self.node.environmentState = environmentState;
|
||||
[self.node setNeedsLayout];
|
||||
|
||||
NSArray<id<ASEnvironment>> *children = [self.node children];
|
||||
for (id<ASEnvironment> child in children) {
|
||||
ASEnvironmentStatePropagateDown(child, environmentState.traitCollection);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)traitCollectionDidChange:(UITraitCollection *)previousTraitCollection
|
||||
{
|
||||
[super traitCollectionDidChange:previousTraitCollection];
|
||||
|
||||
ASEnvironmentTraitCollection traitCollection = [self displayTraitsForTraitCollection:self.traitCollection];
|
||||
[self progagateNewDisplayTraits:traitCollection];
|
||||
}
|
||||
|
||||
- (void)willTransitionToTraitCollection:(UITraitCollection *)newCollection withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator
|
||||
{
|
||||
[super willTransitionToTraitCollection:newCollection withTransitionCoordinator:coordinator];
|
||||
|
||||
ASEnvironmentTraitCollection traitCollection = [self displayTraitsForTraitCollection:newCollection];
|
||||
[self progagateNewDisplayTraits:traitCollection];
|
||||
}
|
||||
|
||||
- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator
|
||||
{
|
||||
[super viewWillTransitionToSize:size withTransitionCoordinator:coordinator];
|
||||
|
||||
ASEnvironmentTraitCollection traitCollection = [self displayTraitsForWindowSize:size];
|
||||
[self progagateNewDisplayTraits:traitCollection];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -51,7 +51,9 @@
|
||||
|
||||
- (void)willReloadData
|
||||
{
|
||||
[_pendingContexts enumerateKeysAndObjectsUsingBlock:^(NSString *kind, NSMutableArray<ASIndexedNodeContext *> *contexts, BOOL *stop) {
|
||||
NSArray *keys = _pendingContexts.allKeys;
|
||||
for (NSString *kind in keys) {
|
||||
NSMutableArray<ASIndexedNodeContext *> *contexts = _pendingContexts[kind];
|
||||
// Remove everything that existed before the reload, now that we're ready to insert replacements
|
||||
NSArray *indexPaths = [self indexPathsForEditingNodesOfKind:kind];
|
||||
[self deleteNodesOfKind:kind atIndexPaths:indexPaths completion:nil];
|
||||
@@ -72,7 +74,7 @@
|
||||
[self insertNodes:nodes ofKind:kind atIndexPaths:indexPaths completion:nil];
|
||||
}];
|
||||
[_pendingContexts removeObjectForKey:kind];
|
||||
}];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)prepareForInsertSections:(NSIndexSet *)sections
|
||||
@@ -87,7 +89,9 @@
|
||||
|
||||
- (void)willInsertSections:(NSIndexSet *)sections
|
||||
{
|
||||
[_pendingContexts enumerateKeysAndObjectsUsingBlock:^(NSString *kind, NSMutableArray<ASIndexedNodeContext *> *contexts, BOOL *stop) {
|
||||
NSArray *keys = _pendingContexts.allKeys;
|
||||
for (NSString *kind in keys) {
|
||||
NSMutableArray<ASIndexedNodeContext *> *contexts = _pendingContexts[kind];
|
||||
NSMutableArray *sectionArray = [NSMutableArray arrayWithCapacity:sections.count];
|
||||
for (NSUInteger i = 0; i < sections.count; i++) {
|
||||
[sectionArray addObject:[NSMutableArray array]];
|
||||
@@ -98,7 +102,7 @@
|
||||
[self insertNodes:nodes ofKind:kind atIndexPaths:indexPaths completion:nil];
|
||||
}];
|
||||
[_pendingContexts removeObjectForKey:kind];
|
||||
}];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)willDeleteSections:(NSIndexSet *)sections
|
||||
@@ -122,7 +126,9 @@
|
||||
|
||||
- (void)willReloadSections:(NSIndexSet *)sections
|
||||
{
|
||||
[_pendingContexts enumerateKeysAndObjectsUsingBlock:^(NSString *kind, NSMutableArray<ASIndexedNodeContext *> *contexts, BOOL *stop) {
|
||||
NSArray *keys = _pendingContexts.allKeys;
|
||||
for (NSString *kind in keys) {
|
||||
NSMutableArray<ASIndexedNodeContext *> *contexts = _pendingContexts[kind];
|
||||
NSArray *indexPaths = ASIndexPathsForMultidimensionalArrayAtIndexSet([self editingNodesOfKind:kind], sections);
|
||||
[self deleteNodesOfKind:kind atIndexPaths:indexPaths completion:nil];
|
||||
// reinsert the elements
|
||||
@@ -130,7 +136,7 @@
|
||||
[self insertNodes:nodes ofKind:kind atIndexPaths:indexPaths completion:nil];
|
||||
}];
|
||||
[_pendingContexts removeObjectForKey:kind];
|
||||
}];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)willMoveSection:(NSInteger)section toSection:(NSInteger)newSection
|
||||
|
||||
@@ -209,7 +209,7 @@ static void *kASSizingQueueContext = &kASSizingQueueContext;
|
||||
allocatedNodeBuffer[i] = node;
|
||||
allocatedContextBuffer[i] = context;
|
||||
});
|
||||
subarrayOfNodes = [[NSArray alloc] initWithObjects:allocatedNodeBuffer count:batchCount];
|
||||
subarrayOfNodes = [NSArray arrayWithObjects:allocatedNodeBuffer count:batchCount];
|
||||
subarrayOfContexts = [NSArray arrayWithObjects:allocatedContextBuffer count:batchCount];
|
||||
// Nil out buffer indexes to allow arc to free the stored cells.
|
||||
for (int i = 0; i < batchCount; i++) {
|
||||
|
||||
@@ -27,6 +27,10 @@
|
||||
#define kCFCoreFoundationVersionNumber_iOS_8_4 1145.15
|
||||
#endif
|
||||
|
||||
#ifndef kCFCoreFoundationVersionNumber_iOS_9_0
|
||||
#define kCFCoreFoundationVersionNumber_iOS_9_0 1240.10
|
||||
#endif
|
||||
|
||||
#ifndef __IPHONE_7_0
|
||||
#define __IPHONE_7_0 70000
|
||||
#endif
|
||||
@@ -46,4 +50,4 @@
|
||||
#define AS_AT_LEAST_IOS7 (kCFCoreFoundationVersionNumber > kCFCoreFoundationVersionNumber_iOS_6_1)
|
||||
#define AS_AT_LEAST_IOS7_1 (kCFCoreFoundationVersionNumber >= kCFCoreFoundationVersionNumber_iOS_7_1)
|
||||
#define AS_AT_LEAST_IOS8 (kCFCoreFoundationVersionNumber >= kCFCoreFoundationVersionNumber_iOS_8_0)
|
||||
#define AS_AT_LEAST_IOS9 (kCFCoreFoundationVersionNumber > kCFCoreFoundationVersionNumber_iOS_8_4)
|
||||
#define AS_AT_LEAST_IOS9 (kCFCoreFoundationVersionNumber >= kCFCoreFoundationVersionNumber_iOS_9_0)
|
||||
|
||||
|
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
|
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 23 KiB |
|
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
|
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 23 KiB |
|
Before Width: | Height: | Size: 59 KiB After Width: | Height: | Size: 59 KiB |
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
|
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 23 KiB |
|
Before Width: | Height: | Size: 103 KiB After Width: | Height: | Size: 103 KiB |