Browse Source

Add universal visibility option

master
lint 5 years ago
parent
commit
0fef021993
7 changed files with 163 additions and 162 deletions
  1. +3
    -45
      prefs/Resources/Root.plist
  2. +6
    -6
      tweak/AlienBlue.xm
  3. +27
    -23
      tweak/Apollo.xm
  4. +12
    -12
      tweak/BaconReader.xm
  5. +32
    -20
      tweak/Narwhal.xm
  6. +73
    -46
      tweak/Reddit.xm
  7. +10
    -10
      tweak/Slide.xm

+ 3
- 45
prefs/Resources/Root.plist View File

@@ -100,7 +100,7 @@
<key>cell</key>
<string>PSGroupCell</string>
<key>footerText</key>
<string>On apps that have an eye button rather than an option in the menu, enable or disable that button from appearing on only deleted comments/posts.</string>
<string>Enable or disable undelete option appearing only on deleted/removed comments and posts.</string>
<key>label</key>
<string>visibility</string>
</dict>
@@ -114,51 +114,9 @@
<key>defaults</key>
<string>com.lint.undelete.prefs</string>
<key>key</key>
<string>isApolloDeletedCommentsOnly</string>
<string>isTFDeletedOnly</string>
<key>label</key>
<string>Apollo | Deleted only</string>
</dict>
<dict>
<key>PostNotification</key>
<string>com.lint.undelete.prefs.changed</string>
<key>cell</key>
<string>PSSwitchCell</string>
<key>default</key>
<true/>
<key>defaults</key>
<string>com.lint.undelete.prefs</string>
<key>key</key>
<string>isAlienBlueDeletedOnly</string>
<key>label</key>
<string>Alien Blue | Deleted only</string>
</dict>
<dict>
<key>PostNotification</key>
<string>com.lint.undelete.prefs.changed</string>
<key>cell</key>
<string>PSSwitchCell</string>
<key>default</key>
<true/>
<key>defaults</key>
<string>com.lint.undelete.prefs</string>
<key>key</key>
<string>isSlideDeletedOnly</string>
<key>label</key>
<string>Slide | Deleted only</string>
</dict>
<dict>
<key>PostNotification</key>
<string>com.lint.undelete.prefs.changed</string>
<key>cell</key>
<string>PSSwitchCell</string>
<key>default</key>
<true/>
<key>defaults</key>
<string>com.lint.undelete.prefs</string>
<key>key</key>
<string>isBaconReaderDeletedOnly</string>
<key>label</key>
<string>BaconReader | Deleted only</string>
<string>Deleted comments/posts only</string>
</dict>
<dict>
<key>cell</key>

+ 6
- 6
tweak/AlienBlue.xm View File

@@ -3,7 +3,7 @@
#import "assets/MMMarkdown.h"

static BOOL isAlienBlueEnabled;
static BOOL isAlienBlueDeletedOnly;
static BOOL isTFDeletedOnly;
static CGFloat pushshiftRequestTimeoutValue;

