From 17fcca19ce586f5b098f1d4a0685e7e826efe2d5 Mon Sep 17 00:00:00 2001 From: Nadine Salter Date: Wed, 1 Oct 2014 15:54:03 -0700 Subject: [PATCH] s/richTextNode/textNode/g. ASTextNode's delegate methods are all prefixed with "richTextNode". Rename these to "textNode" for consistency. --- AsyncDisplayKit/ASTextNode.h | 32 +++++++++++++------------- AsyncDisplayKit/ASTextNode.mm | 20 ++++++++-------- AsyncDisplayKitTests/ASTextNodeTests.m | 4 ++-- 3 files changed, 28 insertions(+), 28 deletions(-) diff --git a/AsyncDisplayKit/ASTextNode.h b/AsyncDisplayKit/ASTextNode.h index d3508dd0d3..a61c5c8594 100644 --- a/AsyncDisplayKit/ASTextNode.h +++ b/AsyncDisplayKit/ASTextNode.h @@ -160,44 +160,44 @@ typedef NS_ENUM(NSUInteger, ASTextNodeHighlightStyle) { @optional /** - @abstract Indicates to the delegate that a link was tapped within a rich text node. - @param richTextNode The ASTextNode containing the link that was tapped. + @abstract Indicates to the delegate that a link was tapped within a text node. + @param textNode The ASTextNode containing the link that was tapped. @param attribute The attribute that was tapped. Will not be nil. @param value The value of the tapped attribute. - @param point The point within richTextNode, in richTextNode's coordinate system, that was tapped. + @param point The point within textNode, in textNode's coordinate system, that was tapped. */ -- (void)richTextNode:(ASTextNode *)richTextNode tappedLinkAttribute:(NSString *)attribute value:(id)value atPoint:(CGPoint)point textRange:(NSRange)textRange; +- (void)textNode:(ASTextNode *)textNode tappedLinkAttribute:(NSString *)attribute value:(id)value atPoint:(CGPoint)point textRange:(NSRange)textRange; /** - @abstract Indicates to the delegate that a link was tapped within a rich text node. - @param richTextNode The ASTextNode containing the link that was tapped. + @abstract Indicates to the delegate that a link was tapped within a text node. + @param textNode The ASTextNode containing the link that was tapped. @param attribute The attribute that was tapped. Will not be nil. @param value The value of the tapped attribute. - @param point The point within richTextNode, in richTextNode's coordinate system, that was tapped. + @param point The point within textNode, in textNode's coordinate system, that was tapped. */ -- (void)richTextNode:(ASTextNode *)richTextNode longPressedLinkAttribute:(NSString *)attribute value:(id)value atPoint:(CGPoint)point textRange:(NSRange)textRange; +- (void)textNode:(ASTextNode *)textNode longPressedLinkAttribute:(NSString *)attribute value:(id)value atPoint:(CGPoint)point textRange:(NSRange)textRange; -//! @abstract Called when the rich text node's truncation string has been tapped. -- (void)richTextNodeTappedTruncationToken:(ASTextNode *)richTextNode; +//! @abstract Called when the text node's truncation string has been tapped. +- (void)textNodeTappedTruncationToken:(ASTextNode *)textNode; /** - @abstract Indicates to the rich text node if an attribute should be considered a link. - @param richTextNode The rich text node containing the entity attribute. + @abstract Indicates to the text node if an attribute should be considered a link. + @param textNode The text node containing the entity attribute. @param attribute The attribute that was tapped. Will not be nil. @param value The value of the tapped attribute. @discussion If not implemented, the default value is NO. @return YES if the entity attribute should be a link, NO otherwise. */ -- (BOOL)richTextNode:(ASTextNode *)richTextNode shouldHighlightLinkAttribute:(NSString *)attribute value:(id)value; +- (BOOL)textNode:(ASTextNode *)textNode shouldHighlightLinkAttribute:(NSString *)attribute value:(id)value; /** - @abstract Indicates to the rich text node if an attribute is a valid long-press target - @param richTextNode The rich text node containing the entity attribute. + @abstract Indicates to the text node if an attribute is a valid long-press target + @param textNode The text node containing the entity attribute. @param attribute The attribute that was tapped. Will not be nil. @param value The value of the tapped attribute. @discussion If not implemented, the default value is NO. @return YES if the entity attribute should be treated as a long-press target, NO otherwise. */ -- (BOOL)richTextNode:(ASTextNode *)richTextNode shouldLongPressLinkAttribute:(NSString *)attribute value:(id)value; +- (BOOL)textNode:(ASTextNode *)textNode shouldLongPressLinkAttribute:(NSString *)attribute value:(id)value; @end diff --git a/AsyncDisplayKit/ASTextNode.mm b/AsyncDisplayKit/ASTextNode.mm index 591e063104..8bb353e5f2 100644 --- a/AsyncDisplayKit/ASTextNode.mm +++ b/AsyncDisplayKit/ASTextNode.mm @@ -430,8 +430,8 @@ ASDISPLAYNODE_INLINE CGFloat ceilPixelValue(CGFloat f) // Check if delegate implements optional method, if not assume NO. // Should the text be highlightable/touchable? - if (![_delegate respondsToSelector:@selector(richTextNode:shouldHighlightLinkAttribute:value:)] || - ![_delegate richTextNode:self shouldHighlightLinkAttribute:name value:value]) { + if (![_delegate respondsToSelector:@selector(textNode:shouldHighlightLinkAttribute:value:)] || + ![_delegate textNode:self shouldHighlightLinkAttribute:name value:value]) { value = nil; name = nil; } @@ -477,8 +477,8 @@ ASDISPLAYNODE_INLINE CGFloat ceilPixelValue(CGFloat f) } // Ask our delegate if a long-press on an attribute is relevant - if ([self.delegate respondsToSelector:@selector(richTextNode:shouldLongPressLinkAttribute:value:)]) { - return [self.delegate richTextNode:self shouldLongPressLinkAttribute:_highlightedLinkAttributeName value:_highlightedLinkAttributeValue]; + if ([self.delegate respondsToSelector:@selector(textNode:shouldLongPressLinkAttribute:value:)]) { + return [self.delegate textNode:self shouldLongPressLinkAttribute:_highlightedLinkAttributeName value:_highlightedLinkAttributeValue]; } // Otherwise we are good to go. @@ -703,14 +703,14 @@ ASDISPLAYNODE_INLINE CGFloat ceilPixelValue(CGFloat f) { [super touchesEnded:touches withEvent:event]; - if ([self _pendingLinkTap] && [_delegate respondsToSelector:@selector(richTextNode:tappedLinkAttribute:value:atPoint:textRange:)]) { + if ([self _pendingLinkTap] && [_delegate respondsToSelector:@selector(textNode:tappedLinkAttribute:value:atPoint:textRange:)]) { CGPoint point = [[touches anyObject] locationInView:self.view]; - [_delegate richTextNode:self tappedLinkAttribute:_highlightedLinkAttributeName value:_highlightedLinkAttributeValue atPoint:point textRange:_highlightRange]; + [_delegate textNode:self tappedLinkAttribute:_highlightedLinkAttributeName value:_highlightedLinkAttributeValue atPoint:point textRange:_highlightRange]; } if ([self _pendingTruncationTap]) { - if ([_delegate respondsToSelector:@selector(richTextNodeTappedTruncationToken:)]) { - [_delegate richTextNodeTappedTruncationToken:self]; + if ([_delegate respondsToSelector:@selector(textNodeTappedTruncationToken:)]) { + [_delegate textNodeTappedTruncationToken:self]; } } @@ -728,9 +728,9 @@ ASDISPLAYNODE_INLINE CGFloat ceilPixelValue(CGFloat f) { // Respond to long-press when it begins, not when it ends. if (longPressRecognizer.state == UIGestureRecognizerStateBegan) { - if ([self.delegate respondsToSelector:@selector(richTextNode:longPressedLinkAttribute:value:atPoint:textRange:)]) { + if ([self.delegate respondsToSelector:@selector(textNode:longPressedLinkAttribute:value:atPoint:textRange:)]) { CGPoint touchPoint = [_longPressGestureRecognizer locationInView:self.view]; - [self.delegate richTextNode:self longPressedLinkAttribute:_highlightedLinkAttributeName value:_highlightedLinkAttributeValue atPoint:touchPoint textRange:_highlightRange]; + [self.delegate textNode:self longPressedLinkAttribute:_highlightedLinkAttributeName value:_highlightedLinkAttributeValue atPoint:touchPoint textRange:_highlightRange]; } } } diff --git a/AsyncDisplayKitTests/ASTextNodeTests.m b/AsyncDisplayKitTests/ASTextNodeTests.m index 9cf20d2022..f5a34a6a03 100644 --- a/AsyncDisplayKitTests/ASTextNodeTests.m +++ b/AsyncDisplayKitTests/ASTextNodeTests.m @@ -24,13 +24,13 @@ @implementation ASTextNodeTestDelegate -- (void)richTextNode:(ASTextNode *)richTextNode tappedLinkAttribute:(NSString *)attribute value:(id)value atPoint:(CGPoint)point textRange:(NSRange)textRange +- (void)textNode:(ASTextNode *)textNode tappedLinkAttribute:(NSString *)attribute value:(id)value atPoint:(CGPoint)point textRange:(NSRange)textRange { _tappedLinkAttribute = attribute; _tappedLinkValue = value; } -- (BOOL)richTextNode:(ASTextNode *)richTextNode shouldHighlightLinkAttribute:(NSString *)attribute value:(id)value +- (BOOL)textNode:(ASTextNode *)textNode shouldHighlightLinkAttribute:(NSString *)attribute value:(id)value { return YES; }