[ASRangeController] Inspect delegate's ASInterfaceState to delay preloading beyond viewport until visible.

This commit is contained in:
Scott Goodson
2016-01-03 19:14:07 -08:00
parent 95bd2c264c
commit 984fe43997
10 changed files with 181 additions and 49 deletions

View File

@@ -9,6 +9,7 @@
#import "ASCollectionNode.h"
#import "ASCollectionInternal.h"
#import "ASDisplayNode+Subclasses.h"
#import "ASRangeController.h"
#include <vector>
@interface _ASCollectionPendingState : NSObject
@@ -97,12 +98,12 @@
{
[super didLoad];
ASCollectionView *view = self.view;
view.collectionNode = self;
if (_pendingState) {
_ASCollectionPendingState *pendingState = _pendingState;
self.pendingState = nil;
ASCollectionView *view = self.view;
view.collectionNode = self;
self.pendingState = nil;
view.asyncDelegate = pendingState.delegate;
view.asyncDataSource = pendingState.dataSource;
}
@@ -160,10 +161,13 @@
return (ASCollectionView *)[super view];
}
#if RangeControllerLoggingEnabled
- (void)visibilityDidChange:(BOOL)isVisible
{
[super visibilityDidChange:isVisible];
NSLog(@"%@ - visible: %d", self, isVisible);
}
#endif
- (void)clearContents
{