forked from lint/TFDidThatSay
Add ios 10 Reddit support (4.21 ->)
This commit is contained in:
2
control
2
control
@ -1,7 +1,7 @@
|
|||||||
Package: com.lint.undelete
|
Package: com.lint.undelete
|
||||||
Name: TFDidThatSay?
|
Name: TFDidThatSay?
|
||||||
Depends: mobilesubstrate
|
Depends: mobilesubstrate
|
||||||
Version: 1.2.4
|
Version: 1.2.5
|
||||||
Architecture: iphoneos-arm
|
Architecture: iphoneos-arm
|
||||||
Description: See "[deleted]" comments and posts without leaving Reddit!
|
Description: See "[deleted]" comments and posts without leaving Reddit!
|
||||||
Maintainer: lint <apieceoflint@protonmail.com>
|
Maintainer: lint <apieceoflint@protonmail.com>
|
||||||
|
139
tweak/Reddit.h
139
tweak/Reddit.h
@ -1,3 +1,34 @@
|
|||||||
|
/* ---- Reddit v3 & v4 ---- */
|
||||||
|
|
||||||
|
/* -- Comment Interfaces -- */
|
||||||
|
|
||||||
|
@interface Comment
|
||||||
|
//v4
|
||||||
|
@property(strong,nonatomic) id pk;
|
||||||
|
@property(strong, nonatomic) NSString *bodyText;
|
||||||
|
@property(strong, nonatomic) NSString *author;
|
||||||
|
@property(strong, nonatomic) id bodyRichTextAttributed;
|
||||||
|
@property(strong, nonatomic) id bodyAttributedText;
|
||||||
|
|
||||||
|
//v3
|
||||||
|
-(id)pkWithoutPrefix;
|
||||||
|
@end
|
||||||
|
|
||||||
|
@interface CommentsViewController : NSObject
|
||||||
|
-(void) reloadCommentsWithNewCommentsHighlight:(BOOL) arg1 autoScroll:(BOOL) arg2 animated:(BOOL) arg3;
|
||||||
|
-(void) reloadCommentsSection:(BOOL) arg1;
|
||||||
|
-(void) reloadPostSection:(BOOL) arg1;
|
||||||
|
-(void) feedPostViewDidUpdatePost:(id) arg1 shouldReloadFeed:(BOOL) arg2;
|
||||||
|
-(void) updateFloatingViews;
|
||||||
|
@end
|
||||||
|
|
||||||
|
@interface CommentActionSheetViewController : UIViewController
|
||||||
|
@property(strong,nonatomic) Comment *comment;
|
||||||
|
@property(strong,nonatomic) id commentTreeNode;
|
||||||
|
@property(strong,nonatomic) CommentsViewController *commentActionSheetDelegate;
|
||||||
|
-(id)animationControllerForDismissedController:(id) arg1;
|
||||||
|
@end
|
||||||
|
|
||||||
|
|
||||||
/* ---- Reddit v4 ---- */
|
/* ---- Reddit v4 ---- */
|
||||||
|
|
||||||
@ -5,98 +36,100 @@
|
|||||||
/* -- Comment Interfaces -- */
|
/* -- Comment Interfaces -- */
|
||||||
|
|
||||||
@interface CommentTreeNode
|
@interface CommentTreeNode
|
||||||
@property(assign,nonatomic) id comment;
|
@property(strong,nonatomic) Comment *comment;
|
||||||
|
|
||||||
//custom elements
|
//custom elements
|
||||||
@property(assign,nonatomic) id commentTreeHeaderNode;
|
@property(strong,nonatomic) id commentTreeHeaderNode;
|
||||||
@property(assign,nonatomic) id commentTreeCommandBarNode;
|
@property(strong,nonatomic) id commentTreeCommandBarNode;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface CommentTreeDisplayNode
|
@interface CommentTreeDisplayNode
|
||||||
@property(assign,nonatomic) id commentNode;
|
@property(strong,nonatomic) id commentNode;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface CommentTreeHeaderNode
|
@interface CommentTreeHeaderNode
|
||||||
@property(assign,nonatomic) id commentTreeNode;
|
@property(strong,nonatomic) id commentTreeNode;
|
||||||
-(void) updateContentViewsForData:(id)arg1;
|
-(void) updateContentViewsForData:(id)arg1;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface CommentTreeCommandBarNode
|
@interface CommentTreeCommandBarNode
|
||||||
@property(assign,nonatomic) id commentTreeNode;
|
@property(strong,nonatomic) id commentTreeNode;
|
||||||
@property(assign,nonatomic) id delegate;
|
@property(strong,nonatomic) id delegate;
|
||||||
@property(assign,nonatomic) UIView* view;
|
@property(strong,nonatomic) UIView* view;
|
||||||
@property(assign,nonatomic) id overflowButtonNode;
|
@property(strong,nonatomic) id overflowButtonNode;
|
||||||
@property(assign,nonatomic) CGRect frame;
|
@property(assign,nonatomic) CGRect frame;
|
||||||
|
|
||||||
//custom elements
|
|
||||||
@property(assign,nonatomic) id activityIndicator;
|
|
||||||
@property(assign,nonatomic) id undeleteButton;
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface CommentActionSheetViewController : UIViewController
|
@interface CommentTreeHeaderView
|
||||||
@property(assign,nonatomic) id comment;
|
@property(strong,nonatomic) id commentTreeNode;
|
||||||
@property(assign,nonatomic) id commentTreeNode;
|
|
||||||
-(id)animationControllerForDismissedController:(id) arg1;
|
-(void) updateContentViewsForData:(id) arg1;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
/* -- Post Interfaces -- */
|
/* -- Post Interfaces -- */
|
||||||
|
|
||||||
@interface Post
|
@interface Post
|
||||||
@property(assign,nonatomic) id author;
|
@property(strong,nonatomic) NSString *author;
|
||||||
|
@property(strong,nonatomic) NSString *selfText;
|
||||||
|
@property(strong,nonatomic) id selfTextAttributed;
|
||||||
|
@property(strong,nonatomic) id selfPostRichTextAttributed;
|
||||||
|
@property(strong,nonatomic) id previewFeedPostTextString;
|
||||||
@property(assign,nonatomic) BOOL isSelfPost;
|
@property(assign,nonatomic) BOOL isSelfPost;
|
||||||
@property(assign,nonatomic) id selfText;
|
@property(strong,nonatomic) NSString *pk;
|
||||||
@property(assign,nonatomic) id selfTextAttributed;
|
|
||||||
@property(assign,nonatomic) id selfPostRichTextAttributed;
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface PostDetailViewController
|
@interface PostDetailViewController
|
||||||
@property(assign,nonatomic) id selfTextNode;
|
@property(strong,nonatomic) id selfTextNode;
|
||||||
-(void) configureSelfTextNode;
|
-(void) configureSelfTextNode;
|
||||||
|
|
||||||
//custom elements
|
//custom elements
|
||||||
@property(assign,nonatomic) id feedPostTextWithThumbnailNode;
|
@property(strong,nonatomic) id feedPostTextWithThumbnailNode;
|
||||||
@property(assign,nonatomic) id feedPostDetailCellNode;
|
@property(strong,nonatomic) id feedPostDetailCellNode;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface PostActionSheetViewController : UIViewController
|
@interface PostActionSheetViewController : UIViewController
|
||||||
@property(assign,nonatomic) id post;
|
@property(strong,nonatomic) Post *post;
|
||||||
@property(assign,nonatomic) id postActionSheetDelegate;
|
@property(strong,nonatomic) id postActionSheetDelegate;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface PostDetailNavigationItemHandler
|
@interface PostDetailNavigationItemHandler
|
||||||
@property(assign,nonatomic) id controller;
|
@property(strong,nonatomic) id controller;
|
||||||
@property(assign,nonatomic) id presenter;
|
@property(strong,nonatomic) id presenter;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface FeedPostDetailCellNode
|
@interface FeedPostDetailCellNode
|
||||||
@property(assign,nonatomic) id textNode;
|
@property(strong,nonatomic) id textNode;
|
||||||
@property(assign,nonatomic) id delegate;
|
@property(strong,nonatomic) id delegate;
|
||||||
@property(assign,nonatomic) id contentNode;
|
@property(strong,nonatomic) id contentNode;
|
||||||
|
@property(strong,nonatomic) id titleNode;
|
||||||
|
@end
|
||||||
|
|
||||||
|
@interface FeedPostTitleNode
|
||||||
|
@property(strong,nonatomic) id delegate;
|
||||||
|
-(void) configureNodes;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface FeedPostDetailDelegator
|
@interface FeedPostDetailDelegator
|
||||||
@property(assign,nonatomic) id viewController;
|
@property(strong,nonatomic) id viewController;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface FeedPostContentNode
|
@interface FeedPostContentNode
|
||||||
-(void) configureSelfTextNode;
|
-(void) configureSelfTextNode;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|
||||||
/* -- Other Interfaces -- */
|
/* -- Other Interfaces -- */
|
||||||
|
|
||||||
|
|
||||||
@interface RichTextDisplayNode
|
@interface RichTextDisplayNode
|
||||||
@property(assign,nonatomic) id attributedText;
|
@property(strong,nonatomic) id attributedText;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface RUIActionSheetItem : NSObject
|
@interface RUIActionSheetItem : NSObject
|
||||||
@property(assign,nonatomic) id leftIconImage;
|
@property(strong,nonatomic) id leftIconImage;
|
||||||
-(id) initWithLeftIconImage:(id) arg1 text:(id) arg2 identifier:(id) arg3 context:(id) arg4;
|
-(id) initWithLeftIconImage:(id) arg1 text:(id) arg2 identifier:(id) arg3 context:(id) arg4;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface RUITheme
|
@interface RUITheme
|
||||||
@property(assign,nonatomic) id bodyTextColor;
|
@property(strong,nonatomic) id bodyTextColor;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface NSAttributedStringMarkdownParser
|
@interface NSAttributedStringMarkdownParser
|
||||||
@ -108,15 +141,18 @@
|
|||||||
|
|
||||||
@interface ThemeManager
|
@interface ThemeManager
|
||||||
|
|
||||||
|
+(id) sharedManager;
|
||||||
|
|
||||||
// >= 4.45.0
|
// >= 4.45.0
|
||||||
@property(assign,nonatomic) id darkTheme;
|
@property(strong,nonatomic) id darkTheme;
|
||||||
@property(assign,nonatomic) id lightTheme;
|
@property(strong,nonatomic) id lightTheme;
|
||||||
-(id) initWithAppSettings:(id) arg1;
|
-(id) initWithAppSettings:(id) arg1;
|
||||||
|
|
||||||
// < 4.45.0
|
// < 4.45.0
|
||||||
@property(assign,nonatomic) id dayTheme;
|
@property(strong,nonatomic) id dayTheme;
|
||||||
@property(assign,nonatomic) id nightTheme;
|
@property(strong,nonatomic) id nightTheme;
|
||||||
-(id) initWithTraitCollection:(id) arg1 appSettings:(id) arg2;
|
-(id) initWithTraitCollection:(id) arg1 appSettings:(id) arg2;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface AppSettings
|
@interface AppSettings
|
||||||
@ -148,33 +184,14 @@
|
|||||||
-(id) delegate;
|
-(id) delegate;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface CommentCommandView
|
@interface CommentCommandView
|
||||||
@property (strong, nonatomic) id undeleteButton;
|
@property (strong, nonatomic) id undeleteButton;
|
||||||
-(id)overflowButton;
|
-(id)overflowButton;
|
||||||
-(id) comment;
|
-(id) comment;
|
||||||
-(id) delegate;
|
-(id) delegate;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface CommentsViewController
|
|
||||||
-(void) reloadCommentsWithNewCommentsHighlight:(BOOL) arg1 autoScroll:(BOOL) arg2 animated:(BOOL) arg3;
|
|
||||||
-(void)updateFloatingViews;
|
|
||||||
@end
|
|
||||||
|
|
||||||
/* -- Other Interfaces -- */
|
/* -- Other Interfaces -- */
|
||||||
|
|
||||||
@interface MarkDownParser
|
@interface MarkDownParser
|
||||||
+(id)attributedStringFromMarkdownString:(id)arg1;
|
+(id)attributedStringFromMarkdownString:(id)arg1;
|
||||||
@end
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* ---- Reddit v3 & v4 ---- */
|
|
||||||
|
|
||||||
|
|
||||||
@interface Comment
|
|
||||||
//v4
|
|
||||||
@property(assign,nonatomic) id bodyRichTextAttributed;
|
|
||||||
@property(assign,nonatomic) id pk;
|
|
||||||
|
|
||||||
//v3
|
|
||||||
-(id)pkWithoutPrefix;
|
|
||||||
|
285
tweak/Reddit.xm
285
tweak/Reddit.xm
@ -1,13 +1,22 @@
|
|||||||
|
|
||||||
#import "Reddit.h"
|
#import "Reddit.h"
|
||||||
|
|
||||||
%group Redditv4
|
%group Reddit_v4_current
|
||||||
|
|
||||||
%hook CommentTreeNode
|
%hook CommentTreeNode
|
||||||
%property(assign,nonatomic)id commentTreeHeaderNode;
|
%property(assign,nonatomic)id commentTreeHeaderNode;
|
||||||
%property(assign,nonatomic)id commentTreeCommandBarNode;
|
%property(assign,nonatomic)id commentTreeCommandBarNode;
|
||||||
%end
|
%end
|
||||||
|
|
||||||
|
%hook CommentTreeHeaderView
|
||||||
|
|
||||||
|
-(void) layoutSubviews{
|
||||||
|
%orig;
|
||||||
|
|
||||||
|
[[self commentTreeNode] setCommentTreeHeaderNode:self];
|
||||||
|
}
|
||||||
|
|
||||||
|
%end
|
||||||
|
|
||||||
%hook CommentTreeHeaderNode
|
%hook CommentTreeHeaderNode
|
||||||
|
|
||||||
@ -20,8 +29,6 @@
|
|||||||
|
|
||||||
|
|
||||||
%hook CommentTreeCommandBarNode
|
%hook CommentTreeCommandBarNode
|
||||||
%property(assign,nonatomic) id activityIndicator;
|
|
||||||
%property(assign,nonatomic) id undeleteButton;
|
|
||||||
|
|
||||||
-(void) didLoad{
|
-(void) didLoad{
|
||||||
%orig;
|
%orig;
|
||||||
@ -58,7 +65,7 @@
|
|||||||
[self dismissViewControllerAnimated:YES completion:nil];
|
[self dismissViewControllerAnimated:YES completion:nil];
|
||||||
|
|
||||||
id commentTreeNode = [self commentTreeNode];
|
id commentTreeNode = [self commentTreeNode];
|
||||||
id comment = [commentTreeNode comment];
|
Comment *comment = [commentTreeNode comment];
|
||||||
|
|
||||||
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init];
|
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init];
|
||||||
NSOperationQueue *queue = [[NSOperationQueue alloc] init];
|
NSOperationQueue *queue = [[NSOperationQueue alloc] init];
|
||||||
@ -85,10 +92,11 @@
|
|||||||
} else if (error != nil || data == nil){
|
} else if (error != nil || data == nil){
|
||||||
body = @"[an error occured]";
|
body = @"[an error occured]";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
NSArray* appVersion = [[[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"] componentsSeparatedByString:@"."];
|
NSArray* appVersion = [[[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"] componentsSeparatedByString:@"."];
|
||||||
|
|
||||||
|
NSMutableAttributedString *bodyMutableAttributedText;
|
||||||
|
|
||||||
id themeManager;
|
id themeManager;
|
||||||
id isNightMode;
|
id isNightMode;
|
||||||
id textColor;
|
id textColor;
|
||||||
@ -103,7 +111,10 @@
|
|||||||
textColor = [[themeManager lightTheme] bodyTextColor];
|
textColor = [[themeManager lightTheme] bodyTextColor];
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
[themeManager release];
|
||||||
|
|
||||||
|
|
||||||
|
} else if ([appVersion[1] integerValue] >= 37){
|
||||||
themeManager = [[%c(ThemeManager) alloc] initWithTraitCollection:nil appSettings:[%c(AppSettings) sharedSettings]];
|
themeManager = [[%c(ThemeManager) alloc] initWithTraitCollection:nil appSettings:[%c(AppSettings) sharedSettings]];
|
||||||
isNightMode = [[[%c(AccountManager) sharedManager] defaults] objectForKey:@"kUseNightKey"];
|
isNightMode = [[[%c(AccountManager) sharedManager] defaults] objectForKey:@"kUseNightKey"];
|
||||||
|
|
||||||
@ -112,9 +123,21 @@
|
|||||||
} else{
|
} else{
|
||||||
textColor = [[themeManager dayTheme] bodyTextColor];
|
textColor = [[themeManager dayTheme] bodyTextColor];
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
[themeManager release];
|
||||||
NSMutableAttributedString *bodyMutableAttributedText = [[NSMutableAttributedString alloc] initWithAttributedString:[%c(NSAttributedStringMarkdownParser) attributedStringUsingCurrentConfig:body]];
|
|
||||||
|
} else {
|
||||||
|
themeManager = [%c(ThemeManager) sharedManager];
|
||||||
|
isNightMode = [[[%c(AccountManager) sharedManager] defaults] objectForKey:@"kUseNightKey"];
|
||||||
|
|
||||||
|
if (isNightMode) {
|
||||||
|
textColor = [[themeManager nightTheme] bodyTextColor];
|
||||||
|
} else{
|
||||||
|
textColor = [[themeManager dayTheme] bodyTextColor];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bodyMutableAttributedText = [[NSMutableAttributedString alloc] initWithAttributedString:[%c(NSAttributedStringMarkdownParser) attributedStringUsingCurrentConfig:body]];
|
||||||
|
|
||||||
[bodyMutableAttributedText beginEditing];
|
[bodyMutableAttributedText beginEditing];
|
||||||
[bodyMutableAttributedText enumerateAttribute:NSForegroundColorAttributeName inRange:NSMakeRange(0, bodyMutableAttributedText.length) options:0 usingBlock:^(id _Nullable value, NSRange range, BOOL * _Nonnull stop) {
|
[bodyMutableAttributedText enumerateAttribute:NSForegroundColorAttributeName inRange:NSMakeRange(0, bodyMutableAttributedText.length) options:0 usingBlock:^(id _Nullable value, NSRange range, BOOL * _Nonnull stop) {
|
||||||
@ -123,20 +146,17 @@
|
|||||||
}];
|
}];
|
||||||
[bodyMutableAttributedText endEditing];
|
[bodyMutableAttributedText endEditing];
|
||||||
|
|
||||||
|
[comment setAuthor:author];
|
||||||
[comment setValue:bodyMutableAttributedText forKey:@"bodyRichTextAttributed"];
|
[comment setBodyText:body];
|
||||||
|
[comment setBodyRichTextAttributed:bodyMutableAttributedText];
|
||||||
[comment setValue:author forKey:@"author"];
|
[comment setBodyAttributedText:bodyMutableAttributedText];
|
||||||
[comment setValue:body forKey:@"bodyText"];
|
|
||||||
|
|
||||||
[comment setValue:bodyMutableAttributedText forKey:@"bodyAttributedText"];
|
|
||||||
|
|
||||||
[[commentTreeNode commentTreeHeaderNode] updateContentViewsForData:comment];
|
[[commentTreeNode commentTreeHeaderNode] performSelectorOnMainThread:@selector(updateContentViewsForData:) withObject:comment waitUntilDone:NO];
|
||||||
|
|
||||||
[request release];
|
[request release];
|
||||||
[queue release];
|
[queue release];
|
||||||
[bodyMutableAttributedText release];
|
[bodyMutableAttributedText release];
|
||||||
[themeManager release];
|
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -144,11 +164,10 @@
|
|||||||
|
|
||||||
|
|
||||||
%hook PostDetailViewController
|
%hook PostDetailViewController
|
||||||
%property(assign,nonatomic) id feedPostTextWithThumbnailNode;
|
%property(strong,nonatomic) id feedPostTextWithThumbnailNode;
|
||||||
%property(assign,nonatomic) id feedPostDetailCellNode;
|
%property(strong,nonatomic) id feedPostDetailCellNode;
|
||||||
%end
|
%end
|
||||||
|
|
||||||
|
|
||||||
%hook FeedPostDetailCellNode
|
%hook FeedPostDetailCellNode
|
||||||
|
|
||||||
-(void) didLoad{
|
-(void) didLoad{
|
||||||
@ -158,12 +177,11 @@
|
|||||||
}
|
}
|
||||||
%end
|
%end
|
||||||
|
|
||||||
|
|
||||||
%hook PostActionSheetViewController
|
%hook PostActionSheetViewController
|
||||||
|
|
||||||
-(void) setItems:(id) arg1{
|
-(void) setItems:(id) arg1{
|
||||||
|
|
||||||
id post = [self post];
|
Post *post = [self post];
|
||||||
|
|
||||||
if ([post isSelfPost]){
|
if ([post isSelfPost]){
|
||||||
|
|
||||||
@ -192,7 +210,7 @@
|
|||||||
|
|
||||||
[self dismissViewControllerAnimated:YES completion:nil];
|
[self dismissViewControllerAnimated:YES completion:nil];
|
||||||
|
|
||||||
id post = [self post];
|
Post *post = [self post];
|
||||||
|
|
||||||
if ([post isSelfPost]){
|
if ([post isSelfPost]){
|
||||||
|
|
||||||
@ -238,7 +256,9 @@
|
|||||||
textColor = [[themeManager lightTheme] bodyTextColor];
|
textColor = [[themeManager lightTheme] bodyTextColor];
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
[themeManager release];
|
||||||
|
|
||||||
|
} else if ([appVersion[1] integerValue] >= 37){
|
||||||
themeManager = [[%c(ThemeManager) alloc] initWithTraitCollection:nil appSettings:[%c(AppSettings) sharedSettings]];
|
themeManager = [[%c(ThemeManager) alloc] initWithTraitCollection:nil appSettings:[%c(AppSettings) sharedSettings]];
|
||||||
isNightMode = [[[%c(AccountManager) sharedManager] defaults] objectForKey:@"kUseNightKey"];
|
isNightMode = [[[%c(AccountManager) sharedManager] defaults] objectForKey:@"kUseNightKey"];
|
||||||
|
|
||||||
@ -247,7 +267,19 @@
|
|||||||
} else{
|
} else{
|
||||||
textColor = [[themeManager dayTheme] bodyTextColor];
|
textColor = [[themeManager dayTheme] bodyTextColor];
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
[themeManager release];
|
||||||
|
|
||||||
|
} else {
|
||||||
|
themeManager = [%c(ThemeManager) sharedManager];
|
||||||
|
isNightMode = [[[%c(AccountManager) sharedManager] defaults] objectForKey:@"kUseNightKey"];
|
||||||
|
|
||||||
|
if (isNightMode) {
|
||||||
|
textColor = [[themeManager nightTheme] bodyTextColor];
|
||||||
|
} else{
|
||||||
|
textColor = [[themeManager dayTheme] bodyTextColor];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
NSMutableAttributedString *bodyMutableAttributedText = [[NSMutableAttributedString alloc] initWithAttributedString:[%c(NSAttributedStringMarkdownParser) attributedStringUsingCurrentConfig:body]];
|
NSMutableAttributedString *bodyMutableAttributedText = [[NSMutableAttributedString alloc] initWithAttributedString:[%c(NSAttributedStringMarkdownParser) attributedStringUsingCurrentConfig:body]];
|
||||||
|
|
||||||
@ -258,21 +290,23 @@
|
|||||||
}];
|
}];
|
||||||
[bodyMutableAttributedText endEditing];
|
[bodyMutableAttributedText endEditing];
|
||||||
|
|
||||||
[post setValue:bodyMutableAttributedText forKey:@"selfPostRichTextAttributed"];
|
[post setSelfText:body];
|
||||||
[post setValue:bodyMutableAttributedText forKey:@"previewFeedPostTextString"];
|
|
||||||
[post setAuthor:author];
|
[post setAuthor:author];
|
||||||
[post setValue:body forKey:@"selfText"];
|
[post setSelfPostRichTextAttributed:bodyMutableAttributedText];
|
||||||
|
[post setPreviewFeedPostTextString:bodyMutableAttributedText];
|
||||||
|
|
||||||
if ([appVersion[1] integerValue] >= 44){
|
if ([appVersion[1] integerValue] >= 44){
|
||||||
[[[[[self postActionSheetDelegate] controller] feedPostDetailCellNode] contentNode] configureSelfTextNode];
|
[[[[[self postActionSheetDelegate] controller] feedPostDetailCellNode] contentNode] configureSelfTextNode];
|
||||||
|
} else if ([appVersion[1] integerValue] >= 38) {
|
||||||
|
[[[[self postActionSheetDelegate] controller] feedPostDetailCellNode] configureSelfTextNode];
|
||||||
} else {
|
} else {
|
||||||
[[[[self postActionSheetDelegate] controller] feedPostDetailCellNode] configureSelfTextNode];
|
[[[[self postActionSheetDelegate] controller] feedPostDetailCellNode] configureSelfTextNode];
|
||||||
|
[[[[[self postActionSheetDelegate] controller] feedPostDetailCellNode] titleNode] configureNodes];
|
||||||
}
|
}
|
||||||
|
|
||||||
[request release];
|
[request release];
|
||||||
[queue release];
|
[queue release];
|
||||||
[bodyMutableAttributedText release];
|
[bodyMutableAttributedText release];
|
||||||
[themeManager release];
|
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -283,7 +317,179 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
%group Redditv3
|
%group Reddit_v4_ios10
|
||||||
|
|
||||||
|
%hook CommentsViewController
|
||||||
|
|
||||||
|
%new
|
||||||
|
-(void) updateComments{
|
||||||
|
[self reloadCommentsWithNewCommentsHighlight:NO autoScroll:NO animated:NO];
|
||||||
|
}
|
||||||
|
|
||||||
|
%new
|
||||||
|
-(void) updatePostText{
|
||||||
|
[self reloadPostSection:YES];
|
||||||
|
}
|
||||||
|
|
||||||
|
%end
|
||||||
|
|
||||||
|
%hook CommentActionSheetViewController
|
||||||
|
|
||||||
|
-(void) setItems:(id) arg1{
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
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]];
|
||||||
|
|
||||||
|
%orig([arg1 arrayByAddingObject:undeleteItem]);
|
||||||
|
|
||||||
|
[undeleteItem release];
|
||||||
|
}
|
||||||
|
|
||||||
|
-(void) handleDidSelectActionSheetItem:(id) arg1{
|
||||||
|
%orig;
|
||||||
|
|
||||||
|
if ([[arg1 identifier] isEqualToString:@"undeleteItemIdentifier"]){
|
||||||
|
|
||||||
|
[self dismissViewControllerAnimated:YES completion:nil];
|
||||||
|
|
||||||
|
Comment *comment = [self comment];
|
||||||
|
|
||||||
|
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init];
|
||||||
|
NSOperationQueue *queue = [[NSOperationQueue alloc] init];
|
||||||
|
|
||||||
|
[request setURL:[NSURL URLWithString:[NSString stringWithFormat:@"https://api.pushshift.io/reddit/search/comment/?ids=%@&fields=author,body",[[comment pk] componentsSeparatedByString:@"_"][1]]]];
|
||||||
|
[request setHTTPMethod:@"GET"];
|
||||||
|
|
||||||
|
[NSURLConnection sendAsynchronousRequest:request queue:queue completionHandler:^(NSURLResponse *response, NSData *data, NSError *error) {
|
||||||
|
|
||||||
|
NSString *author = @"[author]";
|
||||||
|
NSString *body = @"[body]";
|
||||||
|
|
||||||
|
if (data != nil && error == nil){
|
||||||
|
id jsonData = [NSJSONSerialization JSONObjectWithData:data options:0 error:&error];
|
||||||
|
if ([[jsonData objectForKey:@"data"] count] != 0){
|
||||||
|
author = [[jsonData objectForKey:@"data"][0] objectForKey:@"author"];
|
||||||
|
body = [[jsonData objectForKey:@"data"][0] objectForKey:@"body"];
|
||||||
|
if ([body isEqualToString:@"[deleted]"] || [body isEqualToString:@"[removed]"]){
|
||||||
|
body = @"[pushshift was unable to archive this]";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
body = @"[pushshift has not archived this yet]";
|
||||||
|
}
|
||||||
|
} else if (error != nil || data == nil){
|
||||||
|
body = @"[an error occured]";
|
||||||
|
}
|
||||||
|
|
||||||
|
NSMutableAttributedString *bodyMutableAttributedText = [[NSMutableAttributedString alloc] initWithAttributedString:[%c(NSAttributedStringMarkdownParser) attributedStringUsingCurrentConfig:body]];
|
||||||
|
|
||||||
|
[comment setAuthor:author];
|
||||||
|
[comment setBodyText:body];
|
||||||
|
[comment setBodyRichTextAttributed:bodyMutableAttributedText];
|
||||||
|
[comment setBodyAttributedText:bodyMutableAttributedText];
|
||||||
|
|
||||||
|
[[self commentActionSheetDelegate] performSelectorOnMainThread:@selector(updateComments) withObject:nil waitUntilDone:NO];
|
||||||
|
|
||||||
|
[request release];
|
||||||
|
[queue release];
|
||||||
|
[bodyMutableAttributedText release];
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
%end
|
||||||
|
|
||||||
|
|
||||||
|
%hook PostActionSheetViewController
|
||||||
|
|
||||||
|
-(void) setItems:(id) arg1{
|
||||||
|
|
||||||
|
Post *post = [self post];
|
||||||
|
|
||||||
|
if ([post isSelfPost]){
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
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]];
|
||||||
|
|
||||||
|
arg1 = [arg1 arrayByAddingObject:undeleteItem];
|
||||||
|
|
||||||
|
[undeleteItem release];
|
||||||
|
}
|
||||||
|
|
||||||
|
%orig;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
-(void) handleDidSelectActionSheetItem:(id) arg1{
|
||||||
|
%orig;
|
||||||
|
|
||||||
|
if ([[arg1 identifier] isEqualToString:@"undeleteItemIdentifier"]){
|
||||||
|
|
||||||
|
[self dismissViewControllerAnimated:YES completion:nil];
|
||||||
|
|
||||||
|
Post *post = [self post];
|
||||||
|
|
||||||
|
if ([post isSelfPost]){
|
||||||
|
|
||||||
|
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init];
|
||||||
|
NSOperationQueue *queue = [[NSOperationQueue alloc] init];
|
||||||
|
|
||||||
|
[request setURL:[NSURL URLWithString:[NSString stringWithFormat:@"https://api.pushshift.io/reddit/search/submission/?ids=%@&fields=author,selftext",[[post pk] componentsSeparatedByString:@"_"][1]]]];
|
||||||
|
[request setHTTPMethod:@"GET"];
|
||||||
|
|
||||||
|
[NSURLConnection sendAsynchronousRequest:request queue:queue completionHandler:^(NSURLResponse *response, NSData *data, NSError *error) {
|
||||||
|
|
||||||
|
NSString *author = @"[author]";
|
||||||
|
NSString *body = @"[body]";
|
||||||
|
|
||||||
|
if (data != nil && error == nil){
|
||||||
|
id jsonData = [NSJSONSerialization JSONObjectWithData:data options:0 error:&error];
|
||||||
|
if ([[jsonData objectForKey:@"data"] count] != 0){
|
||||||
|
author = [[jsonData objectForKey:@"data"][0] objectForKey:@"author"];
|
||||||
|
body = [[jsonData objectForKey:@"data"][0] objectForKey:@"selftext"];
|
||||||
|
if ([body isEqualToString:@"[deleted]"] || [body isEqualToString:@"[removed]"]){
|
||||||
|
body = @"[pushshift was unable to archive this]";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
body = @"[pushshift has not archived this yet]";
|
||||||
|
}
|
||||||
|
} else if (error != nil || data == nil){
|
||||||
|
body = @"[an error occured]";
|
||||||
|
}
|
||||||
|
|
||||||
|
NSMutableAttributedString *bodyMutableAttributedText = [[NSMutableAttributedString alloc] initWithAttributedString:[%c(NSAttributedStringMarkdownParser) attributedStringUsingCurrentConfig:body]];
|
||||||
|
|
||||||
|
[post setSelfText:body];
|
||||||
|
[post setAuthor:author];
|
||||||
|
[post setSelfPostRichTextAttributed:bodyMutableAttributedText];
|
||||||
|
[post setPreviewFeedPostTextString:bodyMutableAttributedText];
|
||||||
|
|
||||||
|
[[self postActionSheetDelegate] performSelectorOnMainThread:@selector(updatePostText) withObject:nil waitUntilDone:NO];
|
||||||
|
|
||||||
|
[request release];
|
||||||
|
[queue release];
|
||||||
|
[bodyMutableAttributedText release];
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
%end
|
||||||
|
|
||||||
|
%end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
%group Reddit_v3
|
||||||
|
|
||||||
%hook CommentView
|
%hook CommentView
|
||||||
|
|
||||||
@ -325,7 +531,6 @@
|
|||||||
[comment setValue:body forKey:@"bodyText"];
|
[comment setValue:body forKey:@"bodyText"];
|
||||||
|
|
||||||
[commentsViewController reloadCommentsWithNewCommentsHighlight:NO autoScroll:NO animated:NO];
|
[commentsViewController reloadCommentsWithNewCommentsHighlight:NO autoScroll:NO animated:NO];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -359,7 +564,6 @@
|
|||||||
UIButton *button = [self undeleteButton];
|
UIButton *button = [self undeleteButton];
|
||||||
|
|
||||||
button.frame = CGRectMake([[self overflowButton ] frame].origin.x - 32, 0, 32, 32);
|
button.frame = CGRectMake([[self overflowButton ] frame].origin.x - 32, 0, 32, 32);
|
||||||
|
|
||||||
}
|
}
|
||||||
%end
|
%end
|
||||||
|
|
||||||
@ -371,14 +575,17 @@
|
|||||||
%ctor{
|
%ctor{
|
||||||
|
|
||||||
NSString* processName = [[NSProcessInfo processInfo] processName];
|
NSString* processName = [[NSProcessInfo processInfo] processName];
|
||||||
NSString* version = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"];
|
NSArray* appVersion = [[[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"] componentsSeparatedByString:@"."];
|
||||||
NSArray* versionArray = [version componentsSeparatedByString:@"."];
|
|
||||||
|
|
||||||
if ([processName isEqualToString:@"Reddit"]){
|
if ([processName isEqualToString:@"Reddit"]){
|
||||||
if ([versionArray[0] isEqualToString:@"4"]){
|
if ([appVersion[0] isEqualToString:@"4"]){
|
||||||
%init(Redditv4);
|
if ([appVersion[1] integerValue] <= 32){
|
||||||
} else if ([versionArray[0] isEqualToString:@"3"]) {
|
%init(Reddit_v4_ios10);
|
||||||
%init(Redditv3);
|
} else{
|
||||||
|
%init(Reddit_v4_current);
|
||||||
|
}
|
||||||
|
} else if ([appVersion[0] isEqualToString:@"3"]) {
|
||||||
|
%init(Reddit_v3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user