%group AlienBlue
@@ -21,7 +21,7 @@ static CGFloat pushshiftRequestTimeoutValue;
body = [[(CommentNode *)arg1 comment] body];
}
if ((isAlienBlueDeletedOnly && ([body isEqualToString:@"[deleted]"] || [body isEqualToString:@"[removed]"])) || !isAlienBlueDeletedOnly) {
if ((isTFDeletedOnly && ([body isEqualToString:@"[deleted]"] || [body isEqualToString:@"[removed]"])) || !isTFDeletedOnly) {
CGSize refSize = [[self buttons][0] frame].size;

@@ -158,10 +158,10 @@ static void loadPrefs(){
isAlienBlueEnabled = YES;
}
if ([prefs objectForKey:@"isAlienBlueDeletedOnly"] != nil){
isAlienBlueDeletedOnly = [[prefs objectForKey:@"isAlienBlueDeletedOnly"] boolValue];
if ([prefs objectForKey:@"isTFDeletedOnly"] != nil){
isTFDeletedOnly = [[prefs objectForKey:@"isTFDeletedOnly"] boolValue];
} else {
isAlienBlueDeletedOnly = YES;
isTFDeletedOnly = YES;
}
if ([prefs objectForKey:@"requestTimeoutValue"] != nil){
@@ -172,7 +172,7 @@ static void loadPrefs(){
} else {
isAlienBlueEnabled = YES;
isAlienBlueDeletedOnly = YES;
isTFDeletedOnly = YES;
pushshiftRequestTimeoutValue = 10;
}
}

+ 27
- 23
tweak/Apollo.xm View File

@@ -1,7 +1,7 @@
#import "Apollo.h"
static BOOL isApolloDeletedCommentsOnly;
static BOOL isTFDeletedOnly;
static BOOL isApolloEnabled;
static CGFloat pushshiftRequestTimeoutValue;
@@ -96,7 +96,7 @@ NSDictionary* apolloBodyAttributes = nil;
id commentBody = [MSHookIvar<id>(self, "comment") body];
if ((isApolloDeletedCommentsOnly && ([commentBody isEqualToString:@"[deleted]"] || [commentBody isEqualToString:@"[removed]"])) || !isApolloDeletedCommentsOnly) {
if ((isTFDeletedOnly && ([commentBody isEqualToString:@"[deleted]"] || [commentBody isEqualToString:@"[removed]"])) || !isTFDeletedOnly) {
CGFloat imageSize = 20.0f;
@@ -190,27 +190,30 @@ NSDictionary* apolloBodyAttributes = nil;
[bodyNode setAttributedString:[%c(MarkdownRenderer) attributedStringFromMarkdown:body withAttributes:apolloBodyAttributes]];
[sender setEnabled:YES];
}];
}
-(void) didLoad{
%orig;
id post = MSHookIvar<id>(self, "link");
id postBody = [post selfText];
if ([MSHookIvar<id>(self, "link") isSelfPost]){
CGFloat imageSize = 20.0f;
if ([post isSelfPost]){
if ((isTFDeletedOnly && ([postBody isEqualToString:@"[deleted]"] || [postBody isEqualToString:@"[removed]"])) || !isTFDeletedOnly) {
UIButton *undeleteButton = [UIButton buttonWithType:UIButtonTypeCustom];
[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];
undeleteButton.frame = CGRectMake(0, 0, imageSize, imageSize);
CGFloat imageSize = 20.0f;
[[self view] addSubview:undeleteButton];
[self setUndeleteButton:undeleteButton];
UIButton *undeleteButton = [UIButton buttonWithType:UIButtonTypeCustom];
[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];
undeleteButton.frame = CGRectMake(0, 0, imageSize, imageSize);
[[self view] addSubview:undeleteButton];
[self setUndeleteButton:undeleteButton];
}
}
}
@@ -230,6 +233,7 @@ NSDictionary* apolloBodyAttributes = nil;
[[self undeleteButton] setFrame:CGRectMake(buttonXPos, centerHeight - (imageSize / 2), imageSize, imageSize)];
}
}
%end
%end
@@ -246,22 +250,22 @@ static void loadPrefs(){
isApolloEnabled = YES;
}
if ([prefs objectForKey:@"requestTimeoutValue"] != nil){
pushshiftRequestTimeoutValue = [[prefs objectForKey:@"requestTimeoutValue"] doubleValue];
if ([prefs objectForKey:@"isTFDeletedOnly"] != nil) {
isTFDeletedOnly = [[prefs objectForKey:@"isTFDeletedOnly"] boolValue];
} else {
pushshiftRequestTimeoutValue = 10;
isTFDeletedOnly = YES;
}
if ([prefs objectForKey:@"isApolloDeletedCommentsOnly"] != nil) {
isApolloDeletedCommentsOnly = [[prefs objectForKey:@"isApolloDeletedCommentsOnly"] boolValue];
if ([prefs objectForKey:@"requestTimeoutValue"] != nil){
pushshiftRequestTimeoutValue = [[prefs objectForKey:@"requestTimeoutValue"] doubleValue];
} else {
isApolloDeletedCommentsOnly = YES;
pushshiftRequestTimeoutValue = 10;
}
} else {
isApolloEnabled = YES;
isTFDeletedOnly = YES;
pushshiftRequestTimeoutValue = 10;
isApolloDeletedCommentsOnly = YES;
}
}

+ 12
- 12
tweak/BaconReader.xm View File

@@ -3,7 +3,7 @@
#import "assets/MMMarkdown.h"
static BOOL isBaconReaderEnabled;
static BOOL isBaconReaderDeletedOnly;
static BOOL isTFDeletedOnly;
static CGFloat pushshiftRequestTimeoutValue;
%group BaconReader
@@ -73,9 +73,9 @@ id tfStoryController;
UIAlertAction *undeleteAction;
if (tfCommentCellView){
undeleteAction = [UIAlertAction actionWithTitle:@"TF Did That Say?" style:nil handler:^(UIAlertAction* action){[tfStoryController handleUndeleteCommentAction];}];
undeleteAction = [UIAlertAction actionWithTitle:@"TF Did That Say?" style:UIAlertActionStyleDefault handler:^(UIAlertAction* action){[tfStoryController handleUndeleteCommentAction];}];
} else {
undeleteAction = [UIAlertAction actionWithTitle:@"TF Did That Say?" style:nil handler:^(UIAlertAction* action){[tfStoryController handleUndeletePostAction];}];
undeleteAction = [UIAlertAction actionWithTitle:@"TF Did That Say?" style:UIAlertActionStyleDefault handler:^(UIAlertAction* action){[tfStoryController handleUndeletePostAction];}];
}
[arg1 addAction:undeleteAction];
@@ -93,7 +93,7 @@ id tfStoryController;
NSString *commentBody = [[arg1 comment] body];
if ((isBaconReaderDeletedOnly && ([commentBody isEqualToString:@"[deleted]"] || [commentBody isEqualToString:@"[removed]"])) || !isBaconReaderDeletedOnly) {
if ((isTFDeletedOnly && ([commentBody isEqualToString:@"[deleted]"] || [commentBody isEqualToString:@"[removed]"])) || !isTFDeletedOnly) {
shouldHaveBRUndeleteAction = YES;
tfCommentCellView = arg1;
tfStoryController = self;
@@ -110,7 +110,7 @@ id tfStoryController;
if ([[self story] is_selfValue]){
NSString *postBody = [[self story] selftext];
if ((isBaconReaderDeletedOnly && ([postBody isEqualToString:@"[deleted]"] || [postBody isEqualToString:@"[removed]"])) || !isBaconReaderDeletedOnly) {
if ((isTFDeletedOnly && ([postBody isEqualToString:@"[deleted]"] || [postBody isEqualToString:@"[removed]"])) || !isTFDeletedOnly) {
shouldHaveBRUndeleteAction = YES;
tfCommentCellView = nil;
tfStoryController = self;
@@ -223,21 +223,21 @@ static void loadPrefs(){
isBaconReaderEnabled = YES;
}
if ([prefs objectForKey:@"requestTimeoutValue"] != nil){
pushshiftRequestTimeoutValue = [[prefs objectForKey:@"requestTimeoutValue"] doubleValue];
if ([prefs objectForKey:@"isTFDeletedOnly"] != nil) {
isTFDeletedOnly = [[prefs objectForKey:@"isTFDeletedOnly"] boolValue];
} else {
pushshiftRequestTimeoutValue = 10;
isTFDeletedOnly = YES;
}
if ([prefs objectForKey:@"isBaconReaderDeletedOnly"] != nil) {
isBaconReaderDeletedOnly = [[prefs objectForKey:@"isBaconReaderDeletedOnly"] boolValue];
if ([prefs objectForKey:@"requestTimeoutValue"] != nil){
pushshiftRequestTimeoutValue = [[prefs objectForKey:@"requestTimeoutValue"] doubleValue];
} else {
isBaconReaderDeletedOnly = YES;
pushshiftRequestTimeoutValue = 10;
}
} else {
isBaconReaderEnabled = YES;
isBaconReaderDeletedOnly = YES;
isTFDeletedOnly = YES;
pushshiftRequestTimeoutValue = 10;
}
}

+ 32
- 20
tweak/Narwhal.xm View File

@@ -2,6 +2,7 @@
#import "Narwhal.h"
static BOOL isNarwhalEnabled;
static BOOL isTFDeletedOnly;
static CGFloat pushshiftRequestTimeoutValue;

%group Narwhal
@@ -45,7 +46,6 @@ void getUndeleteCommentData(id controller, id comment){
}
%hook UIViewController
-(void) presentViewController:(id) arg1 animated:(BOOL) arg2 completion:(id) arg3{
@@ -55,9 +55,9 @@ void getUndeleteCommentData(id controller, id comment){
UIAlertAction* undeleteAction;
if (tfComment){
undeleteAction = [UIAlertAction actionWithTitle:@"tf did that say?" style:nil handler:^(UIAlertAction* action){getUndeleteCommentData(tfController, tfComment);}];
undeleteAction = [UIAlertAction actionWithTitle:@"tf did that say?" style:UIAlertActionStyleDefault handler:^(UIAlertAction* action){getUndeleteCommentData(tfController, tfComment);}];
} else {
undeleteAction = [UIAlertAction actionWithTitle:@"tf did that say?" style:nil handler:^(UIAlertAction* action){[tfController handleUndeletePostAction];}];
undeleteAction = [UIAlertAction actionWithTitle:@"tf did that say?" style:UIAlertActionStyleDefault handler:^(UIAlertAction* action){[tfController handleUndeletePostAction];}];
}
[arg1 addAction:undeleteAction];
@@ -69,8 +69,6 @@ void getUndeleteCommentData(id controller, id comment){
%end

%hook NRTLinkViewController

@@ -141,12 +139,15 @@ void getUndeleteCommentData(id controller, id comment){
-(void) swipeCell:(id) arg1 didEndDragWithState:(NSUInteger) arg2{
if (arg2 == 2){
if ([arg1 isKindOfClass:[%c(NRTCommentTableViewCell) class]]) {
tfComment = [arg1 comment];
tfController = self;
shouldHaveUndeleteAction = YES;
NSString *commentBody = MSHookIvar<NSString*>([arg1 comment], "_body");
if ((isTFDeletedOnly && ([commentBody isEqualToString:@"[deleted]"] || [commentBody isEqualToString:@"[removed]"])) || !isTFDeletedOnly){
tfComment = [arg1 comment];
tfController = self;
shouldHaveUndeleteAction = YES;
}
}
}
@@ -155,14 +156,17 @@ void getUndeleteCommentData(id controller, id comment){
shouldHaveUndeleteAction = NO;
}
-(void) _dotsButtonTouched:(id) arg1{
if ([self linkTextOffscreenCell]){
tfController = self;
tfComment = nil;
shouldHaveUndeleteAction = YES;
NSString *postBody = [[self link] selfText];
if ((isTFDeletedOnly && ([postBody isEqualToString:@"[deleted]"] || [postBody isEqualToString:@"[removed]"])) || !isTFDeletedOnly){
tfController = self;
tfComment = nil;
shouldHaveUndeleteAction = YES;
}
}
%orig;
@@ -192,13 +196,15 @@ void getUndeleteCommentData(id controller, id comment){
-(void) swipeCell:(id) arg1 didEndDragWithState:(NSUInteger) arg2{
if (arg2 == 2){
if ([arg1 isKindOfClass:[%c(NRTCommentTableViewCell) class]]) {
tfComment = [arg1 comment];
tfController = self;
shouldHaveUndeleteAction = YES;
NSString *commentBody = MSHookIvar<NSString*>([arg1 comment], "_body");
if ((isTFDeletedOnly && ([commentBody isEqualToString:@"[deleted]"] || [commentBody isEqualToString:@"[removed]"])) || !isTFDeletedOnly){
tfComment = [arg1 comment];
tfController = self;
shouldHaveUndeleteAction = YES;
}
}
}
@@ -223,6 +229,12 @@ static void loadPrefs(){
isNarwhalEnabled = YES;
}
if ([prefs objectForKey:@"isTFDeletedOnly"] != nil) {
isTFDeletedOnly = [[prefs objectForKey:@"isTFDeletedOnly"] boolValue];
} else {
isTFDeletedOnly = YES;
}
if ([prefs objectForKey:@"requestTimeoutValue"] != nil){
pushshiftRequestTimeoutValue = [[prefs objectForKey:@"requestTimeoutValue"] doubleValue];
} else {
@@ -231,6 +243,7 @@ static void loadPrefs(){
} else {
isNarwhalEnabled = YES;
isTFDeletedOnly = YES;
pushshiftRequestTimeoutValue = 10;
}
}
@@ -254,4 +267,3 @@ static void prefsChanged(CFNotificationCenterRef center, void *observer, CFStrin
}
}
}

+ 73
- 46
tweak/Reddit.xm View File

@@ -1,8 +1,9 @@
#import "Reddit.h"
static CGFloat pushshiftRequestTimeoutValue;
static BOOL isRedditEnabled;
static BOOL isTFDeletedOnly;
static CGFloat pushshiftRequestTimeoutValue;
static NSArray *redditVersion;
@@ -46,20 +47,26 @@ static NSArray *redditVersion;
%hook CommentActionSheetViewController
-(void) setItems:(id) arg1{
NSString *commentBody = [[self comment] bodyText];
if ((isTFDeletedOnly && ([commentBody isEqualToString:@"[deleted]"] || [commentBody isEqualToString:@"[removed]"])) || !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"];
CGSize existingImageSize = [[arg1[0] leftIconImage] size];
CGFloat scale = origImage.size.width / existingImageSize.width;
CGSize existingImageSize = [[arg1[0] leftIconImage] size];
CGFloat scale = origImage.size.width / existingImageSize.width;
UIImage *newImage = [UIImage imageWithCGImage:[origImage CGImage] scale:scale orientation:origImage.imageOrientation];
UIImage *newImage = [UIImage imageWithCGImage:[origImage CGImage] scale:scale orientation:origImage.imageOrientation];
id undeleteItem = [[%c(RUIActionSheetItem) alloc] initWithLeftIconImage:newImage text:@"TF did that say?" identifier:@"undeleteItemIdentifier" context:[self comment]];
id undeleteItem = [[%c(RUIActionSheetItem) alloc] initWithLeftIconImage:newImage text:@"TF did that say?" identifier:@"undeleteItemIdentifier" context:[self comment]];
%orig([arg1 arrayByAddingObject:undeleteItem]);
arg1 = [arg1 arrayByAddingObject:undeleteItem];
[undeleteItem release];
}
[undeleteItem release];
%orig;
}

-(void) handleDidSelectActionSheetItem:(id) arg1{
@@ -185,21 +192,24 @@ static NSArray *redditVersion;
-(void) setItems:(id) arg1{
Post *post = [self post];
NSString *postBody = [post selfText];
if ([post isSelfPost]){
if ((isTFDeletedOnly && ([postBody isEqualToString:@"[deleted]"] || [postBody isEqualToString:@"[removed]"])) || !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"];
CGSize existingImageSize = [[arg1[0] leftIconImage] size];
CGFloat scale = origImage.size.width / existingImageSize.width;
CGSize existingImageSize = [[arg1[0] leftIconImage] size];
CGFloat scale = origImage.size.width / existingImageSize.width;
UIImage *newImage = [UIImage imageWithCGImage:[origImage CGImage] scale:scale orientation:origImage.imageOrientation];
UIImage *newImage = [UIImage imageWithCGImage:[origImage CGImage] scale:scale orientation:origImage.imageOrientation];
id undeleteItem = [[%c(RUIActionSheetItem) alloc] initWithLeftIconImage:newImage text:@"TF did that say?" identifier:@"undeleteItemIdentifier" context:[self post]];
id undeleteItem = [[%c(RUIActionSheetItem) alloc] initWithLeftIconImage:newImage text:@"TF did that say?" identifier:@"undeleteItemIdentifier" context:[self post]];
arg1 = [arg1 arrayByAddingObject:undeleteItem];
[undeleteItem release];
arg1 = [arg1 arrayByAddingObject:undeleteItem];
[undeleteItem release];
}
}
%orig;
@@ -342,25 +352,32 @@ static NSArray *redditVersion;
%hook CommentActionSheetViewController
-(void) setItems:(id) arg1{
NSString *commentBody = [[self comment] bodyText];
if ((isTFDeletedOnly && ([commentBody isEqualToString:@"[deleted]"] || [commentBody isEqualToString:@"[removed]"])) || !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"];
CGSize existingImageSize = [[arg1[0] leftIconImage] size];
CGFloat scale = origImage.size.width / existingImageSize.width;
CGSize existingImageSize = [[arg1[0] leftIconImage] size];
CGFloat scale = origImage.size.width / existingImageSize.width;
UIImage *newImage = [UIImage imageWithCGImage:[origImage CGImage] scale:scale orientation:origImage.imageOrientation];
id undeleteItem;
if ([redditVersion[1] integerValue] >= 18) {
undeleteItem = [[%c(RUIActionSheetItem) alloc] initWithLeftIconImage:newImage text:@"TF did that say?" identifier:@"undeleteItemIdentifier" context:[self comment]];
} else {
undeleteItem = [[%c(ActionSheetItem) alloc] initWithLeftIconImage:newImage text:@"TF did that say?" identifier:@"undeleteItemIdentifier" context:[self comment]];
}
UIImage *newImage = [UIImage imageWithCGImage:[origImage CGImage] scale:scale orientation:origImage.imageOrientation];
id undeleteItem;
if ([redditVersion[1] integerValue] >= 18) {
undeleteItem = [[%c(RUIActionSheetItem) alloc] initWithLeftIconImage:newImage text:@"TF did that say?" identifier:@"undeleteItemIdentifier" context:[self comment]];
} else {
undeleteItem = [[%c(ActionSheetItem) alloc] initWithLeftIconImage:newImage text:@"TF did that say?" identifier:@"undeleteItemIdentifier" context:[self comment]];
}
%orig([arg1 arrayByAddingObject:undeleteItem]);
arg1 = [arg1 arrayByAddingObject:undeleteItem];
[undeleteItem release];
}
[undeleteItem release];
%orig;
}
// >= 4.21
@@ -479,27 +496,30 @@ static NSArray *redditVersion;
-(void) setItems:(id) arg1{
Post *post = [self post];
NSString *postBody = [post selfText];
if ([post isSelfPost]){
if ((isTFDeletedOnly && ([postBody isEqualToString:@"[deleted]"] || [postBody isEqualToString:@"[removed]"])) || !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"];
CGSize existingImageSize = [[arg1[0] leftIconImage] size];
CGFloat scale = origImage.size.width / existingImageSize.width;
CGSize existingImageSize = [[arg1[0] leftIconImage] size];
CGFloat scale = origImage.size.width / existingImageSize.width;
UIImage *newImage = [UIImage imageWithCGImage:[origImage CGImage] scale:scale orientation:origImage.imageOrientation];
id undeleteItem;
if ([redditVersion[1] integerValue] >= 18) {
undeleteItem = [[%c(RUIActionSheetItem) alloc] initWithLeftIconImage:newImage text:@"TF did that say?" identifier:@"undeleteItemIdentifier" context:[self post]];
} else {
undeleteItem = [[%c(ActionSheetItem) alloc] initWithLeftIconImage:newImage text:@"TF did that say?" identifier:@"undeleteItemIdentifier" context:[self post]];
}
UIImage *newImage = [UIImage imageWithCGImage:[origImage CGImage] scale:scale orientation:origImage.imageOrientation];
id undeleteItem;
if ([redditVersion[1] integerValue] >= 18) {
undeleteItem = [[%c(RUIActionSheetItem) alloc] initWithLeftIconImage:newImage text:@"TF did that say?" identifier:@"undeleteItemIdentifier" context:[self post]];
} else {
undeleteItem = [[%c(ActionSheetItem) alloc] initWithLeftIconImage:newImage text:@"TF did that say?" identifier:@"undeleteItemIdentifier" context:[self post]];
}
arg1 = [arg1 arrayByAddingObject:undeleteItem];
[undeleteItem release];
arg1 = [arg1 arrayByAddingObject:undeleteItem];
[undeleteItem release];
}
}
%orig;
@@ -722,6 +742,12 @@ static void loadPrefs(){
isRedditEnabled = YES;
}
if ([prefs objectForKey:@"isTFDeletedOnly"] != nil) {
isTFDeletedOnly = [[prefs objectForKey:@"isTFDeletedOnly"] boolValue];
} else {
isTFDeletedOnly = YES;
}
if ([prefs objectForKey:@"requestTimeoutValue"] != nil){
pushshiftRequestTimeoutValue = [[prefs objectForKey:@"requestTimeoutValue"] doubleValue];
} else {
@@ -730,6 +756,7 @@ static void loadPrefs(){
} else {
isRedditEnabled = YES;
isTFDeletedOnly = YES;
pushshiftRequestTimeoutValue = 10;
}
}

+ 10
- 10
tweak/Slide.xm View File

@@ -3,7 +3,7 @@
#import "assets/MMMarkdown.h"
static BOOL isSlideEnabled;
static BOOL isSlideDeletedOnly;
static BOOL isTFDeletedOnly;
static CGFloat pushshiftRequestTimeoutValue;
%group Slide
@@ -266,7 +266,7 @@ static UIButton * createUndeleteButton(){
NSString *body = [MSHookIvar<id>(self, "comment") body];
if ((isSlideDeletedOnly && ([body isEqualToString:@"[deleted]"] || [body isEqualToString:@"[removed]"])) || !isSlideDeletedOnly){
if ((isTFDeletedOnly && ([body isEqualToString:@"[deleted]"] || [body isEqualToString:@"[removed]"])) || !isTFDeletedOnly){
id controller = MSHookIvar<id>(self, "parent");
@@ -339,9 +339,9 @@ static UIButton * createUndeleteButton(){
NSMutableAttributedString *htmlAttributedString = [[NSMutableAttributedString alloc] initWithAttributedString:[dthtmlBuilder generatedAttributedString]];
NSRange htmlStringRange = NSMakeRange(0, [htmlAttributedString length]);
[[htmlAttributedString mutableString] replaceOccurrencesOfString:@"\t•\t" withString:@" • " options:nil range: htmlStringRange];
[[htmlAttributedString mutableString] replaceOccurrencesOfString:@"\t◦\t" withString:@"  ◦ " options:nil range: htmlStringRange];
[[htmlAttributedString mutableString] replaceOccurrencesOfString:@"\t▪\t" withString:@" ▪ " options:nil range: htmlStringRange];
[[htmlAttributedString mutableString] replaceOccurrencesOfString:@"\t•\t" withString:@" • " options:0 range: htmlStringRange];
[[htmlAttributedString mutableString] replaceOccurrencesOfString:@"\t◦\t" withString:@"  ◦ " options:0 range: htmlStringRange];
[[htmlAttributedString mutableString] replaceOccurrencesOfString:@"\t▪\t" withString:@" ▪ " options:0 range: htmlStringRange];
[htmlAttributedString removeAttribute:@"CTForegroundColorFromContext" range:htmlStringRange];
@@ -376,7 +376,7 @@ static UIButton * createUndeleteButton(){
}];
[htmlAttributedString beginEditing];
[htmlAttributedString enumerateAttribute:NSFontAttributeName inRange:NSMakeRange(0, [htmlAttributedString length]) options:nil usingBlock:^(id value, NSRange range, BOOL *stop){
[htmlAttributedString enumerateAttribute:NSFontAttributeName inRange:NSMakeRange(0, [htmlAttributedString length]) options:0 usingBlock:^(id value, NSRange range, BOOL *stop){
UIFont *attrFont = (UIFont *)value;
@@ -429,10 +429,10 @@ static void loadPrefs(){
isSlideEnabled = YES;
}
if ([prefs objectForKey:@"isSlideDeletedOnly"] != nil){
isSlideDeletedOnly = [[prefs objectForKey:@"isSlideDeletedOnly"] boolValue];
if ([prefs objectForKey:@"isTFDeletedOnly"] != nil){
isTFDeletedOnly = [[prefs objectForKey:@"isTFDeletedOnly"] boolValue];
} else {
isSlideDeletedOnly = YES;
isTFDeletedOnly = YES;
}
if ([prefs objectForKey:@"requestTimeoutValue"] != nil){
@@ -443,7 +443,7 @@ static void loadPrefs(){
} else {
isSlideEnabled = YES;
isSlideDeletedOnly = YES;
isTFDeletedOnly = YES;
pushshiftRequestTimeoutValue = 10;
}
}

Loading…
Cancel
Save