body = [[(CommentNode *)arg1 comment] body]; | body = [[(CommentNode *)arg1 comment] body]; | ||||
} | } | ||||
if ((isTFDeletedOnly && ([body isEqualToString:@"[deleted]"] || [body isEqualToString:@"[removed]"])) || !isTFDeletedOnly) { | |||||
if ([%c(TFHelper) shouldShowUndeleteButtonWithInfo:body isDeletedOnly:isTFDeletedOnly]){ | |||||
CGSize refSize = [[self buttons][0] frame].size; | CGSize refSize = [[self buttons][0] frame].size; | ||||
NSString *commentBody = [[[arg1 comment] commentText] body]; | NSString *commentBody = [[[arg1 comment] commentText] body]; | ||||
if ((isTFDeletedOnly && ([commentBody isEqualToString:@"[deleted]"] || [commentBody isEqualToString:@"[removed]"])) || !isTFDeletedOnly){ | |||||
if ([%c(TFHelper) shouldShowUndeleteButtonWithInfo:commentBody isDeletedOnly:isTFDeletedOnly]){ | |||||
tfAntennaController = self; | tfAntennaController = self; | ||||
tfAntennaCommentCell = arg1; | tfAntennaCommentCell = arg1; | ||||
shouldHaveAntennaUndeleteAction = YES; | shouldHaveAntennaUndeleteAction = YES; | ||||
NSString *postBody = [[post selfCommentText] body]; | NSString *postBody = [[post selfCommentText] body]; | ||||
if ([post isSelfPost]){ | if ([post isSelfPost]){ | ||||
if ((isTFDeletedOnly && ([postBody isEqualToString:@"[deleted]"] || [postBody isEqualToString:@"[removed]"])) || !isTFDeletedOnly) { | |||||
if ([%c(TFHelper) shouldShowUndeleteButtonWithInfo:postBody isDeletedOnly:isTFDeletedOnly]){ | |||||
isAbleToUndeletePost = YES; | isAbleToUndeletePost = YES; | ||||
NSMutableArray *barButtons = [self defaultHeaderButtons]; | NSMutableArray *barButtons = [self defaultHeaderButtons]; |
id commentBody = [MSHookIvar<id>(self, "comment") body]; | id commentBody = [MSHookIvar<id>(self, "comment") body]; | ||||
if ((isTFDeletedOnly && ([commentBody isEqualToString:@"[deleted]"] || [commentBody isEqualToString:@"[removed]"])) || !isTFDeletedOnly) { | |||||
if ([%c(TFHelper) shouldShowUndeleteButtonWithInfo:commentBody isDeletedOnly:isTFDeletedOnly]){ | |||||
CGFloat imageSize = 20.0f; | CGFloat imageSize = 20.0f; | ||||
id postBody = [post selfText]; | id postBody = [post selfText]; | ||||
if ([post isSelfPost]){ | if ([post isSelfPost]){ | ||||
if ((isTFDeletedOnly && ([postBody isEqualToString:@"[deleted]"] || [postBody isEqualToString:@"[removed]"])) || !isTFDeletedOnly) { | |||||
if ([%c(TFHelper) shouldShowUndeleteButtonWithInfo:postBody isDeletedOnly:isTFDeletedOnly]){ | |||||
CGFloat imageSize = 20.0f; | CGFloat imageSize = 20.0f; | ||||
NSString *commentBody = [[arg1 comment] body]; | NSString *commentBody = [[arg1 comment] body]; | ||||
if ((isTFDeletedOnly && ([commentBody isEqualToString:@"[deleted]"] || [commentBody isEqualToString:@"[removed]"])) || !isTFDeletedOnly) { | |||||
if ([%c(TFHelper) shouldShowUndeleteButtonWithInfo:commentBody isDeletedOnly:isTFDeletedOnly]){ | |||||
shouldHaveBRUndeleteAction = YES; | shouldHaveBRUndeleteAction = YES; | ||||
tfCommentCellView = arg1; | tfCommentCellView = arg1; | ||||
tfStoryController = self; | tfStoryController = self; | ||||
if ([[self story] is_selfValue]){ | if ([[self story] is_selfValue]){ | ||||
NSString *postBody = [[self story] selftext]; | NSString *postBody = [[self story] selftext]; | ||||
if ((isTFDeletedOnly && ([postBody isEqualToString:@"[deleted]"] || [postBody isEqualToString:@"[removed]"])) || !isTFDeletedOnly) { | |||||
if ([%c(TFHelper) shouldShowUndeleteButtonWithInfo:postBody isDeletedOnly:isTFDeletedOnly]){ | |||||
shouldHaveBRUndeleteAction = YES; | shouldHaveBRUndeleteAction = YES; | ||||
tfCommentCellView = nil; | tfCommentCellView = nil; | ||||
tfStoryController = self; | tfStoryController = self; |
NSString *commentBody = [[self comment] content]; | NSString *commentBody = [[self comment] content]; | ||||
if ((isTFDeletedOnly && ([commentBody isEqualToString:@"[deleted]"] || [commentBody isEqualToString:@"[removed]"])) || !isTFDeletedOnly){ | |||||
if ([%c(TFHelper) shouldShowUndeleteButtonWithInfo:commentBody isDeletedOnly:isTFDeletedOnly]){ | |||||
CGFloat authorTextHeight = [[self authorButton] frame].size.height; | CGFloat authorTextHeight = [[self authorButton] frame].size.height; | ||||
NSString *postBody = [[self post] content]; | NSString *postBody = [[self post] content]; | ||||
if ((isTFDeletedOnly && ([postBody isEqualToString:@"[deleted]"] || [postBody isEqualToString:@"[removed]"])) || !isTFDeletedOnly){ | |||||
if ([%c(TFHelper) shouldShowUndeleteButtonWithInfo:postBody isDeletedOnly:isTFDeletedOnly]){ | |||||
id moreButton = MSHookIvar<id>(self, "moreButton"); | id moreButton = MSHookIvar<id>(self, "moreButton"); | ||||
NSString *commentBody = MSHookIvar<NSString*>([arg1 comment], "_body"); | NSString *commentBody = MSHookIvar<NSString*>([arg1 comment], "_body"); | ||||
if ((isTFDeletedOnly && ([commentBody isEqualToString:@"[deleted]"] || [commentBody isEqualToString:@"[removed]"])) || !isTFDeletedOnly){ | |||||
if ([%c(TFHelper) shouldShowUndeleteButtonWithInfo:commentBody isDeletedOnly:isTFDeletedOnly]){ | |||||
tfComment = [arg1 comment]; | tfComment = [arg1 comment]; | ||||
tfController = self; | tfController = self; | ||||
shouldHaveUndeleteAction = YES; | shouldHaveUndeleteAction = YES; | ||||
NSString *postBody = [[self link] selfText]; | NSString *postBody = [[self link] selfText]; | ||||
if ((isTFDeletedOnly && ([postBody isEqualToString:@"[deleted]"] || [postBody isEqualToString:@"[removed]"])) || !isTFDeletedOnly){ | |||||
if ([%c(TFHelper) shouldShowUndeleteButtonWithInfo:postBody isDeletedOnly:isTFDeletedOnly]){ | |||||
tfController = self; | tfController = self; | ||||
tfComment = nil; | tfComment = nil; | ||||
shouldHaveUndeleteAction = YES; | shouldHaveUndeleteAction = YES; | ||||
NSString *commentBody = MSHookIvar<NSString*>([arg1 comment], "_body"); | NSString *commentBody = MSHookIvar<NSString*>([arg1 comment], "_body"); | ||||
if ((isTFDeletedOnly && ([commentBody isEqualToString:@"[deleted]"] || [commentBody isEqualToString:@"[removed]"])) || !isTFDeletedOnly){ | |||||
if ([%c(TFHelper) shouldShowUndeleteButtonWithInfo:commentBody isDeletedOnly:isTFDeletedOnly]){ | |||||
tfComment = [arg1 comment]; | tfComment = [arg1 comment]; | ||||
tfController = self; | tfController = self; | ||||
shouldHaveUndeleteAction = YES; | shouldHaveUndeleteAction = YES; |
NSString *commentBody = [[self comment] bodyText]; | NSString *commentBody = [[self comment] bodyText]; | ||||
if ((isTFDeletedOnly && ([commentBody isEqualToString:@"[deleted]"] || [commentBody isEqualToString:@"[removed]"])) || !isTFDeletedOnly){ | |||||
if ([%c(TFHelper) shouldShowUndeleteButtonWithInfo:commentBody isDeletedOnly:isTFDeletedOnly]){ | |||||
UIImage* origImage = [UIImage imageWithContentsOfFile:@"/var/mobile/Library/Application Support/TFDidThatSay/eye160dark.png"]; | UIImage* origImage = [UIImage imageWithContentsOfFile:@"/var/mobile/Library/Application Support/TFDidThatSay/eye160dark.png"]; | ||||
NSString *postBody = [post selfText]; | NSString *postBody = [post selfText]; | ||||
if ([post isSelfPost]){ | if ([post isSelfPost]){ | ||||
if ((isTFDeletedOnly && ([postBody isEqualToString:@"[deleted]"] || [postBody isEqualToString:@"[removed]"])) || !isTFDeletedOnly){ | |||||
if ([%c(TFHelper) shouldShowUndeleteButtonWithInfo:postBody isDeletedOnly:isTFDeletedOnly]){ | |||||
UIImage* origImage = [UIImage imageWithContentsOfFile:@"/var/mobile/Library/Application Support/TFDidThatSay/eye160dark.png"]; | UIImage* origImage = [UIImage imageWithContentsOfFile:@"/var/mobile/Library/Application Support/TFDidThatSay/eye160dark.png"]; | ||||
NSString *commentBody = [[self comment] bodyText]; | NSString *commentBody = [[self comment] bodyText]; | ||||
if ((isTFDeletedOnly && ([commentBody isEqualToString:@"[deleted]"] || [commentBody isEqualToString:@"[removed]"])) || !isTFDeletedOnly){ | |||||
if ([%c(TFHelper) shouldShowUndeleteButtonWithInfo:commentBody isDeletedOnly:isTFDeletedOnly]){ | |||||
UIImage* origImage = [UIImage imageWithContentsOfFile:@"/var/mobile/Library/Application Support/TFDidThatSay/eye160dark.png"]; | UIImage* origImage = [UIImage imageWithContentsOfFile:@"/var/mobile/Library/Application Support/TFDidThatSay/eye160dark.png"]; | ||||
NSString *postBody = [post selfText]; | NSString *postBody = [post selfText]; | ||||
if ([post isSelfPost]){ | if ([post isSelfPost]){ | ||||
if ((isTFDeletedOnly && ([postBody isEqualToString:@"[deleted]"] || [postBody isEqualToString:@"[removed]"])) || !isTFDeletedOnly){ | |||||
if ([%c(TFHelper) shouldShowUndeleteButtonWithInfo:postBody isDeletedOnly:isTFDeletedOnly]){ | |||||
UIImage* origImage = [UIImage imageWithContentsOfFile:@"/var/mobile/Library/Application Support/TFDidThatSay/eye160dark.png"]; | UIImage* origImage = [UIImage imageWithContentsOfFile:@"/var/mobile/Library/Application Support/TFDidThatSay/eye160dark.png"]; | ||||
%new | %new | ||||
-(void) addUndeleteButtonToMenu{ | -(void) addUndeleteButtonToMenu{ | ||||
NSString *body = [MSHookIvar<id>(self, "comment") body]; | |||||
if ((isTFDeletedOnly && ([body isEqualToString:@"[deleted]"] || [body isEqualToString:@"[removed]"])) || !isTFDeletedOnly){ | |||||
NSString *commentBody = [MSHookIvar<id>(self, "comment") body]; | |||||
if ([%c(TFHelper) shouldShowUndeleteButtonWithInfo:commentBody isDeletedOnly:isTFDeletedOnly]){ | |||||
id controller = MSHookIvar<id>(self, "parent"); | id controller = MSHookIvar<id>(self, "parent"); | ||||
NSString *postBody = [post body]; | NSString *postBody = [post body]; | ||||
if ((isTFDeletedOnly && ([postBody isEqualToString:@"[deleted]"] || [postBody isEqualToString:@"[removed]"])) || !isTFDeletedOnly){ | |||||
if ([%c(TFHelper) shouldShowUndeleteButtonWithInfo:postBody isDeletedOnly:isTFDeletedOnly]){ | |||||
return YES; | return YES; | ||||
} | } | ||||
} | } |
@interface TFHelper : NSObject | @interface TFHelper : NSObject | ||||
+(void) getUndeleteDataWithID:(NSString *) ident isComment:(BOOL) isComment timeout:(CGFloat) timeout extraData:(NSDictionary *) extra completionTarget:(id) target completionSelector:(SEL) sel; | +(void) getUndeleteDataWithID:(NSString *) ident isComment:(BOOL) isComment timeout:(CGFloat) timeout extraData:(NSDictionary *) extra completionTarget:(id) target completionSelector:(SEL) sel; | ||||
+(BOOL) shouldShowUndeleteButtonWithInfo:(NSString *) content isDeletedOnly:(BOOL) isDeletedOnly; | |||||
@end | @end |
}]; | }]; | ||||
} | } | ||||
@end | |||||
+(BOOL) shouldShowUndeleteButtonWithInfo:(NSString *) content isDeletedOnly:(BOOL) isDeletedOnly{ | |||||
if (!isDeletedOnly){ | |||||
return YES; | |||||
} else { | |||||
if ([content isEqualToString:@"[deleted]"] || [content isEqualToString:@"[removed]"]){ | |||||
return YES; | |||||
} else if ([content hasPrefix:@"[pushshift"] || [content hasPrefix:@"[an error occured"]){ | |||||
return YES; | |||||
} | |||||
} | |||||
return NO; | |||||
} | |||||
@end |