1
0
mirror of https://github.com/lint/TFDidThatSay synced 2025-07-04 08:36:45 +00:00

Fix Reddit incorrect text color bug

This commit is contained in:
lint
2020-06-06 23:30:53 -04:00
parent 585093b5ad
commit bed2ca26a6
2 changed files with 25 additions and 4 deletions

View File

@ -169,6 +169,8 @@
@interface AppSettings
+ (id)sharedSettings;
- (BOOL)useDarkMode;
- (BOOL)isAutoDarkModeEnabled;
@end
@interface AccountManager
@ -208,3 +210,7 @@
@interface MarkDownParser
+ (id)attributedStringFromMarkdownString:(id)arg1;
@end
@interface UITraitCollection ()
+ (id)_currentTraitCollection;

View File

@ -102,16 +102,31 @@ int secondVersionPart = 0;
id textColor;
if (firstVersionPart == 2020) {
themeManager = [[%c(ThemeManager) alloc] initWithAppSettings:[%c(AppSettings) sharedSettings]];
AppSettings *appSettings = [%c(AppSettings) sharedSettings];
themeManager = [[%c(ThemeManager) alloc] initWithAppSettings:appSettings];
isNightMode = [[[%c(AccountManager) sharedManager] 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 {
if (secondVersionPart >= 45) {