forked from lint/TFDidThatSay
Update tweak
This commit is contained in:
14
Tweak.h
14
Tweak.h
@ -97,6 +97,10 @@
|
|||||||
-(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
|
||||||
|
@property(assign,nonatomic) id bodyTextColor;
|
||||||
|
@end
|
||||||
|
|
||||||
@interface NSAttributedStringMarkdownParser
|
@interface NSAttributedStringMarkdownParser
|
||||||
+(id) currentConfig;
|
+(id) currentConfig;
|
||||||
+(id) attributedStringUsingCurrentConfig:(id) arg1;
|
+(id) attributedStringUsingCurrentConfig:(id) arg1;
|
||||||
@ -104,6 +108,16 @@
|
|||||||
-(id) initWithConfig:(id) arg1;
|
-(id) initWithConfig:(id) arg1;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
@interface ThemeManager
|
||||||
|
@property(assign,nonatomic) id dayTheme;
|
||||||
|
@property(assign,nonatomic) id nightTheme;
|
||||||
|
-(id) initWithTraitCollection:(id) arg1 appSettings:(id) arg2;
|
||||||
|
@end
|
||||||
|
|
||||||
|
@interface AppSettings
|
||||||
|
+(id) sharedSettings;
|
||||||
|
@end
|
||||||
|
|
||||||
|
|
||||||
/* -- ActivityIndicator Interfaces -- */
|
/* -- ActivityIndicator Interfaces -- */
|
||||||
|
|
||||||
|
25
Tweak.xm
25
Tweak.xm
@ -128,8 +128,15 @@
|
|||||||
body = @"[an error occured]";
|
body = @"[an error occured]";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
id themeManager = [[%c(ThemeManager) alloc] initWithTraitCollection:nil appSettings:[%c(AppSettings) sharedSettings]];
|
||||||
|
id isNightMode = [[[%c(AccountManager) sharedManager] defaults] objectForKey:@"kUseNightKey"];
|
||||||
|
id textColor;
|
||||||
|
|
||||||
id textColor = [[comment bodyRichTextAttributed] attributesAtIndex:0 longestEffectiveRange:nil inRange:NSMakeRange(0, [[comment bodyRichTextAttributed] length])][@"NSColor"];
|
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]];
|
||||||
|
|
||||||
@ -140,6 +147,10 @@
|
|||||||
}];
|
}];
|
||||||
[bodyMutableAttributedText endEditing];
|
[bodyMutableAttributedText endEditing];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[comment setValue:bodyMutableAttributedText forKey:@"bodyRichTextAttributed"];
|
[comment setValue:bodyMutableAttributedText forKey:@"bodyRichTextAttributed"];
|
||||||
|
|
||||||
[comment setValue:author forKey:@"author"];
|
[comment setValue:author forKey:@"author"];
|
||||||
@ -156,6 +167,7 @@
|
|||||||
[request release];
|
[request release];
|
||||||
[queue release];
|
[queue release];
|
||||||
[bodyMutableAttributedText release];
|
[bodyMutableAttributedText release];
|
||||||
|
[themeManager release];
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -242,10 +254,14 @@
|
|||||||
body = @"[an error occured]";
|
body = @"[an error occured]";
|
||||||
}
|
}
|
||||||
|
|
||||||
id textColor = [[post selfPostRichTextAttributed] attributesAtIndex:0 longestEffectiveRange:nil inRange:NSMakeRange(0, [[post selfPostRichTextAttributed] length])][@"NSColor"];
|
id themeManager = [[%c(ThemeManager) alloc] initWithTraitCollection:nil appSettings:[%c(AppSettings) sharedSettings]];
|
||||||
|
id isNightMode = [[[%c(AccountManager) sharedManager] defaults] objectForKey:@"kUseNightKey"];
|
||||||
|
id textColor;
|
||||||
|
|
||||||
if (textColor == nil){
|
if (isNightMode) {
|
||||||
textColor = [UIColor colorWithRed:0.843137 green:0.854902 blue:0.862745 alpha:1.0];
|
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]];
|
||||||
@ -268,6 +284,7 @@
|
|||||||
[request release];
|
[request release];
|
||||||
[queue release];
|
[queue release];
|
||||||
[bodyMutableAttributedText release];
|
[bodyMutableAttributedText release];
|
||||||
|
[themeManager release];
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user