|
|
|
|
|
|
|
|
|
|
|
|
|
|
%group Reddit_v4_current
|
|
|
%group Reddit_v4_current
|
|
|
|
|
|
|
|
|
|
|
|
UIColor * getCurrentTextColor() {
|
|
|
|
|
|
|
|
|
|
|
|
ThemeManager *themeManager;
|
|
|
|
|
|
id isNightMode;
|
|
|
|
|
|
UIColor *textColor;
|
|
|
|
|
|
|
|
|
|
|
|
if (firstVersionPart == 2020) {
|
|
|
|
|
|
if (secondVersionPart <= 40) {
|
|
|
|
|
|
|
|
|
|
|
|
AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
|
|
|
|
|
|
AppSettings *appSettings = [%c(AppSettings) sharedSettings];
|
|
|
|
|
|
AccountManager *accountManager = secondVersionPart >= 29 ? [appDelegate accountManager] : [%c(AccountManager) sharedManager];
|
|
|
|
|
|
themeManager = [[%c(ThemeManager) alloc] initWithAppSettings:appSettings];
|
|
|
|
|
|
isNightMode = [[accountManager defaults] objectForKey:@"kUseNightKey"];
|
|
|
|
|
|
|
|
|
|
|
|
if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"13.0") && [appSettings isAutoDarkModeEnabled]) {
|
|
|
|
|
|
|
|
|
|
|
|
NSInteger sysInterfaceStyle = [[UITraitCollection _currentTraitCollection] userInterfaceStyle];
|
|
|
|
|
|
|
|
|
|
|
|
if (sysInterfaceStyle == UIUserInterfaceStyleDark){
|
|
|
|
|
|
textColor = [[themeManager darkTheme] bodyTextColor];
|
|
|
|
|
|
} else {
|
|
|
|
|
|
textColor = [[themeManager lightTheme] bodyTextColor];
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
|
|
|
|
if (isNightMode) {
|
|
|
|
|
|
textColor = [[themeManager darkTheme] bodyTextColor];
|
|
|
|
|
|
} else {
|
|
|
|
|
|
textColor = [[themeManager lightTheme] bodyTextColor];
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[themeManager release];
|
|
|
|
|
|
} else {
|
|
|
|
|
|
RUIThemeGuidance *themeGuidance = [%c(RUIThemeGuidance) sharedGuidance];
|
|
|
|
|
|
textColor = [[themeGuidance currentTheme] bodyTextColor];
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
|
|
|
|
if (secondVersionPart >= 45) {
|
|
|
|
|
|
themeManager = [[%c(ThemeManager) alloc] initWithAppSettings:[%c(AppSettings) sharedSettings]];
|
|
|
|
|
|
isNightMode = [[[%c(AccountManager) sharedManager] defaults] objectForKey:@"kUseNightKey"];
|
|
|
|
|
|
|
|
|
|
|
|
if (isNightMode) {
|
|
|
|
|
|
textColor = [[themeManager darkTheme] bodyTextColor];
|
|
|
|
|
|
} else {
|
|
|
|
|
|
textColor = [[themeManager lightTheme] bodyTextColor];
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[themeManager release];
|
|
|
|
|
|
|
|
|
|
|
|
} else if (secondVersionPart >= 37) {
|
|
|
|
|
|
themeManager = [[%c(ThemeManager) alloc] initWithTraitCollection:nil appSettings:[%c(AppSettings) sharedSettings]];
|
|
|
|
|
|
isNightMode = [[[%c(AccountManager) sharedManager] defaults] objectForKey:@"kUseNightKey"];
|
|
|
|
|
|
|
|
|
|
|
|
if (isNightMode) {
|
|
|
|
|
|
textColor = [[themeManager nightTheme] bodyTextColor];
|
|
|
|
|
|
} else {
|
|
|
|
|
|
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];
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return textColor;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
%hook CommentTreeNode
|
|
|
%hook CommentTreeNode
|
|
|
%property(assign,nonatomic)id commentTreeHeaderNode;
|
|
|
%property(assign,nonatomic)id commentTreeHeaderNode;
|
|
|
%property(assign,nonatomic)id commentTreeCommandBarNode;
|
|
|
%property(assign,nonatomic)id commentTreeCommandBarNode;
|
|
|
|
|
|
|
|
|
NSString *author = data[@"author"];
|
|
|
NSString *author = data[@"author"];
|
|
|
NSString *body = data[@"body"];
|
|
|
NSString *body = data[@"body"];
|
|
|
|
|
|
|
|
|
|
|
|
UIColor *textColor = getCurrentTextColor();
|
|
|
NSMutableAttributedString *bodyMutableAttributedText;
|
|
|
NSMutableAttributedString *bodyMutableAttributedText;
|
|
|
|
|
|
|
|
|
id themeManager;
|
|
|
|
|
|
id isNightMode;
|
|
|
|
|
|
id textColor;
|
|
|
|
|
|
|
|
|
|
|
|
if (firstVersionPart == 2020) {
|
|
|
|
|
|
if (secondVersionPart <= 40) {
|
|
|
|
|
|
AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
|
|
|
|
|
|
AppSettings *appSettings = [%c(AppSettings) sharedSettings];
|
|
|
|
|
|
AccountManager *accountManager = secondVersionPart >= 29 ? [appDelegate accountManager] : [%c(AccountManager) sharedManager];
|
|
|
|
|
|
themeManager = [[%c(ThemeManager) alloc] initWithAppSettings:appSettings];
|
|
|
|
|
|
isNightMode = [[accountManager defaults] objectForKey:@"kUseNightKey"];
|
|
|
|
|
|
|
|
|
|
|
|
if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"13.0") && [appSettings isAutoDarkModeEnabled]) {
|
|
|
|
|
|
|
|
|
|
|
|
NSInteger sysInterfaceStyle = [[UITraitCollection _currentTraitCollection] userInterfaceStyle];
|
|
|
|
|
|
|
|
|
|
|
|
if (sysInterfaceStyle == UIUserInterfaceStyleDark){
|
|
|
|
|
|
textColor = [[themeManager darkTheme] bodyTextColor];
|
|
|
|
|
|
} else {
|
|
|
|
|
|
textColor = [[themeManager lightTheme] bodyTextColor];
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
|
|
|
|
if (isNightMode) {
|
|
|
|
|
|
textColor = [[themeManager darkTheme] bodyTextColor];
|
|
|
|
|
|
} else {
|
|
|
|
|
|
textColor = [[themeManager lightTheme] bodyTextColor];
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[themeManager release];
|
|
|
|
|
|
} else {
|
|
|
|
|
|
RUIThemeGuidance *themeGuidance = [%c(RUIThemeGuidance) sharedGuidance];
|
|
|
|
|
|
textColor = [[themeGuidance currentTheme] bodyTextColor];
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
|
|
|
|
if (secondVersionPart >= 45) {
|
|
|
|
|
|
themeManager = [[%c(ThemeManager) alloc] initWithAppSettings:[%c(AppSettings) sharedSettings]];
|
|
|
|
|
|
isNightMode = [[[%c(AccountManager) sharedManager] defaults] objectForKey:@"kUseNightKey"];
|
|
|
|
|
|
|
|
|
|
|
|
if (isNightMode) {
|
|
|
|
|
|
textColor = [[themeManager darkTheme] bodyTextColor];
|
|
|
|
|
|
} else {
|
|
|
|
|
|
textColor = [[themeManager lightTheme] bodyTextColor];
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[themeManager release];
|
|
|
|
|
|
|
|
|
|
|
|
} else if (secondVersionPart >= 37) {
|
|
|
|
|
|
themeManager = [[%c(ThemeManager) alloc] initWithTraitCollection:nil appSettings:[%c(AppSettings) sharedSettings]];
|
|
|
|
|
|
isNightMode = [[[%c(AccountManager) sharedManager] defaults] objectForKey:@"kUseNightKey"];
|
|
|
|
|
|
|
|
|
|
|
|
if (isNightMode) {
|
|
|
|
|
|
textColor = [[themeManager nightTheme] bodyTextColor];
|
|
|
|
|
|
} else {
|
|
|
|
|
|
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];
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bodyMutableAttributedText = [[NSMutableAttributedString alloc] initWithAttributedString:[%c(NSAttributedStringMarkdownParser) attributedStringUsingCurrentConfig:body]];
|
|
|
bodyMutableAttributedText = [[NSMutableAttributedString alloc] initWithAttributedString:[%c(NSAttributedStringMarkdownParser) attributedStringUsingCurrentConfig:body]];
|
|
|
|
|
|
|
|
|
[bodyMutableAttributedText beginEditing];
|
|
|
[bodyMutableAttributedText beginEditing];
|
|
|
|
|
|
|
|
|
NSString *author = data[@"author"];
|
|
|
NSString *author = data[@"author"];
|
|
|
NSString *body = data[@"body"];
|
|
|
NSString *body = data[@"body"];
|
|
|
|
|
|
|
|
|
id themeManager;
|
|
|
|
|
|
id isNightMode;
|
|
|
|
|
|
id textColor;
|
|
|
|
|
|
|
|
|
|
|
|
if (firstVersionPart == 2020) {
|
|
|
|
|
|
|
|
|
|
|
|
if (secondVersionPart <= 40) {
|
|
|
|
|
|
|
|
|
|
|
|
AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
|
|
|
|
|
|
AccountManager *accountManager = secondVersionPart >= 29 ? [appDelegate accountManager] : [%c(AccountManager) sharedManager];
|
|
|
|
|
|
themeManager = [[%c(ThemeManager) alloc] initWithAppSettings:[%c(AppSettings) sharedSettings]];
|
|
|
|
|
|
isNightMode = [[accountManager defaults] objectForKey:@"kUseNightKey"];
|
|
|
|
|
|
|
|
|
|
|
|
if (isNightMode) {
|
|
|
|
|
|
textColor = [[themeManager darkTheme] bodyTextColor];
|
|
|
|
|
|
} else {
|
|
|
|
|
|
textColor = [[themeManager lightTheme] bodyTextColor];
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[themeManager release];
|
|
|
|
|
|
} else {
|
|
|
|
|
|
RUIThemeGuidance *themeGuidance = [%c(RUIThemeGuidance) sharedGuidance];
|
|
|
|
|
|
textColor = [[themeGuidance currentTheme] bodyTextColor];
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
|
|
|
|
if (secondVersionPart >= 45) {
|
|
|
|
|
|
themeManager = [[%c(ThemeManager) alloc] initWithAppSettings:[%c(AppSettings) sharedSettings]];
|
|
|
|
|
|
isNightMode = [[[%c(AccountManager) sharedManager] defaults] objectForKey:@"kUseNightKey"];
|
|
|
|
|
|
|
|
|
|
|
|
if (isNightMode) {
|
|
|
|
|
|
textColor = [[themeManager darkTheme] bodyTextColor];
|
|
|
|
|
|
} else {
|
|
|
|
|
|
textColor = [[themeManager lightTheme] bodyTextColor];
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[themeManager release];
|
|
|
|
|
|
|
|
|
|
|
|
} else if (secondVersionPart >= 37) {
|
|
|
|
|
|
themeManager = [[%c(ThemeManager) alloc] initWithTraitCollection:nil appSettings:[%c(AppSettings) sharedSettings]];
|
|
|
|
|
|
isNightMode = [[[%c(AccountManager) sharedManager] defaults] objectForKey:@"kUseNightKey"];
|
|
|
|
|
|
|
|
|
|
|
|
if (isNightMode) {
|
|
|
|
|
|
textColor = [[themeManager nightTheme] bodyTextColor];
|
|
|
|
|
|
} else {
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
|
|
|
|
if ((firstVersionPart == 2020 && secondVersionPart <= 41) || firstVersionPart != 2020) {
|
|
|
|
|
|
bodyMutableAttributedText = [[post previewFeedPostTextString] initWithAttributedString:[%c(NSAttributedStringMarkdownParser) attributedStringUsingCurrentConfig:body]];
|
|
|
|
|
|
} else {
|
|
|
|
|
|
bodyMutableAttributedText = [[NSMutableAttributedString alloc] initWithAttributedString:[%c(NSAttributedStringMarkdownParser) attributedStringUsingCurrentConfig:body]];
|
|
|
|
|
|
}
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UIColor *textColor = getCurrentTextColor();
|
|
|
NSMutableAttributedString *bodyMutableAttributedText = [[NSMutableAttributedString alloc] initWithAttributedString:[%c(NSAttributedStringMarkdownParser) attributedStringUsingCurrentConfig:body]];
|
|
|
NSMutableAttributedString *bodyMutableAttributedText = [[NSMutableAttributedString alloc] initWithAttributedString:[%c(NSAttributedStringMarkdownParser) attributedStringUsingCurrentConfig:body]];
|
|
|
|
|
|
|
|
|
[bodyMutableAttributedText beginEditing];
|
|
|
[bodyMutableAttributedText beginEditing];
|