forked from lint/TFDidThatSay
Add Reddit v2021 support
This commit is contained in:
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
#import <UIKit/UIKit.h>
|
#import <UIKit/UIKit.h>
|
||||||
|
|
||||||
/* ---- Reddit v3 & v4 ---- */
|
/* ---- Reddit v3 & v4 & v2020 & v2021 ---- */
|
||||||
|
|
||||||
/* -- Comment Interfaces -- */
|
/* -- Comment Interfaces -- */
|
||||||
|
|
||||||
@ -38,9 +38,13 @@
|
|||||||
@end
|
@end
|
||||||
|
|
||||||
|
|
||||||
/* ---- Reddit v4 ---- */
|
/* ---- Reddit v4+ ---- */
|
||||||
|
|
||||||
|
|
||||||
|
@interface ASDisplayNode
|
||||||
|
- (id)supernode;
|
||||||
|
@end
|
||||||
|
|
||||||
/* -- Comment Interfaces -- */
|
/* -- Comment Interfaces -- */
|
||||||
|
|
||||||
@interface CommentTreeNode
|
@interface CommentTreeNode
|
||||||
@ -55,7 +59,7 @@
|
|||||||
@property(strong, nonatomic) id commentNode;
|
@property(strong, nonatomic) id commentNode;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface CommentTreeHeaderNode
|
@interface CommentTreeHeaderNode : ASDisplayNode
|
||||||
@property(strong, nonatomic) id commentTreeNode;
|
@property(strong, nonatomic) id commentTreeNode;
|
||||||
- (void)updateContentViewsForData:(id)arg1;
|
- (void)updateContentViewsForData:(id)arg1;
|
||||||
- (void)configureNodes;
|
- (void)configureNodes;
|
||||||
@ -71,10 +75,17 @@
|
|||||||
|
|
||||||
@interface CommentTreeHeaderView
|
@interface CommentTreeHeaderView
|
||||||
@property(strong, nonatomic) id commentTreeNode;
|
@property(strong, nonatomic) id commentTreeNode;
|
||||||
|
|
||||||
- (void)updateContentViewsForData:(id)arg1;
|
- (void)updateContentViewsForData:(id)arg1;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
@interface CommentTreeTextNode
|
||||||
|
- (void)configureTextNode;
|
||||||
|
@end
|
||||||
|
|
||||||
|
@interface CommentTreeContentNode
|
||||||
|
@property(strong, nonatomic) CommentTreeTextNode *textNode;
|
||||||
|
@end
|
||||||
|
|
||||||
/* -- Post Interfaces -- */
|
/* -- Post Interfaces -- */
|
||||||
|
|
||||||
@interface Post
|
@interface Post
|
||||||
|
@ -18,7 +18,12 @@ UIColor * getCurrentTextColor() {
|
|||||||
id isNightMode;
|
id isNightMode;
|
||||||
UIColor *textColor;
|
UIColor *textColor;
|
||||||
|
|
||||||
if (firstVersionPart == 2020) {
|
if (firstVersionPart >= 2021) {
|
||||||
|
|
||||||
|
RUIThemeGuidance *themeGuidance = [%c(RUIThemeGuidance) sharedGuidance];
|
||||||
|
textColor = [[themeGuidance currentTheme] bodyTextColor];
|
||||||
|
|
||||||
|
} else if (firstVersionPart == 2020) {
|
||||||
if (secondVersionPart <= 40) {
|
if (secondVersionPart <= 40) {
|
||||||
|
|
||||||
AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
|
AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
|
||||||
@ -197,41 +202,19 @@ UIColor * getCurrentTextColor() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
CommentTreeHeaderNode *headerNode = [commentTreeNode commentTreeHeaderNode];
|
CommentTreeHeaderNode *headerNode = [commentTreeNode commentTreeHeaderNode];
|
||||||
|
|
||||||
[headerNode updateContentViewsForData:comment];
|
[headerNode updateContentViewsForData:comment];
|
||||||
[headerNode configureNodes];
|
[headerNode configureNodes];
|
||||||
|
|
||||||
|
if (firstVersionPart >= 2021) {
|
||||||
|
CommentTreeTextNode *textNode = [[headerNode supernode] textNode];
|
||||||
|
[textNode configureTextNode];
|
||||||
|
}
|
||||||
|
|
||||||
[bodyMutableAttributedText release];
|
[bodyMutableAttributedText release];
|
||||||
}
|
}
|
||||||
|
|
||||||
%end
|
%end
|
||||||
|
|
||||||
/*
|
|
||||||
%hook Post
|
|
||||||
|
|
||||||
- (id)previewTextWithTheme:(id)arg1 {
|
|
||||||
%log;
|
|
||||||
id orig = %orig;
|
|
||||||
HBLogDebug(@"previewTextWithTheme: orig: %@", orig);
|
|
||||||
return orig;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (id)previewFeedPostTextString {
|
|
||||||
%log;
|
|
||||||
id orig = %orig;
|
|
||||||
HBLogDebug(@"previewFeedPostTextString orig: %@", orig);
|
|
||||||
return orig;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (id)previewPostText:(id)arg1 {
|
|
||||||
%log;
|
|
||||||
id orig = %orig;
|
|
||||||
HBLogDebug(@"previewPostText: orig: %@", orig);
|
|
||||||
return orig;
|
|
||||||
}
|
|
||||||
|
|
||||||
%end
|
|
||||||
*/
|
|
||||||
|
|
||||||
%hook PostDetailViewController
|
%hook PostDetailViewController
|
||||||
%property(strong,nonatomic) id feedPostTextWithThumbnailNode;
|
%property(strong,nonatomic) id feedPostTextWithThumbnailNode;
|
||||||
@ -275,7 +258,6 @@ UIColor * getCurrentTextColor() {
|
|||||||
%orig;
|
%orig;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
- (void)handleDidSelectActionSheetItem:(id)arg1 {
|
- (void)handleDidSelectActionSheetItem:(id)arg1 {
|
||||||
%orig;
|
%orig;
|
||||||
|
|
||||||
@ -317,7 +299,13 @@ UIColor * getCurrentTextColor() {
|
|||||||
Post *feedPost = [titleNode post];
|
Post *feedPost = [titleNode post];
|
||||||
[feedPost setAuthor:author];
|
[feedPost setAuthor:author];
|
||||||
|
|
||||||
if (firstVersionPart == 2020) {
|
if (firstVersionPart >= 2021) {
|
||||||
|
RichTextDisplayNode *selfTextNode = [[[[[self postActionSheetDelegate] controller] feedPostDetailCellNode] contentNode] selfTextNode];
|
||||||
|
[selfTextNode setAttributedText:bodyMutableAttributedText];
|
||||||
|
[selfTextNode configureDisplayNodes];
|
||||||
|
[titleNode configureNodes];
|
||||||
|
|
||||||
|
} else if (firstVersionPart == 2020) {
|
||||||
if (secondVersionPart >= 42) {
|
if (secondVersionPart >= 42) {
|
||||||
RichTextDisplayNode *selfTextNode = [[[[[self postActionSheetDelegate] controller] feedPostDetailCellNode] contentNode] selfTextNode];
|
RichTextDisplayNode *selfTextNode = [[[[[self postActionSheetDelegate] controller] feedPostDetailCellNode] contentNode] selfTextNode];
|
||||||
[selfTextNode setAttributedText:bodyMutableAttributedText];
|
[selfTextNode setAttributedText:bodyMutableAttributedText];
|
||||||
@ -599,7 +587,6 @@ UIColor * getCurrentTextColor() {
|
|||||||
[commentsViewController reloadCommentsWithNewCommentsHighlight:NO autoScroll:NO animated:NO];
|
[commentsViewController reloadCommentsWithNewCommentsHighlight:NO autoScroll:NO animated:NO];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
-(id) initWithFrame:(id)arg1{
|
-(id) initWithFrame:(id)arg1{
|
||||||
id orig = %orig;
|
id orig = %orig;
|
||||||
id commandView = [self commandView];
|
id commandView = [self commandView];
|
||||||
@ -617,7 +604,6 @@ UIColor * getCurrentTextColor() {
|
|||||||
return orig;
|
return orig;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
%end
|
%end
|
||||||
|
|
||||||
|
|
||||||
@ -678,18 +664,6 @@ static void prefsChanged(CFNotificationCenterRef center, void *observer, CFStrin
|
|||||||
|
|
||||||
CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), NULL, (CFNotificationCallback)prefsChanged, CFSTR("com.lint.undelete.prefs.changed"), NULL, CFNotificationSuspensionBehaviorCoalesce);
|
CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), NULL, (CFNotificationCallback)prefsChanged, CFSTR("com.lint.undelete.prefs.changed"), NULL, CFNotificationSuspensionBehaviorCoalesce);
|
||||||
|
|
||||||
/*
|
|
||||||
if (firstVersionPart == 4 || firstVersionPart == 2020) {
|
|
||||||
if (secondVersionPart <= 32 && firstVersionPart != 2020) {
|
|
||||||
%init(Reddit_v4_ios10);
|
|
||||||
} else{
|
|
||||||
%init(Reddit_v4_current);
|
|
||||||
}
|
|
||||||
} else if (firstVersionPart == 3) {
|
|
||||||
%init(Reddit_v3);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (firstVersionPart >= 2020 || (firstVersionPart == 4 && secondVersionPart > 32)) {
|
if (firstVersionPart >= 2020 || (firstVersionPart == 4 && secondVersionPart > 32)) {
|
||||||
%init(Reddit_v4_current);
|
%init(Reddit_v4_current);
|
||||||
} else if (firstVersionPart == 4 && secondVersionPart <= 32) {
|
} else if (firstVersionPart == 4 && secondVersionPart <= 32) {
|
||||||
|
Reference in New Issue
Block a user