|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#import <Cephei/HBPreferences.h>
|
|
|
#import "Reddit.h"
|
|
|
#import "Reddit.h"
|
|
|
|
|
|
|
|
|
|
|
|
HBPreferences *redditPrefs;
|
|
|
|
|
|
CGFloat redditRequestTimeoutValue;
|
|
|
|
|
|
|
|
|
|
|
|
NSArray *redditVersion;
|
|
|
|
|
|
|
|
|
%group Reddit_v4_current
|
|
|
%group Reddit_v4_current
|
|
|
|
|
|
|
|
|
%hook CommentTreeNode
|
|
|
%hook CommentTreeNode
|
|
|
|
|
|
|
|
|
NSOperationQueue *queue = [[NSOperationQueue 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 setURL:[NSURL URLWithString:[NSString stringWithFormat:@"https://api.pushshift.io/reddit/search/comment/?ids=%@&fields=author,body",[[comment pk] componentsSeparatedByString:@"_"][1]]]];
|
|
|
[request setHTTPMethod:@"GET"];
|
|
|
|
|
|
|
|
|
[request setHTTPMethod:@"GET"];
|
|
|
|
|
|
[request setTimeoutInterval:[redditPrefs doubleForKey:@"requestTimeoutValue" default:10]];
|
|
|
|
|
|
|
|
|
[NSURLConnection sendAsynchronousRequest:request queue:queue completionHandler:^(NSURLResponse *response, NSData *data, NSError *error) {
|
|
|
[NSURLConnection sendAsynchronousRequest:request queue:queue completionHandler:^(NSURLResponse *response, NSData *data, NSError *error) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
body = @"[pushshift has not archived this yet]";
|
|
|
body = @"[pushshift has not archived this yet]";
|
|
|
}
|
|
|
}
|
|
|
} else if (error != nil || data == nil){
|
|
|
} else if (error != nil || data == nil){
|
|
|
body = @"[an error occured]";
|
|
|
|
|
|
|
|
|
body = [NSString stringWithFormat:@"[an error occured while attempting to contact pushshift api (%@)]", [error localizedDescription]];
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
NSArray* appVersion = [[[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"] componentsSeparatedByString:@"."];
|
|
|
|
|
|
|
|
|
|
|
|
NSMutableAttributedString *bodyMutableAttributedText;
|
|
|
NSMutableAttributedString *bodyMutableAttributedText;
|
|
|
|
|
|
|
|
|
id themeManager;
|
|
|
id themeManager;
|
|
|
id isNightMode;
|
|
|
id isNightMode;
|
|
|
id textColor;
|
|
|
id textColor;
|
|
|
|
|
|
|
|
|
if ([appVersion[1] integerValue] >= 45){
|
|
|
|
|
|
|
|
|
if ([redditVersion[1] integerValue] >= 45){
|
|
|
themeManager = [[%c(ThemeManager) alloc] initWithAppSettings:[%c(AppSettings) sharedSettings]];
|
|
|
themeManager = [[%c(ThemeManager) alloc] initWithAppSettings:[%c(AppSettings) sharedSettings]];
|
|
|
isNightMode = [[[%c(AccountManager) sharedManager] defaults] objectForKey:@"kUseNightKey"];
|
|
|
isNightMode = [[[%c(AccountManager) sharedManager] defaults] objectForKey:@"kUseNightKey"];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[themeManager release];
|
|
|
[themeManager release];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else if ([appVersion[1] integerValue] >= 37){
|
|
|
|
|
|
|
|
|
} else if ([redditVersion[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"];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
NSOperationQueue *queue = [[NSOperationQueue 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 setURL:[NSURL URLWithString:[NSString stringWithFormat:@"https://api.pushshift.io/reddit/search/submission/?ids=%@&fields=author,selftext",[[post pk] componentsSeparatedByString:@"_"][1]]]];
|
|
|
[request setHTTPMethod:@"GET"];
|
|
|
|
|
|
|
|
|
[request setHTTPMethod:@"GET"];
|
|
|
|
|
|
[request setTimeoutInterval:[redditPrefs doubleForKey:@"requestTimeoutValue" default:10]];
|
|
|
|
|
|
|
|
|
[NSURLConnection sendAsynchronousRequest:request queue:queue completionHandler:^(NSURLResponse *response, NSData *data, NSError *error) {
|
|
|
[NSURLConnection sendAsynchronousRequest:request queue:queue completionHandler:^(NSURLResponse *response, NSData *data, NSError *error) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
body = @"[pushshift has not archived this yet]";
|
|
|
body = @"[pushshift has not archived this yet]";
|
|
|
}
|
|
|
}
|
|
|
} else if (error != nil || data == nil){
|
|
|
} else if (error != nil || data == nil){
|
|
|
body = @"[an error occured]";
|
|
|
|
|
|
|
|
|
body = [NSString stringWithFormat:@"[an error occured while attempting to contact pushshift api (%@)]", [error localizedDescription]];
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
NSArray* appVersion = [[[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"] componentsSeparatedByString:@"."];
|
|
|
|
|
|
|
|
|
|
|
|
id themeManager;
|
|
|
id themeManager;
|
|
|
id isNightMode;
|
|
|
id isNightMode;
|
|
|
id textColor;
|
|
|
id textColor;
|
|
|
|
|
|
|
|
|
if ([appVersion[1] integerValue] >= 45){
|
|
|
|
|
|
|
|
|
if ([redditVersion[1] integerValue] >= 45){
|
|
|
themeManager = [[%c(ThemeManager) alloc] initWithAppSettings:[%c(AppSettings) sharedSettings]];
|
|
|
themeManager = [[%c(ThemeManager) alloc] initWithAppSettings:[%c(AppSettings) sharedSettings]];
|
|
|
isNightMode = [[[%c(AccountManager) sharedManager] defaults] objectForKey:@"kUseNightKey"];
|
|
|
isNightMode = [[[%c(AccountManager) sharedManager] defaults] objectForKey:@"kUseNightKey"];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[themeManager release];
|
|
|
[themeManager release];
|
|
|
|
|
|
|
|
|
} else if ([appVersion[1] integerValue] >= 37){
|
|
|
|
|
|
|
|
|
} else if ([redditVersion[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"];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[post setSelfPostRichTextAttributed:bodyMutableAttributedText];
|
|
|
[post setSelfPostRichTextAttributed:bodyMutableAttributedText];
|
|
|
[post setPreviewFeedPostTextString:bodyMutableAttributedText];
|
|
|
[post setPreviewFeedPostTextString:bodyMutableAttributedText];
|
|
|
|
|
|
|
|
|
if ([appVersion[1] integerValue] >= 44){
|
|
|
|
|
|
|
|
|
if ([redditVersion[1] integerValue] >= 44){
|
|
|
[[[[[self postActionSheetDelegate] controller] feedPostDetailCellNode] contentNode] configureSelfTextNode];
|
|
|
[[[[[self postActionSheetDelegate] controller] feedPostDetailCellNode] contentNode] configureSelfTextNode];
|
|
|
} else if ([appVersion[1] integerValue] >= 38) {
|
|
|
|
|
|
|
|
|
} else if ([redditVersion[1] integerValue] >= 38) {
|
|
|
[[[[self postActionSheetDelegate] controller] feedPostDetailCellNode] configureSelfTextNode];
|
|
|
[[[[self postActionSheetDelegate] controller] feedPostDetailCellNode] configureSelfTextNode];
|
|
|
} else {
|
|
|
} else {
|
|
|
[[[[self postActionSheetDelegate] controller] feedPostDetailCellNode] configureSelfTextNode];
|
|
|
[[[[self postActionSheetDelegate] controller] feedPostDetailCellNode] configureSelfTextNode];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
%new
|
|
|
%new
|
|
|
-(void) updatePostText{
|
|
|
-(void) updatePostText{
|
|
|
NSArray* appVersion = [[[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"] componentsSeparatedByString:@"."];
|
|
|
|
|
|
|
|
|
|
|
|
if ([appVersion[1] integerValue] >= 2){
|
|
|
|
|
|
|
|
|
if ([redditVersion[1] integerValue] >= 2){
|
|
|
[self reloadPostSection:YES];
|
|
|
[self reloadPostSection:YES];
|
|
|
} else {
|
|
|
} else {
|
|
|
[self feedPostViewDidUpdatePost:[self postData] shouldReloadFeed:NO];
|
|
|
[self feedPostViewDidUpdatePost:[self postData] shouldReloadFeed:NO];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
id undeleteItem;
|
|
|
id undeleteItem;
|
|
|
|
|
|
|
|
|
NSArray* appVersion = [[[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"] componentsSeparatedByString:@"."];
|
|
|
|
|
|
|
|
|
|
|
|
if ([appVersion[1] integerValue] >= 18) {
|
|
|
|
|
|
|
|
|
if ([redditVersion[1] integerValue] >= 18) {
|
|
|
undeleteItem = [[%c(RUIActionSheetItem) alloc] initWithLeftIconImage:newImage text:@"TF did that say?" identifier:@"undeleteItemIdentifier" context:[self comment]];
|
|
|
undeleteItem = [[%c(RUIActionSheetItem) alloc] initWithLeftIconImage:newImage text:@"TF did that say?" identifier:@"undeleteItemIdentifier" context:[self comment]];
|
|
|
} else {
|
|
|
} else {
|
|
|
undeleteItem = [[%c(ActionSheetItem) alloc] initWithLeftIconImage:newImage text:@"TF did that say?" identifier:@"undeleteItemIdentifier" context:[self comment]];
|
|
|
undeleteItem = [[%c(ActionSheetItem) alloc] initWithLeftIconImage:newImage text:@"TF did that say?" identifier:@"undeleteItemIdentifier" context:[self comment]];
|
|
|
|
|
|
|
|
|
NSOperationQueue *queue = [[NSOperationQueue 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 setURL:[NSURL URLWithString:[NSString stringWithFormat:@"https://api.pushshift.io/reddit/search/comment/?ids=%@&fields=author,body",[[comment pk] componentsSeparatedByString:@"_"][1]]]];
|
|
|
[request setHTTPMethod:@"GET"];
|
|
|
|
|
|
|
|
|
[request setHTTPMethod:@"GET"];
|
|
|
|
|
|
[request setTimeoutInterval:[redditPrefs doubleForKey:@"requestTimeoutValue" default:10]];
|
|
|
|
|
|
|
|
|
[NSURLConnection sendAsynchronousRequest:request queue:queue completionHandler:^(NSURLResponse *response, NSData *data, NSError *error) {
|
|
|
[NSURLConnection sendAsynchronousRequest:request queue:queue completionHandler:^(NSURLResponse *response, NSData *data, NSError *error) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
body = @"[pushshift has not archived this yet]";
|
|
|
body = @"[pushshift has not archived this yet]";
|
|
|
}
|
|
|
}
|
|
|
} else if (error != nil || data == nil){
|
|
|
} else if (error != nil || data == nil){
|
|
|
body = @"[an error occured]";
|
|
|
|
|
|
|
|
|
body = [NSString stringWithFormat:@"[an error occured while attempting to contact pushshift api (%@)]", [error localizedDescription]];
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
NSMutableAttributedString *bodyMutableAttributedText = [[NSMutableAttributedString alloc] initWithAttributedString:[%c(NSAttributedStringMarkdownParser) attributedStringUsingCurrentConfig:body]];
|
|
|
NSMutableAttributedString *bodyMutableAttributedText = [[NSMutableAttributedString alloc] initWithAttributedString:[%c(NSAttributedStringMarkdownParser) attributedStringUsingCurrentConfig:body]];
|
|
|
|
|
|
|
|
|
NSOperationQueue *queue = [[NSOperationQueue 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 setURL:[NSURL URLWithString:[NSString stringWithFormat:@"https://api.pushshift.io/reddit/search/comment/?ids=%@&fields=author,body",[[comment pk] componentsSeparatedByString:@"_"][1]]]];
|
|
|
[request setHTTPMethod:@"GET"];
|
|
|
|
|
|
|
|
|
[request setHTTPMethod:@"GET"];
|
|
|
|
|
|
[request setTimeoutInterval:[redditPrefs doubleForKey:@"requestTimeoutValue" default:10]];
|
|
|
|
|
|
|
|
|
[NSURLConnection sendAsynchronousRequest:request queue:queue completionHandler:^(NSURLResponse *response, NSData *data, NSError *error) {
|
|
|
[NSURLConnection sendAsynchronousRequest:request queue:queue completionHandler:^(NSURLResponse *response, NSData *data, NSError *error) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
body = @"[pushshift has not archived this yet]";
|
|
|
body = @"[pushshift has not archived this yet]";
|
|
|
}
|
|
|
}
|
|
|
} else if (error != nil || data == nil){
|
|
|
} else if (error != nil || data == nil){
|
|
|
body = @"[an error occured]";
|
|
|
|
|
|
|
|
|
body = [NSString stringWithFormat:@"[an error occured while attempting to contact pushshift api (%@)]", [error localizedDescription]];
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
NSArray* appVersion = [[[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"] componentsSeparatedByString:@"."];
|
|
|
|
|
|
|
|
|
|
|
|
NSMutableAttributedString *bodyMutableAttributedText = [[NSMutableAttributedString alloc] initWithAttributedString:[%c(NSAttributedStringMarkdownParser) attributedStringUsingCurrentConfig:body]];
|
|
|
NSMutableAttributedString *bodyMutableAttributedText = [[NSMutableAttributedString alloc] initWithAttributedString:[%c(NSAttributedStringMarkdownParser) attributedStringUsingCurrentConfig:body]];
|
|
|
|
|
|
|
|
|
[comment setAuthor:author];
|
|
|
[comment setAuthor:author];
|
|
|
[comment setBodyText:body];
|
|
|
[comment setBodyText:body];
|
|
|
[comment setBodyAttributedText:bodyMutableAttributedText];
|
|
|
[comment setBodyAttributedText:bodyMutableAttributedText];
|
|
|
|
|
|
|
|
|
if ([appVersion[1] integerValue] >= 12) {
|
|
|
|
|
|
|
|
|
if ([redditVersion[1] integerValue] >= 12) {
|
|
|
[comment setBodyRichTextAttributed:bodyMutableAttributedText];
|
|
|
[comment setBodyRichTextAttributed:bodyMutableAttributedText];
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UIImage *newImage = [UIImage imageWithCGImage:[origImage CGImage] scale:scale orientation:origImage.imageOrientation];
|
|
|
UIImage *newImage = [UIImage imageWithCGImage:[origImage CGImage] scale:scale orientation:origImage.imageOrientation];
|
|
|
|
|
|
|
|
|
id undeleteItem;
|
|
|
id undeleteItem;
|
|
|
|
|
|
|
|
|
NSArray* appVersion = [[[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"] componentsSeparatedByString:@"."];
|
|
|
|
|
|
|
|
|
|
|
|
if ([appVersion[1] integerValue] >= 18) {
|
|
|
|
|
|
|
|
|
if ([redditVersion[1] integerValue] >= 18) {
|
|
|
undeleteItem = [[%c(RUIActionSheetItem) alloc] initWithLeftIconImage:newImage text:@"TF did that say?" identifier:@"undeleteItemIdentifier" context:[self post]];
|
|
|
undeleteItem = [[%c(RUIActionSheetItem) alloc] initWithLeftIconImage:newImage text:@"TF did that say?" identifier:@"undeleteItemIdentifier" context:[self post]];
|
|
|
} else {
|
|
|
} else {
|
|
|
undeleteItem = [[%c(ActionSheetItem) alloc] initWithLeftIconImage:newImage text:@"TF did that say?" identifier:@"undeleteItemIdentifier" context:[self post]];
|
|
|
undeleteItem = [[%c(ActionSheetItem) alloc] initWithLeftIconImage:newImage text:@"TF did that say?" identifier:@"undeleteItemIdentifier" context:[self post]];
|
|
|
|
|
|
|
|
|
NSOperationQueue *queue = [[NSOperationQueue 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 setURL:[NSURL URLWithString:[NSString stringWithFormat:@"https://api.pushshift.io/reddit/search/submission/?ids=%@&fields=author,selftext",[[post pk] componentsSeparatedByString:@"_"][1]]]];
|
|
|
[request setHTTPMethod:@"GET"];
|
|
|
|
|
|
|
|
|
[request setHTTPMethod:@"GET"];
|
|
|
|
|
|
[request setTimeoutInterval:[redditPrefs doubleForKey:@"requestTimeoutValue" default:10]];
|
|
|
|
|
|
|
|
|
[NSURLConnection sendAsynchronousRequest:request queue:queue completionHandler:^(NSURLResponse *response, NSData *data, NSError *error) {
|
|
|
[NSURLConnection sendAsynchronousRequest:request queue:queue completionHandler:^(NSURLResponse *response, NSData *data, NSError *error) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
body = @"[pushshift has not archived this yet]";
|
|
|
body = @"[pushshift has not archived this yet]";
|
|
|
}
|
|
|
}
|
|
|
} else if (error != nil || data == nil){
|
|
|
} else if (error != nil || data == nil){
|
|
|
body = @"[an error occured]";
|
|
|
|
|
|
|
|
|
body = [NSString stringWithFormat:@"[an error occured while attempting to contact pushshift api (%@)]", [error localizedDescription]];
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
NSMutableAttributedString *bodyMutableAttributedText = [[NSMutableAttributedString alloc] initWithAttributedString:[%c(NSAttributedStringMarkdownParser) attributedStringUsingCurrentConfig:body]];
|
|
|
NSMutableAttributedString *bodyMutableAttributedText = [[NSMutableAttributedString alloc] initWithAttributedString:[%c(NSAttributedStringMarkdownParser) attributedStringUsingCurrentConfig:body]];
|
|
|
|
|
|
|
|
|
NSOperationQueue *queue = [[NSOperationQueue 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 setURL:[NSURL URLWithString:[NSString stringWithFormat:@"https://api.pushshift.io/reddit/search/submission/?ids=%@&fields=author,selftext",[[post pk] componentsSeparatedByString:@"_"][1]]]];
|
|
|
[request setHTTPMethod:@"GET"];
|
|
|
|
|
|
|
|
|
[request setHTTPMethod:@"GET"];
|
|
|
|
|
|
[request setTimeoutInterval:[redditPrefs doubleForKey:@"requestTimeoutValue" default:10]];
|
|
|
|
|
|
|
|
|
[NSURLConnection sendAsynchronousRequest:request queue:queue completionHandler:^(NSURLResponse *response, NSData *data, NSError *error) {
|
|
|
[NSURLConnection sendAsynchronousRequest:request queue:queue completionHandler:^(NSURLResponse *response, NSData *data, NSError *error) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
body = @"[pushshift has not archived this yet]";
|
|
|
body = @"[pushshift has not archived this yet]";
|
|
|
}
|
|
|
}
|
|
|
} else if (error != nil || data == nil){
|
|
|
} else if (error != nil || data == nil){
|
|
|
body = @"[an error occured]";
|
|
|
|
|
|
|
|
|
body = [NSString stringWithFormat:@"[an error occured while attempting to contact pushshift api (%@)]", [error localizedDescription]];
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
NSArray* appVersion = [[[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"] componentsSeparatedByString:@"."];
|
|
|
|
|
|
|
|
|
|
|
|
NSMutableAttributedString *bodyMutableAttributedText = [[NSMutableAttributedString alloc] initWithAttributedString:[%c(NSAttributedStringMarkdownParser) attributedStringUsingCurrentConfig:body]];
|
|
|
NSMutableAttributedString *bodyMutableAttributedText = [[NSMutableAttributedString alloc] initWithAttributedString:[%c(NSAttributedStringMarkdownParser) attributedStringUsingCurrentConfig:body]];
|
|
|
|
|
|
|
|
|
[post setAuthor:author];
|
|
|
[post setAuthor:author];
|
|
|
[post setSelfText:body];
|
|
|
[post setSelfText:body];
|
|
|
[post setSelfTextAttributed:bodyMutableAttributedText];
|
|
|
[post setSelfTextAttributed:bodyMutableAttributedText];
|
|
|
|
|
|
|
|
|
if ([appVersion[1] integerValue] >= 8) {
|
|
|
|
|
|
|
|
|
if ([redditVersion[1] integerValue] >= 8) {
|
|
|
[post setSelfPostRichTextAttributed:bodyMutableAttributedText];
|
|
|
[post setSelfPostRichTextAttributed:bodyMutableAttributedText];
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
if ([appVersion[1] integerValue] >= 15) {
|
|
|
|
|
|
|
|
|
if ([redditVersion[1] integerValue] >= 15) {
|
|
|
[post setPreviewFeedPostTextString:bodyMutableAttributedText];
|
|
|
[post setPreviewFeedPostTextString:bodyMutableAttributedText];
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
%ctor{
|
|
|
%ctor{
|
|
|
|
|
|
|
|
|
|
|
|
redditPrefs = [[HBPreferences alloc] initWithIdentifier:@"com.lint.undelete.prefs"];
|
|
|
|
|
|
[redditPrefs registerDouble:&redditRequestTimeoutValue default:10 forKey:@"requestTimeoutValue"];
|
|
|
|
|
|
|
|
|
NSString* processName = [[NSProcessInfo processInfo] processName];
|
|
|
NSString* processName = [[NSProcessInfo processInfo] processName];
|
|
|
NSArray* appVersion = [[[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"] componentsSeparatedByString:@"."];
|
|
|
|
|
|
|
|
|
redditVersion = [[[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"] componentsSeparatedByString:@"."];
|
|
|
|
|
|
|
|
|
if ([processName isEqualToString:@"Reddit"]){
|
|
|
if ([processName isEqualToString:@"Reddit"]){
|
|
|
if ([appVersion[0] isEqualToString:@"4"]){
|
|
|
|
|
|
if ([appVersion[1] integerValue] <= 32){
|
|
|
|
|
|
|
|
|
if ([redditVersion[0] isEqualToString:@"4"]){
|
|
|
|
|
|
if ([redditVersion[1] integerValue] <= 32){
|
|
|
%init(Reddit_v4_ios10);
|
|
|
%init(Reddit_v4_ios10);
|
|
|
} else{
|
|
|
} else{
|
|
|
%init(Reddit_v4_current);
|
|
|
%init(Reddit_v4_current);
|
|
|
}
|
|
|
}
|
|
|
} else if ([appVersion[0] isEqualToString:@"3"]) {
|
|
|
|
|
|
|
|
|
} else if ([redditVersion[0] isEqualToString:@"3"]) {
|
|
|
%init(Reddit_v3);
|
|
|
%init(Reddit_v3);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|