瀏覽代碼

Add Reddit v2021 support

master
lint 3 年之前
父節點
當前提交
c78f263125
共有 2 個文件被更改,包括 33 次插入48 次删除
  1. +15
    -4
      tweak/Reddit.h
  2. +18
    -44
      tweak/Reddit.xm

+ 15
- 4
tweak/Reddit.h 查看文件

@@ -1,7 +1,7 @@
#import <UIKit/UIKit.h>
/* ---- Reddit v3 & v4 ---- */
/* ---- Reddit v3 & v4 & v2020 & v2021 ---- */
/* -- Comment Interfaces -- */
@@ -38,9 +38,13 @@
@end
/* ---- Reddit v4 ---- */
/* ---- Reddit v4+ ---- */
@interface ASDisplayNode
- (id)supernode;
@end
/* -- Comment Interfaces -- */
@interface CommentTreeNode
@@ -55,7 +59,7 @@
@property(strong, nonatomic) id commentNode;
@end
@interface CommentTreeHeaderNode
@interface CommentTreeHeaderNode : ASDisplayNode
@property(strong, nonatomic) id commentTreeNode;
- (void)updateContentViewsForData:(id)arg1;
- (void)configureNodes;
@@ -71,10 +75,17 @@
@interface CommentTreeHeaderView
@property(strong, nonatomic) id commentTreeNode;
- (void)updateContentViewsForData:(id)arg1;
@end
@interface CommentTreeTextNode
- (void)configureTextNode;
@end
@interface CommentTreeContentNode
@property(strong, nonatomic) CommentTreeTextNode *textNode;
@end
/* -- Post Interfaces -- */
@interface Post

+ 18
- 44
tweak/Reddit.xm 查看文件

@@ -18,7 +18,12 @@ UIColor * getCurrentTextColor() {
id isNightMode;
UIColor *textColor;
if (firstVersionPart == 2020) {
if (firstVersionPart >= 2021) {
RUIThemeGuidance *themeGuidance = [%c(RUIThemeGuidance) sharedGuidance];
textColor = [[themeGuidance currentTheme] bodyTextColor];
} else if (firstVersionPart == 2020) {
if (secondVersionPart <= 40) {
AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
@@ -197,41 +202,19 @@ UIColor * getCurrentTextColor() {
}
CommentTreeHeaderNode *headerNode = [commentTreeNode commentTreeHeaderNode];
[headerNode updateContentViewsForData:comment];
[headerNode configureNodes];
if (firstVersionPart >= 2021) {
CommentTreeTextNode *textNode = [[headerNode supernode] textNode];
[textNode configureTextNode];
}
[bodyMutableAttributedText release];
}
%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
%property(strong,nonatomic) id feedPostTextWithThumbnailNode;
@@ -275,7 +258,6 @@ UIColor * getCurrentTextColor() {
%orig;
}
- (void)handleDidSelectActionSheetItem:(id)arg1 {
%orig;
@@ -317,7 +299,13 @@ UIColor * getCurrentTextColor() {
Post *feedPost = [titleNode post];
[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) {
RichTextDisplayNode *selfTextNode = [[[[[self postActionSheetDelegate] controller] feedPostDetailCellNode] contentNode] selfTextNode];
[selfTextNode setAttributedText:bodyMutableAttributedText];
@@ -599,7 +587,6 @@ UIColor * getCurrentTextColor() {
[commentsViewController reloadCommentsWithNewCommentsHighlight:NO autoScroll:NO animated:NO];
}
-(id) initWithFrame:(id)arg1{
id orig = %orig;
id commandView = [self commandView];
@@ -617,7 +604,6 @@ UIColor * getCurrentTextColor() {
return orig;
}
%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);
/*
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)) {
%init(Reddit_v4_current);
} else if (firstVersionPart == 4 && secondVersionPart <= 32) {

Loading…
取消
儲存