From 8a9151368098feb303252a811761109c5c08086d Mon Sep 17 00:00:00 2001 From: lint <47455468+lint@users.noreply.github.com> Date: Thu, 10 Oct 2019 14:52:23 -0400 Subject: [PATCH] Fix Apollo bug, add prefs, update Narwhal menu --- Makefile | 6 +- control | 2 +- prefs/Makefile | 17 +++ prefs/Resources/Info.plist | 24 +++++ prefs/Resources/Root.plist | 29 ++++++ prefs/Resources/icon.png | Bin 0 -> 3249 bytes prefs/Resources/icon@2x.png | Bin 0 -> 3791 bytes prefs/Resources/icon@3x.png | Bin 0 -> 4349 bytes prefs/TFDTSRootListController.h | 5 + prefs/TFDTSRootListController.m | 13 +++ prefs/entry.plist | 21 ++++ tfdidthatsay.plist | Bin 172 -> 148 bytes tweak/Apollo.h | 5 +- tweak/Apollo.xm | 75 +++++++++----- tweak/Narwhal.xm | 177 ++++++++++---------------------- 15 files changed, 219 insertions(+), 155 deletions(-) create mode 100644 prefs/Makefile create mode 100644 prefs/Resources/Info.plist create mode 100644 prefs/Resources/Root.plist create mode 100644 prefs/Resources/icon.png create mode 100644 prefs/Resources/icon@2x.png create mode 100644 prefs/Resources/icon@3x.png create mode 100644 prefs/TFDTSRootListController.h create mode 100644 prefs/TFDTSRootListController.m create mode 100644 prefs/entry.plist diff --git a/Makefile b/Makefile index df0db51..19b277b 100644 --- a/Makefile +++ b/Makefile @@ -8,7 +8,11 @@ tweak/Narwhal.xm_CFLAGS = -fobjc-arc include $(THEOS_MAKE_PATH)/tweak.mk +SUBPROJECTS += prefs +include $(THEOS_MAKE_PATH)/aggregate.mk + + after-install:: install.exec "killall -9 Reddit" install.exec "killall -9 Apollo" - install.exec "killall -9 narwhal" \ No newline at end of file + install.exec "killall -9 narwhal" diff --git a/control b/control index ec98a2c..0d89210 100644 --- a/control +++ b/control @@ -1,7 +1,7 @@ Package: com.lint.undelete Name: TFDidThatSay? Depends: mobilesubstrate -Version: 1.2.2 +Version: 1.2.3 Architecture: iphoneos-arm Description: See "[deleted]" comments and posts without leaving Reddit! Maintainer: lint diff --git a/prefs/Makefile b/prefs/Makefile new file mode 100644 index 0000000..a94143a --- /dev/null +++ b/prefs/Makefile @@ -0,0 +1,17 @@ +include $(THEOS)/makefiles/common.mk + +ARCHS = arm64 arm64e + +BUNDLE_NAME = TFDidThatSayPrefs + +TFDidThatSayPrefs_FILES = TFDTSRootListController.m +TFDidThatSayPrefs_INSTALL_PATH = /Library/PreferenceBundles +TFDidThatSayPrefs_FRAMEWORKS = UIKit +TFDidThatSayPrefs_PRIVATE_FRAMEWORKS = Preferences +TFDidThatSayPrefs_CFLAGS = -fobjc-arc + +include $(THEOS_MAKE_PATH)/bundle.mk + +internal-stage:: + $(ECHO_NOTHING)mkdir -p $(THEOS_STAGING_DIR)/Library/PreferenceLoader/Preferences$(ECHO_END) + $(ECHO_NOTHING)cp entry.plist $(THEOS_STAGING_DIR)/Library/PreferenceLoader/Preferences/TFDidThatSayPrefs.plist$(ECHO_END) diff --git a/prefs/Resources/Info.plist b/prefs/Resources/Info.plist new file mode 100644 index 0000000..3553794 --- /dev/null +++ b/prefs/Resources/Info.plist @@ -0,0 +1,24 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + TFDidThatSayPrefs + CFBundleIdentifier + com.lint.undelete.prefs + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + BNDL + CFBundleShortVersionString + 1.0.0 + CFBundleSignature + ???? + CFBundleVersion + 1.0 + NSPrincipalClass + TFDTSRootListController + + diff --git a/prefs/Resources/Root.plist b/prefs/Resources/Root.plist new file mode 100644 index 0000000..c39d9d3 --- /dev/null +++ b/prefs/Resources/Root.plist @@ -0,0 +1,29 @@ + + + + + items + + + cell + PSGroupCell + label + Apollo + + + cell + PSSwitchCell + default + + defaults + com.lint.undelete.prefs + key + isApolloDeletedCommentsOnly + label + Only display eye on deleted comments + + + title + TFDidThatSay? + + diff --git a/prefs/Resources/icon.png b/prefs/Resources/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..3bc919e806bcd8933269a47143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TPlfP|z zrTyx_>lv@x#=^!PzR7qqF<$gm`|ZJZ+;<)Cqu&ot2z=0000WV@Og>004R=004l4008;_004mL004C`008P>0026e000+nl3&F} z0005pNkl6qEoNnmu~CdDOPj*>=F#4N<5WOWx(BxOX+ZisBIg=gwG-QT^}OKk3Ub575Bp5OPJ@AI7J{MxG3 zs(+1H{sUU1Ez-Y&+0e6hU$Yx5VFx;}0H5$0k8m4b8hvE6Jp6;S0p{W~24*%{14m=L zffJbg6M6ga6(iI9VIPfy}=>WM1Ehv;%LkBD251*_dC#Fji+iSMaRHA)aDq5$T%9*ZdlR z4`bXG62rkI9L0EJ|dS z5yRsc7uO*@j%&HR7Sos%uZ|Lzu>BRPS)IRtkHHm)L}Rw#2E& zqX<(B#+8~XZ1{E1k8`*XyA~3575LwbCNkOZm1%%V+_9zT!CEZAJbaE`I}y!(x|!#y jt@St9B5jfW3ce2j8Cqa7vddun00000NkvXXu0mjfoO}_S literal 0 HcmV?d00001 diff --git a/prefs/Resources/icon@2x.png b/prefs/Resources/icon@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..f44fc1789cb9572b3ca5ba88a32962876d6d77dc GIT binary patch literal 3791 zcmV;=4lwbFP)KLZ*U+IBfRsybQWXdwQbLP>6pAqfylh#{fb6;Z(vMMVS~$e@S=j*ftg6;Uhf59&ghTmgWD0l;*T zI709Y^p6lP1rIRMx#05C~cW=H_Aw*bJ-5DT&Z2n+x)QHX^p z00esgV8|mQcmRZ%02D^@S3L16t`O%c004NIvOKvYIYoh62rY33S640`D9%Y2D-rV&neh&#Q1i z007~1e$oCcFS8neI|hJl{-P!B1ZZ9hpmq0)X0i`JwE&>$+E?>%_LC6RbVIkUx0b+_+BaR3cnT7Zv!AJxW zizFb)h!jyGOOZ85F;a?DAXP{m@;!0_IfqH8(HlgRxt7s3}k3K`kFu>>-2Q$QMFfPW!La{h336o>X zu_CMttHv6zR;&ZNiS=X8v3CR#fknUxHUxJ0uoBa_M6WNWeqIg~6QE69c9o#e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0@W>meb})e1v^^L-d6LZ&zf-Bo^Y#ir*V^l4vbp_n>h50ksf)85b2y zR_~>_*7$^McMQ!j*Mfq!o3R9Y79sj(oOMO887mXATYAuaD#v_la%A8nhK3tw5*>>b zIHQL1bv=Gg$c9%*BJ(gJ&gH>TfHWuc*4D6&VQ~{0Ta9S9(OR&zU}#K=1#O5DuLWHR zom#(ujlj{>7P1fn3uL@X?2o+@vi2O~`c~+6ro>%QY>8V?OV%6T6t{m z3XD%4IfHR;?M_;&F*ABfUnj;~ zP@v{r96PzLwl*~Ubr>(Xq0W;ezMQ$$_;_jTf zOKtD^rC~$3T2GmK8T#a~ac@f1Rk!=-^ti5NVL)^iCKQKGkqw4QFF_5}OglK+UK}U-t`K5{3F){9cDS+i`zXM$>vr zvK~8HiFe}Zk4xj4Hzw=mUxBY|Z)eVrxUMT2@$Kc8Xq(K6`0I|tfl>7Lt*E>@BmUa) zVT^4E`jr0#EQyvxOQI#wl4wb^Bw7+JiIzl5qW=l}JpiI1%q}cd3@88q002ovPDHLk FV1g(uC+z?L literal 0 HcmV?d00001 diff --git a/prefs/Resources/icon@3x.png b/prefs/Resources/icon@3x.png new file mode 100644 index 0000000000000000000000000000000000000000..95dd6eabc73f0ac9e299bbc5b5c6865be90d41d0 GIT binary patch literal 4349 zcmVKLZ*U+IBfRsybQWXdwQbLP>6pAqfylh#{fb6;Z(vMMVS~$e@S=j*ftg6;Uhf59&ghTmgWD0l;*T zI709Y^p6lP1rIRMx#05C~cW=H_Aw*bJ-5DT&Z2n+x)QHX^p z00esgV8|mQcmRZ%02D^@S3L16t`O%c004NIvOKvYIYoh62rY33S640`D9%Y2D-rV&neh&#Q1i z007~1e$oCcFS8neI|hJl{-P!B1ZZ9hpmq0)X0i`JwE&>$+E?>%_LC6RbVIkUx0b+_+BaR3cnT7Zv!AJxW zizFb)h!jyGOOZ85F;a?DAXP{m@;!0_IfqH8(HlgRxt7s3}k3K`kFu>>-2Q$QMFfPW!La{h336o>X zu_CMttHv6zR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--git a/prefs/TFDTSRootListController.h b/prefs/TFDTSRootListController.h new file mode 100644 index 0000000..e96e2b1 --- /dev/null +++ b/prefs/TFDTSRootListController.h @@ -0,0 +1,5 @@ +#import + +@interface TFDTSRootListController : PSListController + +@end diff --git a/prefs/TFDTSRootListController.m b/prefs/TFDTSRootListController.m new file mode 100644 index 0000000..bf34ad2 --- /dev/null +++ b/prefs/TFDTSRootListController.m @@ -0,0 +1,13 @@ +#include "TFDTSRootListController.h" + +@implementation TFDTSRootListController + +- (NSArray *)specifiers { + if (!_specifiers) { + _specifiers = [self loadSpecifiersFromPlistName:@"Root" target:self]; + } + + return _specifiers; +} + +@end diff --git a/prefs/entry.plist b/prefs/entry.plist new file mode 100644 index 0000000..374fa63 --- /dev/null +++ b/prefs/entry.plist @@ -0,0 +1,21 @@ + + + + + entry + + bundle + TFDidThatSayPrefs + cell + PSLinkCell + detail + TFDTSRootListController + icon + icon.png + isController + + label + TFDidThatSay? + + + diff --git a/tfdidthatsay.plist b/tfdidthatsay.plist index 344fea02ebae7845043cd8d6614588a07ea383b8..99887e38f1be30982bae5412f325b47ae5d51065 100644 GIT binary patch delta 112 zcmZ3(IEB$7sURn_xWvHVA|q3nTV_s4YSBezmT;%iyp){O;>E0N?C}DE$@#f@MX4z% tnI(EbU@Bffa$>wBbG(4W#Ci!04sIb)Sw+)81~6b`gwPBeP#Q+%001ei7<>Q# literal 172 zcmb>CQUC(C%$$(self, "bodyNode"); id authorNode = MSHookIvar(self, "authorNode"); @@ -77,48 +83,64 @@ NSDictionary* apolloBodyAttributes = nil; [bodyNode setAttributedString:[%c(MarkdownRenderer) attributedStringFromMarkdown:body withAttributes:apolloBodyAttributes]]; + [sender setEnabled:YES]; + }]; } -(void) didLoad { %orig; - CGFloat imageSize = 20.0f; - - UIButton *undeleteButton = [UIButton buttonWithType:UIButtonTypeCustom]; - [undeleteButton addTarget:self action:@selector(didTapUndeleteButton) forControlEvents:UIControlEventTouchUpInside]; - undeleteButton.frame = CGRectMake(0, 0, imageSize, imageSize); + id commentBody = [MSHookIvar(self, "comment") body]; - UIImage* undeleteImage = [UIImage imageWithContentsOfFile:@"/var/mobile/Library/Application Support/TFDidThatSay/eye160dark.png"]; - [undeleteButton setImage:undeleteImage forState:UIControlStateNormal]; + id isDeletedOnly = [settings valueForKey:@"isApolloDeletedCommentsOnly"]; + + if (([isDeletedOnly isEqual:@1] && ([commentBody isEqualToString:@"[deleted]"] || [commentBody isEqualToString:@"[removed]"])) || [isDeletedOnly isEqual:@0] ) { + + CGFloat imageSize = 20.0f; - [[self view] addSubview:undeleteButton]; - [self setUndeleteButton:undeleteButton]; + UIButton *undeleteButton = [UIButton buttonWithType:UIButtonTypeCustom]; + [undeleteButton addTarget:self action:@selector(didTapUndeleteButton:) forControlEvents:UIControlEventTouchUpInside]; + undeleteButton.frame = CGRectMake(0, 0, imageSize, imageSize); + + UIImage* undeleteImage = [UIImage imageWithContentsOfFile:@"/var/mobile/Library/Application Support/TFDidThatSay/eye160dark.png"]; + [undeleteButton setImage:undeleteImage forState:UIControlStateNormal]; + + [[self view] addSubview:undeleteButton]; + [self setUndeleteButton:undeleteButton]; + + } } -(void) _layoutSublayouts{ %orig; - CGFloat imageSize = 20.0f; + if ([self undeleteButton]){ + + CGFloat imageSize = 20.0f; - id moreNode = MSHookIvar(self, "moreOptionsNode"); - id ageNode = MSHookIvar(self, "ageNode"); + id moreNode = MSHookIvar(self, "moreOptionsNode"); + id ageNode = MSHookIvar(self, "ageNode"); - CGRect nodeFrame = [moreNode frame]; - CGFloat centerHeight = (nodeFrame.size.height + nodeFrame.origin.y * 2) / 2.0f; - CGFloat nodeSpacing =[ageNode frame].origin.x - nodeFrame.origin.x - nodeFrame.size.width; + CGRect nodeFrame = [moreNode frame]; + CGFloat centerHeight = (nodeFrame.size.height + nodeFrame.origin.y * 2) / 2.0f; + CGFloat nodeSpacing =[ageNode frame].origin.x - nodeFrame.origin.x - nodeFrame.size.width; - [[self undeleteButton] setFrame:CGRectMake(nodeFrame.origin.x - imageSize - nodeSpacing, centerHeight - (imageSize / 2), imageSize, imageSize)]; + [[self undeleteButton] setFrame:CGRectMake(nodeFrame.origin.x - imageSize - nodeSpacing, centerHeight - (imageSize / 2), imageSize, imageSize)]; + + } } %end %hook ApolloCommentsHeaderCellNode -%property(assign, nonatomic) id undeleteButton; +%property(strong, nonatomic) id undeleteButton; %new --(void) didTapUndeleteButton{ +-(void) didTapUndeleteButton:(id) sender{ + + [sender setEnabled:NO]; id bodyNode = MSHookIvar(self, "bodyNode"); id postInfoNode = MSHookIvar(self, "postInfoNode"); @@ -165,6 +187,8 @@ NSDictionary* apolloBodyAttributes = nil; [bodyNode setAttributedString:[%c(MarkdownRenderer) attributedStringFromMarkdown:body withAttributes:apolloBodyAttributes]]; + [sender setEnabled:YES]; + }]; } @@ -177,7 +201,7 @@ NSDictionary* apolloBodyAttributes = nil; CGFloat imageSize = 20.0f; UIButton *undeleteButton = [UIButton buttonWithType:UIButtonTypeCustom]; - [undeleteButton addTarget:self action:@selector(didTapUndeleteButton) forControlEvents:UIControlEventTouchUpInside]; + [undeleteButton addTarget:self action:@selector(didTapUndeleteButton:) forControlEvents:UIControlEventTouchUpInside]; UIImage* undeleteImage = [UIImage imageWithContentsOfFile:@"/var/mobile/Library/Application Support/TFDidThatSay/eye160dark.png"]; [undeleteButton setImage:undeleteImage forState:UIControlStateNormal]; @@ -201,7 +225,6 @@ NSDictionary* apolloBodyAttributes = nil; CGFloat centerHeight = [postInfoNode frame].origin.y + ([ageNode frame].size.height + [ageNode frame].origin.y * 2) / 2.0f; CGFloat buttonXPos = [postInfoNode frame].origin.x + [postInfoNode frame].size.width - imageSize; - //Compiling with DEBUG=0 causes this to break the app, I have no idea why. [[self undeleteButton] setFrame:CGRectMake(buttonXPos, centerHeight - (imageSize / 2), imageSize, imageSize)]; } } @@ -211,10 +234,10 @@ NSDictionary* apolloBodyAttributes = nil; %ctor { + NSString* processName = [[NSProcessInfo processInfo] processName]; if ([processName isEqualToString:@"Apollo"]){ %init(Apollo, ApolloCommentsHeaderCellNode = objc_getClass("Apollo.CommentsHeaderCellNode"), ApolloCommentCellNode = objc_getClass("Apollo.CommentCellNode"), ApolloApolloButtonNode = objc_getClass("Apollo.ApolloButtonNode")); } } - diff --git a/tweak/Narwhal.xm b/tweak/Narwhal.xm index dea2c66..6a3657a 100644 --- a/tweak/Narwhal.xm +++ b/tweak/Narwhal.xm @@ -3,52 +3,9 @@ %group Narwhal -UIAlertController* recreateActionSheet(id controller, id comment, NSInteger commentIndex){ - - UIAlertController* alert = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:nil]; - - UIAlertAction* pmAction = [UIAlertAction actionWithTitle:[NSString stringWithFormat:@"private message %@", [comment author]] style:nil handler:^(UIAlertAction* action){[controller _handleActionSheetPrivateMessage:comment];}]; - UIAlertAction* viewProfileAction = [UIAlertAction actionWithTitle:@"view profile" style:nil handler:^(UIAlertAction* action){[controller _handleActionSheetViewProfile:comment];}]; - UIAlertAction* shareAction = [UIAlertAction actionWithTitle:@"share comment" style:nil handler:^(UIAlertAction* action){[controller _handleActionSheetShareComment:comment];}]; - UIAlertAction* copyAction = [UIAlertAction actionWithTitle:@"copy text" style:nil handler:^(UIAlertAction* action){[controller _handleActionSheetCopyCommentText:comment];}]; - UIAlertAction* reportAction = [UIAlertAction actionWithTitle:@"report comment" style:nil handler:^(UIAlertAction* action){[controller _handleActionSheetReportComment:comment];}]; - UIAlertAction* cancelAction = [UIAlertAction actionWithTitle:@"cancel" style:UIAlertActionStyleCancel handler:nil]; - - [alert addAction:pmAction]; - [alert addAction:viewProfileAction]; - [alert addAction:shareAction]; - [alert addAction:copyAction]; - - if ([comment isSaved]){ - UIAlertAction* unsaveAction = [UIAlertAction actionWithTitle:@"unsave comment" style:nil handler:^(UIAlertAction* action){[controller _handleActionSheetUnsaveComment:comment index:commentIndex];}]; - [alert addAction:unsaveAction]; - - } else { - UIAlertAction* saveAction = [UIAlertAction actionWithTitle:@"save comment" style:nil handler:^(UIAlertAction* action){[controller _handleActionSheetSaveComment:comment index:commentIndex];}]; - [alert addAction:saveAction]; - } - - if ([[[comment parentID] componentsSeparatedByString:@"_"][0] isEqualToString:@"t1"]){ - UIAlertAction* viewParentAction = [UIAlertAction actionWithTitle:@"view parent" style: nil handler:^(UIAlertAction* action){[controller _handleActionSheetViewParent:comment];}]; - [alert addAction:viewParentAction]; - } - - if ([[comment author] isEqualToString:[[%c(NRTAuthManager) sharedManager] currentUsername]]) { - UIAlertAction* editAction = [UIAlertAction actionWithTitle:@"edit comment" style:nil handler:^(UIAlertAction* action){[controller _handleActionSheetEditComment:comment];}]; - UIAlertAction* deleteAction = [UIAlertAction actionWithTitle:@"delete comment" style:nil handler:^(UIAlertAction* action){[controller _handleActionSheetDeleteComment:comment];}]; - - [alert addAction:editAction]; - [alert addAction:deleteAction]; - } - - [alert addAction:reportAction]; - [alert addAction:cancelAction]; - - UIAlertAction* undeleteAction = [UIAlertAction actionWithTitle:@"tf did that say?" style:nil handler:^(UIAlertAction* action){[controller handleUndeleteCommentAction:comment];}]; - [alert addAction:undeleteAction]; - - return alert; -} +BOOL shouldHaveUndeleteAction = NO; +id tfComment; +id tfController; void getUndeleteCommentData(id controller, id comment){ @@ -71,12 +28,6 @@ void getUndeleteCommentData(id controller, id comment){ if ([body isEqualToString:@"[deleted]"] || [body isEqualToString:@"[removed]"]){ body = @"[pushshift was unable to archive this]"; } - if (!body){ - body = @"[wtf]"; - } - if (!author){ - author = @"[wtf]"; - } } else { body = @"[pushshift has not archived this yet]"; } @@ -87,7 +38,34 @@ void getUndeleteCommentData(id controller, id comment){ [controller performSelectorOnMainThread:@selector(completeUndeleteComment:) withObject:@{@"body":body, @"author":author, @"comment":comment} waitUntilDone:NO]; }]; -} +} + + + +%hook UIViewController + +-(void) presentViewController:(id) arg1 animated:(BOOL) arg2 completion:(id) arg3{ + + if ([arg1 isKindOfClass:[UIAlertController class]] && shouldHaveUndeleteAction){ + + UIAlertAction* undeleteAction; + + if (tfComment){ + undeleteAction = [UIAlertAction actionWithTitle:@"tf did that say?" style:nil handler:^(UIAlertAction* action){getUndeleteCommentData(tfController, tfComment);}]; + } else { + undeleteAction = [UIAlertAction actionWithTitle:@"tf did that say?" style:nil handler:^(UIAlertAction* action){[tfController handleUndeletePostAction];}]; + } + + [arg1 addAction:undeleteAction]; + + } + + %orig; +} + +%end + + %hook NRTLinkViewController @@ -119,11 +97,6 @@ void getUndeleteCommentData(id controller, id comment){ [[self tableView] reloadData]; } -%new --(void) handleUndeleteCommentAction:(id) comment{ - getUndeleteCommentData(self, comment); -} - %new -(void) handleUndeletePostAction{ @@ -158,8 +131,6 @@ void getUndeleteCommentData(id controller, id comment){ [self performSelectorOnMainThread:@selector(completeUndeletePost:) withObject:@{@"body":body, @"author":author, @"post":post} waitUntilDone:NO]; }]; - - } -(void) swipeCell:(id) arg1 didEndDragWithState:(NSUInteger) arg2{ @@ -168,66 +139,32 @@ void getUndeleteCommentData(id controller, id comment){ if ([arg1 isKindOfClass:[%c(NRTCommentTableViewCell) class]]) { - id comment = [arg1 comment]; - NSInteger commentIndex = [[[self commentsManager] comments] indexOfObject:comment]; + tfComment = [arg1 comment]; + tfController = self; + shouldHaveUndeleteAction = YES; - UIAlertController* alert = recreateActionSheet(self, comment, commentIndex); - - [self presentViewController:alert animated:YES completion:nil]; - - } else { - %orig; - } - } else { - %orig; - } + } + } + + %orig; + + shouldHaveUndeleteAction = NO; } -(void) _dotsButtonTouched:(id) arg1{ - id post = [self link]; - BOOL shouldHaveUndeleteAction = NO; - - UIAlertController* alert = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:nil]; - - UIAlertAction* undeletePostAction; - - UIAlertAction* sharePostAction = [UIAlertAction actionWithTitle:@"share reddit post" style:nil handler:^(UIAlertAction* action){[self _handleActionSheetSharePost];}]; - UIAlertAction* sortCommentsAction = [UIAlertAction actionWithTitle:@"sort comments" style:nil handler:^(UIAlertAction* action){[self _handleActionSheetSortComments];}]; - UIAlertAction* refreshCommentsAction = [UIAlertAction actionWithTitle:@"refresh comments" style:nil handler:^(UIAlertAction* action){[self _handleActionSheetRefreshComments];}]; - UIAlertAction* reportPostAction = [UIAlertAction actionWithTitle:@"report post" style:nil handler:^(UIAlertAction* action){[self _handleActionSheetReportPost];}]; - UIAlertAction* cancelAction = [UIAlertAction actionWithTitle:@"cancel" style:UIAlertActionStyleCancel handler:nil]; - - [alert addAction:sharePostAction]; - [alert addAction:sortCommentsAction]; - [alert addAction:refreshCommentsAction]; - if ([self linkTextOffscreenCell]){ - UIAlertAction* refreshPostAction = [UIAlertAction actionWithTitle:@"refresh post" style:nil handler:^(UIAlertAction* action){[self _handleActionSheetRefreshPost];}]; - [alert addAction:refreshPostAction]; - undeletePostAction = [UIAlertAction actionWithTitle:@"tf did that say?" style:nil handler:^(UIAlertAction* action){[self handleUndeletePostAction];}]; + tfController = self; + tfComment = nil; shouldHaveUndeleteAction = YES; - } - - if ([[post author] isEqualToString:[[%c(NRTAuthManager) sharedManager] currentUsername]]){ - UIAlertAction* editPostAction = [UIAlertAction actionWithTitle:@"edit post" style:nil handler:^(UIAlertAction* action){[self _handleActionSheetEditPost];}]; - UIAlertAction* deletePostAction = [UIAlertAction actionWithTitle:@"delete post" style:nil handler:^(UIAlertAction* action){[self _handleActionSheetDeletePost];}]; - [alert addAction:editPostAction]; - [alert addAction:deletePostAction]; } - [alert addAction:reportPostAction]; - [alert addAction:cancelAction]; - - if (shouldHaveUndeleteAction){ - [alert addAction:undeletePostAction]; - } - - [self presentViewController:alert animated:YES completion:nil]; + %orig; + shouldHaveUndeleteAction = NO; } %end @@ -249,30 +186,22 @@ void getUndeleteCommentData(id controller, id comment){ } } -%new --(void) handleUndeleteCommentAction:(id) comment{ - getUndeleteCommentData(self, comment); -} - -(void) swipeCell:(id) arg1 didEndDragWithState:(NSUInteger) arg2{ if (arg2 == 2){ if ([arg1 isKindOfClass:[%c(NRTCommentTableViewCell) class]]) { - - id comment = [arg1 comment]; - NSInteger commentIndex = [[[self commentsManager] comments] indexOfObject:comment]; - UIAlertController* alert = recreateActionSheet(self, comment, commentIndex); - - [[self parentController] presentViewController:alert animated:YES completion:nil]; + tfComment = [arg1 comment]; + tfController = self; + shouldHaveUndeleteAction = YES; - } else { - %orig; - } - } else { - %orig; - } + } + } + + %orig; + + shouldHaveUndeleteAction = NO; } %end