Selaa lähdekoodia

Add helper method

master
lint 4 vuotta sitten
vanhempi
commit
bb0d0d9e95
10 muutettua tiedostoa jossa 37 lisäystä ja 21 poistoa
  1. +1
    -1
      tweak/AlienBlue.xm
  2. +2
    -2
      tweak/Antenna.xm
  3. +2
    -2
      tweak/Apollo.xm
  4. +2
    -2
      tweak/BaconReader.xm
  5. +2
    -2
      tweak/Beam.xm
  6. +3
    -3
      tweak/Narwhal.xm
  7. +4
    -4
      tweak/Reddit.xm
  8. +4
    -4
      tweak/Slide.xm
  9. +1
    -0
      tweak/assets/TFHelper.h
  10. +16
    -1
      tweak/assets/TFHelper.m

+ 1
- 1
tweak/AlienBlue.xm Näytä tiedosto

@@ -22,7 +22,7 @@ static CGFloat pushshiftRequestTimeoutValue;
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;


+ 2
- 2
tweak/Antenna.xm Näytä tiedosto

@@ -35,7 +35,7 @@ id tfAntennaCommentCell;
NSString *commentBody = [[[arg1 comment] commentText] body];
if ((isTFDeletedOnly && ([commentBody isEqualToString:@"[deleted]"] || [commentBody isEqualToString:@"[removed]"])) || !isTFDeletedOnly){
if ([%c(TFHelper) shouldShowUndeleteButtonWithInfo:commentBody isDeletedOnly:isTFDeletedOnly]){
tfAntennaController = self;
tfAntennaCommentCell = arg1;
shouldHaveAntennaUndeleteAction = YES;
@@ -115,7 +115,7 @@ id tfAntennaCommentCell;
NSString *postBody = [[post selfCommentText] body];
if ([post isSelfPost]){
if ((isTFDeletedOnly && ([postBody isEqualToString:@"[deleted]"] || [postBody isEqualToString:@"[removed]"])) || !isTFDeletedOnly) {
if ([%c(TFHelper) shouldShowUndeleteButtonWithInfo:postBody isDeletedOnly:isTFDeletedOnly]){
isAbleToUndeletePost = YES;
NSMutableArray *barButtons = [self defaultHeaderButtons];

+ 2
- 2
tweak/Apollo.xm Näytä tiedosto

@@ -44,7 +44,7 @@ NSDictionary* apolloBodyAttributes = nil;
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;
@@ -126,7 +126,7 @@ NSDictionary* apolloBodyAttributes = nil;
id postBody = [post selfText];
if ([post isSelfPost]){
if ((isTFDeletedOnly && ([postBody isEqualToString:@"[deleted]"] || [postBody isEqualToString:@"[removed]"])) || !isTFDeletedOnly) {
if ([%c(TFHelper) shouldShowUndeleteButtonWithInfo:postBody isDeletedOnly:isTFDeletedOnly]){
CGFloat imageSize = 20.0f;

+ 2
- 2
tweak/BaconReader.xm Näytä tiedosto

@@ -94,7 +94,7 @@ id tfStoryController;
NSString *commentBody = [[arg1 comment] body];
if ((isTFDeletedOnly && ([commentBody isEqualToString:@"[deleted]"] || [commentBody isEqualToString:@"[removed]"])) || !isTFDeletedOnly) {
if ([%c(TFHelper) shouldShowUndeleteButtonWithInfo:commentBody isDeletedOnly:isTFDeletedOnly]){
shouldHaveBRUndeleteAction = YES;
tfCommentCellView = arg1;
tfStoryController = self;
@@ -111,7 +111,7 @@ id tfStoryController;
if ([[self story] is_selfValue]){
NSString *postBody = [[self story] selftext];
if ((isTFDeletedOnly && ([postBody isEqualToString:@"[deleted]"] || [postBody isEqualToString:@"[removed]"])) || !isTFDeletedOnly) {
if ([%c(TFHelper) shouldShowUndeleteButtonWithInfo:postBody isDeletedOnly:isTFDeletedOnly]){
shouldHaveBRUndeleteAction = YES;
tfCommentCellView = nil;
tfStoryController = self;

+ 2
- 2
tweak/Beam.xm Näytä tiedosto

@@ -26,7 +26,7 @@ static CGFloat pushshiftRequestTimeoutValue;
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;
@@ -114,7 +114,7 @@ static CGFloat pushshiftRequestTimeoutValue;
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");

+ 3
- 3
tweak/Narwhal.xm Näytä tiedosto

@@ -49,7 +49,7 @@ void getUndeleteCommentData(id controller, id comment){
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];
tfController = self;
shouldHaveUndeleteAction = YES;
@@ -68,7 +68,7 @@ void getUndeleteCommentData(id controller, id comment){
NSString *postBody = [[self link] selfText];
if ((isTFDeletedOnly && ([postBody isEqualToString:@"[deleted]"] || [postBody isEqualToString:@"[removed]"])) || !isTFDeletedOnly){
if ([%c(TFHelper) shouldShowUndeleteButtonWithInfo:postBody isDeletedOnly:isTFDeletedOnly]){
tfController = self;
tfComment = nil;
shouldHaveUndeleteAction = YES;
@@ -127,7 +127,7 @@ void getUndeleteCommentData(id controller, id comment){
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];
tfController = self;
shouldHaveUndeleteAction = YES;

+ 4
- 4
tweak/Reddit.xm Näytä tiedosto

@@ -66,7 +66,7 @@ int getRedditVersionPart(int index){
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"];
@@ -193,7 +193,7 @@ int getRedditVersionPart(int index){
NSString *postBody = [post selfText];
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"];
@@ -334,7 +334,7 @@ int getRedditVersionPart(int index){
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"];
@@ -419,7 +419,7 @@ int getRedditVersionPart(int index){
NSString *postBody = [post selfText];
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"];

+ 4
- 4
tweak/Slide.xm Näytä tiedosto

@@ -264,9 +264,9 @@ static UIButton *createUndeleteButton(){
%new
-(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");
@@ -465,7 +465,7 @@ static UIButton *createUndeleteButton(){
NSString *postBody = [post body];
if ((isTFDeletedOnly && ([postBody isEqualToString:@"[deleted]"] || [postBody isEqualToString:@"[removed]"])) || !isTFDeletedOnly){
if ([%c(TFHelper) shouldShowUndeleteButtonWithInfo:postBody isDeletedOnly:isTFDeletedOnly]){
return YES;
}
}

+ 1
- 0
tweak/assets/TFHelper.h Näytä tiedosto

@@ -2,5 +2,6 @@
@interface TFHelper : NSObject
+(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

+ 16
- 1
tweak/assets/TFHelper.m Näytä tiedosto

@@ -47,4 +47,19 @@
}];
}
@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

Loading…
Peruuta
Tallenna