|
|
|
|
|
|
|
|
%group Apollo
|
|
|
%group Apollo
|
|
|
|
|
|
|
|
|
NSDictionary* apolloBodyAttributes = nil;
|
|
|
NSDictionary* apolloBodyAttributes = nil;
|
|
|
|
|
|
|
|
|
BOOL shouldAddUndeleteCell = NO;
|
|
|
BOOL shouldAddUndeleteCell = NO;
|
|
|
id apolloCommentCell;
|
|
|
id apolloCommentCell;
|
|
|
id apolloCommentController;
|
|
|
id apolloCommentController;
|
|
|
|
|
|
|
|
|
|
|
|
BOOL shouldAddUndeleteCellForContext = NO;
|
|
|
|
|
|
id apolloCommentCellForContext;
|
|
|
|
|
|
id apolloCommentsControllerForContext;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
%hook ApolloButtonNode
|
|
|
%hook ApolloButtonNode
|
|
|
%end
|
|
|
%end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
NSString *commentBody = [MSHookIvar<RKComment *>(self, "comment") body];
|
|
|
NSString *commentBody = [MSHookIvar<RKComment *>(self, "comment") body];
|
|
|
|
|
|
|
|
|
if ([%c(TFHelper) shouldShowUndeleteButtonWithInfo:commentBody isDeletedOnly:isTFDeletedOnly]){
|
|
|
|
|
|
|
|
|
if ([%c(TFHelper) shouldShowUndeleteButtonWithInfo:commentBody isDeletedOnly:isTFDeletedOnly]) {
|
|
|
shouldAddUndeleteCell = YES;
|
|
|
shouldAddUndeleteCell = YES;
|
|
|
apolloCommentCell = self;
|
|
|
apolloCommentCell = self;
|
|
|
apolloCommentController = nil;
|
|
|
apolloCommentController = nil;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
NSString *commentBody = [MSHookIvar<RKComment *>(self, "comment") body];
|
|
|
NSString *commentBody = [MSHookIvar<RKComment *>(self, "comment") body];
|
|
|
|
|
|
|
|
|
if ([%c(TFHelper) shouldShowUndeleteButtonWithInfo:commentBody isDeletedOnly:isTFDeletedOnly]){
|
|
|
|
|
|
|
|
|
if ([%c(TFHelper) shouldShowUndeleteButtonWithInfo:commentBody isDeletedOnly:isTFDeletedOnly]) {
|
|
|
shouldAddUndeleteCell = YES;
|
|
|
shouldAddUndeleteCell = YES;
|
|
|
apolloCommentCell = self;
|
|
|
apolloCommentCell = self;
|
|
|
apolloCommentController = nil;
|
|
|
apolloCommentController = nil;
|
|
|
|
|
|
|
|
|
- (void)didLoad {
|
|
|
- (void)didLoad {
|
|
|
%orig;
|
|
|
%orig;
|
|
|
|
|
|
|
|
|
|
|
|
//HBLogDebug(@"didLoad - actionDelegate:%@", MSHookIvar<id>(self, "actionDelegate"));
|
|
|
|
|
|
|
|
|
if (shouldApolloHaveButton){
|
|
|
if (shouldApolloHaveButton){
|
|
|
|
|
|
|
|
|
NSString *commentBody = [MSHookIvar<RKComment *>(self, "comment") body];
|
|
|
NSString *commentBody = [MSHookIvar<RKComment *>(self, "comment") body];
|
|
|
|
|
|
|
|
|
if ([%c(TFHelper) shouldShowUndeleteButtonWithInfo:commentBody isDeletedOnly:isTFDeletedOnly]){
|
|
|
|
|
|
|
|
|
if ([%c(TFHelper) shouldShowUndeleteButtonWithInfo:commentBody isDeletedOnly:isTFDeletedOnly]) {
|
|
|
|
|
|
|
|
|
CGFloat imageSize = 20.0f;
|
|
|
CGFloat imageSize = 20.0f;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[[self view] addSubview:undeleteButton];
|
|
|
[[self view] addSubview:undeleteButton];
|
|
|
[self setUndeleteButton:undeleteButton];
|
|
|
[self setUndeleteButton:undeleteButton];
|
|
|
}
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
|
|
|
|
id actionDelegate = MSHookIvar<id>(self, "actionDelegate");
|
|
|
|
|
|
[actionDelegate setCommentCellNode:self];
|
|
|
|
|
|
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
- (void)_layoutSublayouts {
|
|
|
- (void)_layoutSublayouts {
|
|
|
%orig;
|
|
|
%orig;
|
|
|
|
|
|
|
|
|
if (shouldApolloHaveButton){
|
|
|
|
|
|
if ([self undeleteButton]){
|
|
|
|
|
|
|
|
|
if (shouldApolloHaveButton) {
|
|
|
|
|
|
if ([self undeleteButton]) {
|
|
|
|
|
|
|
|
|
CGFloat imageSize = 20.0f;
|
|
|
CGFloat imageSize = 20.0f;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
RKLink *post = MSHookIvar<RKLink *>(self, "link");
|
|
|
RKLink *post = MSHookIvar<RKLink *>(self, "link");
|
|
|
NSString *postBody = [post selfText];
|
|
|
NSString *postBody = [post selfText];
|
|
|
|
|
|
|
|
|
if ([post isSelfPost]){
|
|
|
|
|
|
if ([%c(TFHelper) shouldShowUndeleteButtonWithInfo:postBody isDeletedOnly:isTFDeletedOnly]){
|
|
|
|
|
|
|
|
|
if ([post isSelfPost]) {
|
|
|
|
|
|
if ([%c(TFHelper) shouldShowUndeleteButtonWithInfo:postBody isDeletedOnly:isTFDeletedOnly]) {
|
|
|
shouldAddUndeleteCell = YES;
|
|
|
shouldAddUndeleteCell = YES;
|
|
|
apolloCommentCell = nil;
|
|
|
apolloCommentCell = nil;
|
|
|
apolloCommentController = self;
|
|
|
apolloCommentController = self;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
%end
|
|
|
%end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
%hook UIMenu
|
|
|
|
|
|
|
|
|
|
|
|
- (id)menuByReplacingChildren:(id)arg5 {
|
|
|
|
|
|
|
|
|
|
|
|
if (shouldAddUndeleteCellForContext) {
|
|
|
|
|
|
|
|
|
|
|
|
UIAction *action = [UIAction actionWithTitle:@"TF Did That Say?" image:[UIImage systemImageNamed:@"eye"] identifier:@"testident" handler:^(__kindof UIAction* _Nonnull action) {
|
|
|
|
|
|
|
|
|
|
|
|
id commentCell = apolloCommentCellForContext;
|
|
|
|
|
|
id commentsController = apolloCommentsControllerForContext;
|
|
|
|
|
|
|
|
|
|
|
|
if (commentCell) {
|
|
|
|
|
|
[commentCell undeleteCellWasSelected];
|
|
|
|
|
|
} else {
|
|
|
|
|
|
[commentsController undeleteCellWasSelected];
|
|
|
|
|
|
}
|
|
|
|
|
|
}];
|
|
|
|
|
|
|
|
|
|
|
|
arg5 = [arg5 arrayByAddingObject:action];
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return %orig;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
%end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
%hook CommentSectionController
|
|
|
|
|
|
%property(strong, nonatomic) id commentCellNode;
|
|
|
|
|
|
|
|
|
|
|
|
- (id)contextMenuInteraction:(id)arg1 configurationForMenuAtLocation:(CGPoint)arg2 {
|
|
|
|
|
|
|
|
|
|
|
|
if (!shouldApolloHaveButton) {
|
|
|
|
|
|
|
|
|
|
|
|
NSString *commentBody = [MSHookIvar<RKComment *>(self, "comment") body];
|
|
|
|
|
|
|
|
|
|
|
|
if ([%c(TFHelper) shouldShowUndeleteButtonWithInfo:commentBody isDeletedOnly:isTFDeletedOnly]) {
|
|
|
|
|
|
shouldAddUndeleteCellForContext = YES;
|
|
|
|
|
|
apolloCommentCellForContext = [self commentCellNode];
|
|
|
|
|
|
apolloCommentsControllerForContext = nil;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return %orig;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
%new
|
|
|
|
|
|
- (void)contextMenuInteraction:(id)arg1 willEndForConfiguration:(id)arg2 animator:(id)arg3 {
|
|
|
|
|
|
|
|
|
|
|
|
shouldAddUndeleteCellForContext = NO;
|
|
|
|
|
|
apolloCommentCellForContext = nil;
|
|
|
|
|
|
apolloCommentsControllerForContext = nil;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
%end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
%hook CommentsHeaderSectionController
|
|
|
|
|
|
|
|
|
|
|
|
- (id)contextMenuInteraction:(id)arg1 configurationForMenuAtLocation:(CGPoint)arg2 {
|
|
|
|
|
|
|
|
|
|
|
|
id commentsController = MSHookIvar<id>(self, "viewController");
|
|
|
|
|
|
|
|
|
|
|
|
RKLink *post = MSHookIvar<RKLink *>(commentsController, "link");
|
|
|
|
|
|
NSString *postBody = [post selfText];
|
|
|
|
|
|
|
|
|
|
|
|
if ([post isSelfPost]) {
|
|
|
|
|
|
if ([%c(TFHelper) shouldShowUndeleteButtonWithInfo:postBody isDeletedOnly:isTFDeletedOnly]) {
|
|
|
|
|
|
shouldAddUndeleteCellForContext = YES;
|
|
|
|
|
|
apolloCommentCellForContext = nil;
|
|
|
|
|
|
apolloCommentsControllerForContext = commentsController;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return %orig;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
%new
|
|
|
|
|
|
- (void)contextMenuInteraction:(id)arg1 willEndForConfiguration:(id)arg2 animator:(id)arg3 {
|
|
|
|
|
|
|
|
|
|
|
|
shouldAddUndeleteCellForContext = NO;
|
|
|
|
|
|
apolloCommentCellForContext = nil;
|
|
|
|
|
|
apolloCommentsControllerForContext = nil;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
%end
|
|
|
|
|
|
|
|
|
%end
|
|
|
%end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
%ctor {
|
|
|
%ctor {
|
|
|
|
|
|
|
|
|
loadPrefs();
|
|
|
loadPrefs();
|
|
|
|
|
|
|
|
|
NSString* processName = [[NSProcessInfo processInfo] processName];
|
|
|
NSString* processName = [[NSProcessInfo processInfo] processName];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), NULL, (CFNotificationCallback)prefsChanged, CFSTR("com.lint.undelete.prefs.changed"), NULL, CFNotificationSuspensionBehaviorCoalesce);
|
|
|
CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), NULL, (CFNotificationCallback)prefsChanged, CFSTR("com.lint.undelete.prefs.changed"), NULL, CFNotificationSuspensionBehaviorCoalesce);
|
|
|
|
|
|
|
|
|
%init(Apollo, CommentsHeaderCellNode = objc_getClass("Apollo.CommentsHeaderCellNode"), CommentCellNode = objc_getClass("Apollo.CommentCellNode"), ApolloButtonNode = objc_getClass("Apollo.ApolloButtonNode"), ActionController = objc_getClass("Apollo.ActionController"), IconActionTableViewCell = objc_getClass("Apollo.IconActionTableViewCell"), CommentsViewController = objc_getClass("Apollo.CommentsViewController"));
|
|
|
|
|
|
|
|
|
%init(Apollo, CommentsHeaderCellNode = objc_getClass("Apollo.CommentsHeaderCellNode"), CommentCellNode = objc_getClass("Apollo.CommentCellNode"), ApolloButtonNode = objc_getClass("Apollo.ApolloButtonNode"), ActionController = objc_getClass("Apollo.ActionController"), IconActionTableViewCell = objc_getClass("Apollo.IconActionTableViewCell"), CommentsViewController = objc_getClass("Apollo.CommentsViewController"), CommentSectionController = objc_getClass("Apollo.CommentSectionController"), CommentsHeaderSectionController = objc_getClass("Apollo.CommentsHeaderSectionController"));
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|