From cc4f604ea38cb0df0a15a1b3f86c3b8a374dd587 Mon Sep 17 00:00:00 2001 From: Aaron Schubert Date: Tue, 12 Jan 2016 14:43:30 +0000 Subject: [PATCH] [tvOS] Initial commit to make build run. --- AsyncDisplayKit.podspec | 1 + AsyncDisplayKit/ASDisplayNode.h | 2 ++ AsyncDisplayKit/ASEditableTextNode.mm | 2 ++ AsyncDisplayKit/ASMapNode.h | 3 +++ AsyncDisplayKit/ASMapNode.mm | 4 +++- AsyncDisplayKit/ASMultiplexImageNode.h | 13 +++++++----- AsyncDisplayKit/ASMultiplexImageNode.mm | 20 ++++++++++++------- AsyncDisplayKit/ASPagerNode.m | 5 +++-- AsyncDisplayKit/ASTableViewProtocols.h | 3 ++- .../Details/ASPhotosFrameworkImageRequest.h | 3 ++- .../Details/ASPhotosFrameworkImageRequest.m | 3 ++- .../Private/ASDisplayNode+UIViewBridge.mm | 4 ++-- AsyncDisplayKit/Private/_ASPendingState.m | 8 +++++--- 13 files changed, 48 insertions(+), 23 deletions(-) diff --git a/AsyncDisplayKit.podspec b/AsyncDisplayKit.podspec index 5755b452fa..5698d550de 100644 --- a/AsyncDisplayKit.podspec +++ b/AsyncDisplayKit.podspec @@ -47,4 +47,5 @@ Pod::Spec.new do |spec| } spec.ios.deployment_target = '7.0' + spec.tvos.deployment_target = '9.0' end diff --git a/AsyncDisplayKit/ASDisplayNode.h b/AsyncDisplayKit/ASDisplayNode.h index a38f093ca2..8923e41775 100644 --- a/AsyncDisplayKit/ASDisplayNode.h +++ b/AsyncDisplayKit/ASDisplayNode.h @@ -641,7 +641,9 @@ NS_ASSUME_NONNULL_END @property (atomic, assign) UIViewContentMode contentMode; // default=UIViewContentModeScaleToFill @property (atomic, assign, getter=isUserInteractionEnabled) BOOL userInteractionEnabled; // default=YES (NO for layer-backed nodes) +#if TARGET_OS_IOS @property (atomic, assign, getter=isExclusiveTouch) BOOL exclusiveTouch; // default=NO +#endif @property (atomic, assign, nullable) CGColorRef shadowColor; // default=opaque rgb black @property (atomic, assign) CGFloat shadowOpacity; // default=0.0 @property (atomic, assign) CGSize shadowOffset; // default=(0, -3) diff --git a/AsyncDisplayKit/ASEditableTextNode.mm b/AsyncDisplayKit/ASEditableTextNode.mm index 13554d88e5..c86aa8ccaa 100644 --- a/AsyncDisplayKit/ASEditableTextNode.mm +++ b/AsyncDisplayKit/ASEditableTextNode.mm @@ -137,7 +137,9 @@ _textKitComponents.textView = self.textView; //_textKitComponents.textView = NO; // Unfortunately there's a bug here with iOS 7 DP5 that causes the text-view to only be one line high when scrollEnabled is NO. rdar://14729288 _textKitComponents.textView.delegate = self; + #if TARGET_OS_IOS _textKitComponents.textView.editable = YES; + #endif _textKitComponents.textView.typingAttributes = _typingAttributes; _textKitComponents.textView.returnKeyType = _returnKeyType; _textKitComponents.textView.accessibilityHint = _placeholderTextKitComponents.textStorage.string; diff --git a/AsyncDisplayKit/ASMapNode.h b/AsyncDisplayKit/ASMapNode.h index 0a8b0ebbd7..5aa6920c50 100644 --- a/AsyncDisplayKit/ASMapNode.h +++ b/AsyncDisplayKit/ASMapNode.h @@ -7,6 +7,7 @@ */ #import +#if TARGET_OS_IOS #import NS_ASSUME_NONNULL_BEGIN @@ -48,3 +49,5 @@ NS_ASSUME_NONNULL_BEGIN @end NS_ASSUME_NONNULL_END + +#endif \ No newline at end of file diff --git a/AsyncDisplayKit/ASMapNode.mm b/AsyncDisplayKit/ASMapNode.mm index ce4f3fc8e4..963b9d3647 100644 --- a/AsyncDisplayKit/ASMapNode.mm +++ b/AsyncDisplayKit/ASMapNode.mm @@ -6,6 +6,7 @@ * of patent rights can be found in the PATENTS file in the same directory. */ +#if TARGET_OS_IOS #import "ASMapNode.h" #import #import @@ -246,4 +247,5 @@ } } } -@end \ No newline at end of file +@end +#endif \ No newline at end of file diff --git a/AsyncDisplayKit/ASMultiplexImageNode.h b/AsyncDisplayKit/ASMultiplexImageNode.h index 25e463b2af..cac569d3c7 100644 --- a/AsyncDisplayKit/ASMultiplexImageNode.h +++ b/AsyncDisplayKit/ASMultiplexImageNode.h @@ -8,9 +8,9 @@ #import #import - +#if TARGET_OS_IOS #import - +#endif NS_ASSUME_NONNULL_BEGIN @protocol ASMultiplexImageNodeDelegate; @@ -116,13 +116,14 @@ typedef NS_ENUM(NSUInteger, ASMultiplexImageNodeErrorCode) { */ @property (nullable, nonatomic, readonly) ASImageIdentifier displayedImageIdentifier; +#if TARGET_OS_IOS /** * @abstract The image manager that this image node should use when requesting images from the Photos framework. If this is `nil` (the default), then `PHImageManager.defaultManager` is used. * @see `+[NSURL URLWithAssetLocalIdentifier:targetSize:contentMode:options:]` below. */ @property (nonatomic, strong) PHImageManager *imageManager; - +#endif @end @@ -229,6 +230,7 @@ didFinishDownloadingImageWithIdentifier:(ASImageIdentifier)imageIdentifier */ - (nullable NSURL *)multiplexImageNode:(ASMultiplexImageNode *)imageNode URLForImageIdentifier:(ASImageIdentifier)imageIdentifier; +#if TARGET_OS_IOS /** * @abstract A PHAsset for the specific asset local identifier * @param imageNode The sender. @@ -240,11 +242,11 @@ didFinishDownloadingImageWithIdentifier:(ASImageIdentifier)imageIdentifier * @return A PHAsset corresponding to `assetLocalIdentifier`, or nil if none is available. */ - (nullable PHAsset *)multiplexImageNode:(ASMultiplexImageNode *)imageNode assetForLocalIdentifier:(NSString *)assetLocalIdentifier; - +#endif @end #pragma mark - - +#if TARGET_OS_IOS @interface NSURL (ASPhotosFrameworkURLs) /** @@ -261,5 +263,6 @@ didFinishDownloadingImageWithIdentifier:(ASImageIdentifier)imageIdentifier options:(PHImageRequestOptions *)options; @end +#endif NS_ASSUME_NONNULL_END \ No newline at end of file diff --git a/AsyncDisplayKit/ASMultiplexImageNode.mm b/AsyncDisplayKit/ASMultiplexImageNode.mm index c51e2bb2ba..fa58bb88f1 100644 --- a/AsyncDisplayKit/ASMultiplexImageNode.mm +++ b/AsyncDisplayKit/ASMultiplexImageNode.mm @@ -7,11 +7,11 @@ */ #import "ASMultiplexImageNode.h" - +#if TARGET_OS_IOS #import #import - +#endif #import #import "ASAvailability.h" @@ -112,6 +112,7 @@ typedef void(^ASMultiplexImageLoadCompletionBlock)(UIImage *image, id imageIdent */ - (void)_fetchImageWithIdentifierFromCache:(id)imageIdentifier URL:(NSURL *)imageURL completion:(void (^)(UIImage *image))completionBlock; +#if TARGET_OS_IOS /** @abstract Loads the image corresponding to the given assetURL from the device's Assets Library. @param imageIdentifier The identifier for the image to be loaded. May not be nil. @@ -131,7 +132,7 @@ typedef void(^ASMultiplexImageLoadCompletionBlock)(UIImage *image, id imageIdent @param error An error describing why the load failed, if it failed; nil otherwise. */ - (void)_loadPHAssetWithRequest:(ASPhotosFrameworkImageRequest *)request identifier:(id)imageIdentifier completion:(void (^)(UIImage *image, NSError *error))completionBlock; - +#endif /** @abstract Downloads the image corresponding to the given imageIdentifier from the given URL. @param imageIdentifier The identifier for the image to be downloaded. May not be nil. @@ -262,7 +263,9 @@ typedef void(^ASMultiplexImageLoadCompletionBlock)(UIImage *image, id imageIdent _dataSource = dataSource; _dataSourceFlags.image = [_dataSource respondsToSelector:@selector(multiplexImageNode:imageForImageIdentifier:)]; _dataSourceFlags.URL = [_dataSource respondsToSelector:@selector(multiplexImageNode:URLForImageIdentifier:)]; + #if TARGET_OS_IOS _dataSourceFlags.asset = [_dataSource respondsToSelector:@selector(multiplexImageNode:assetForLocalIdentifier:)]; + #endif } #pragma mark - @@ -455,6 +458,7 @@ typedef void(^ASMultiplexImageLoadCompletionBlock)(UIImage *image, id imageIdent return; } + #if TARGET_OS_IOS // If it's an assets-library URL, we need to fetch it from the assets library. if ([[nextImageURL scheme] isEqualToString:kAssetsLibraryURLScheme]) { // Load the asset. @@ -470,6 +474,7 @@ typedef void(^ASMultiplexImageLoadCompletionBlock)(UIImage *image, id imageIdent finishedLoadingBlock(image, nextImageIdentifier, error); }]; } + #endif else // Otherwise, it's a web URL that we can download. { // First, check the cache. @@ -499,7 +504,7 @@ typedef void(^ASMultiplexImageLoadCompletionBlock)(UIImage *image, id imageIdent }]; } } - +#if TARGET_OS_IOS - (void)_loadALAssetWithIdentifier:(id)imageIdentifier URL:(NSURL *)assetURL completion:(void (^)(UIImage *image, NSError *error))completionBlock { ASDisplayNodeAssertNotNil(imageIdentifier, @"imageIdentifier is required"); @@ -609,7 +614,7 @@ typedef void(^ASMultiplexImageLoadCompletionBlock)(UIImage *image, id imageIdent _phImageRequestOperation = newImageRequestOp; [phImageRequestQueue addOperation:newImageRequestOp]; } - +#endif - (void)_fetchImageWithIdentifierFromCache:(id)imageIdentifier URL:(NSURL *)imageURL completion:(void (^)(UIImage *image))completionBlock { ASDisplayNodeAssertNotNil(imageIdentifier, @"imageIdentifier is required"); @@ -708,7 +713,7 @@ typedef void(^ASMultiplexImageLoadCompletionBlock)(UIImage *image, id imageIdent } @end - +#if TARGET_OS_IOS @implementation NSURL (ASPhotosFrameworkURLs) + (NSURL *)URLWithAssetLocalIdentifier:(NSString *)assetLocalIdentifier targetSize:(CGSize)targetSize contentMode:(PHImageContentMode)contentMode options:(PHImageRequestOptions *)options @@ -720,4 +725,5 @@ typedef void(^ASMultiplexImageLoadCompletionBlock)(UIImage *image, id imageIdent return request.url; } -@end \ No newline at end of file +@end +#endif \ No newline at end of file diff --git a/AsyncDisplayKit/ASPagerNode.m b/AsyncDisplayKit/ASPagerNode.m index a69a963d4d..d3bbcddb46 100644 --- a/AsyncDisplayKit/ASPagerNode.m +++ b/AsyncDisplayKit/ASPagerNode.m @@ -48,12 +48,13 @@ [super didLoad]; ASCollectionView *cv = self.view; - +#if TARGET_OS_IOS cv.pagingEnabled = YES; + cv.scrollsToTop = NO; +#endif cv.allowsSelection = NO; cv.showsVerticalScrollIndicator = NO; cv.showsHorizontalScrollIndicator = NO; - cv.scrollsToTop = NO; // Zeroing contentInset is important, as UIKit will set the top inset for the navigation bar even though // our view is only horizontally scrollable. This causes UICollectionViewFlowLayout to log a warning. diff --git a/AsyncDisplayKit/ASTableViewProtocols.h b/AsyncDisplayKit/ASTableViewProtocols.h index df8bb811ca..ff2c441388 100644 --- a/AsyncDisplayKit/ASTableViewProtocols.h +++ b/AsyncDisplayKit/ASTableViewProtocols.h @@ -73,8 +73,9 @@ NS_ASSUME_NONNULL_BEGIN - (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath; - (nullable NSString *)tableView:(UITableView *)tableView titleForDeleteConfirmationButtonForRowAtIndexPath:(NSIndexPath *)indexPath; +#if TARGET_OS_IOS - (nullable NSArray *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath; - +#endif - (BOOL)tableView:(UITableView *)tableView shouldIndentWhileEditingRowAtIndexPath:(NSIndexPath *)indexPath; - (void)tableView:(UITableView*)tableView willBeginEditingRowAtIndexPath:(NSIndexPath *)indexPath; diff --git a/AsyncDisplayKit/Details/ASPhotosFrameworkImageRequest.h b/AsyncDisplayKit/Details/ASPhotosFrameworkImageRequest.h index 7630fe2e84..96c2f4b2ea 100644 --- a/AsyncDisplayKit/Details/ASPhotosFrameworkImageRequest.h +++ b/AsyncDisplayKit/Details/ASPhotosFrameworkImageRequest.h @@ -5,7 +5,7 @@ // Created by Adlai Holler on 9/25/15. // Copyright © 2015 Facebook. All rights reserved. // - +#if TARGET_OS_IOS #import #import @@ -64,3 +64,4 @@ extern NSString *const ASPhotosURLScheme; @end // NS_ASSUME_NONNULL_END +#endif \ No newline at end of file diff --git a/AsyncDisplayKit/Details/ASPhotosFrameworkImageRequest.m b/AsyncDisplayKit/Details/ASPhotosFrameworkImageRequest.m index d46b3791c1..1245e32547 100644 --- a/AsyncDisplayKit/Details/ASPhotosFrameworkImageRequest.m +++ b/AsyncDisplayKit/Details/ASPhotosFrameworkImageRequest.m @@ -5,7 +5,7 @@ // Created by Adlai Holler on 9/25/15. // Copyright © 2015 Facebook. All rights reserved. // - +#if TARGET_OS_IOS #import "ASPhotosFrameworkImageRequest.h" #import "ASBaseDefines.h" #import "ASAvailability.h" @@ -159,3 +159,4 @@ static NSString *const _ASPhotosURLQueryKeyCropHeight = @"crop_h"; } @end +#endif \ No newline at end of file diff --git a/AsyncDisplayKit/Private/ASDisplayNode+UIViewBridge.mm b/AsyncDisplayKit/Private/ASDisplayNode+UIViewBridge.mm index 7dd7275090..ec7a10b354 100644 --- a/AsyncDisplayKit/Private/ASDisplayNode+UIViewBridge.mm +++ b/AsyncDisplayKit/Private/ASDisplayNode+UIViewBridge.mm @@ -298,7 +298,7 @@ _bridge_prologue; _setToViewOnly(userInteractionEnabled, enabled); } - +#if TARGET_OS_IOS - (BOOL)isExclusiveTouch { _bridge_prologue; @@ -310,7 +310,7 @@ _bridge_prologue; _setToViewOnly(exclusiveTouch, exclusiveTouch); } - +#endif - (BOOL)clipsToBounds { _bridge_prologue; diff --git a/AsyncDisplayKit/Private/_ASPendingState.m b/AsyncDisplayKit/Private/_ASPendingState.m index 37918e197b..b1ab0c5d39 100644 --- a/AsyncDisplayKit/Private/_ASPendingState.m +++ b/AsyncDisplayKit/Private/_ASPendingState.m @@ -716,9 +716,11 @@ static UIColor *defaultTintColor = nil; if (_flags.setUserInteractionEnabled) view.userInteractionEnabled = userInteractionEnabled; + #if TARGET_OS_IOS if (_flags.setExclusiveTouch) view.exclusiveTouch = exclusiveTouch; - + #endif + if (_flags.setShadowColor) layer.shadowColor = shadowColor; @@ -943,10 +945,10 @@ static UIColor *defaultTintColor = nil; pendingState.userInteractionEnabled = view.userInteractionEnabled; (pendingState->_flags).setUserInteractionEnabled = YES; - +#if TARGET_OS_IOS pendingState.exclusiveTouch = view.exclusiveTouch; (pendingState->_flags).setExclusiveTouch = YES; - +#endif pendingState.shadowColor = layer.shadowColor; (pendingState->_flags).setShadowColor = YES;