Просмотр исходного кода

Fix Reddit incorrect text color bug

master
lint 4 лет назад
Родитель
Сommit
bed2ca26a6
2 измененных файлов: 25 добавлений и 4 удалений
  1. +6
    -0
      tweak/Reddit.h
  2. +19
    -4
      tweak/Reddit.xm

+ 6
- 0
tweak/Reddit.h Просмотреть файл

@interface AppSettings @interface AppSettings
+ (id)sharedSettings; + (id)sharedSettings;
- (BOOL)useDarkMode;
- (BOOL)isAutoDarkModeEnabled;
@end @end
@interface AccountManager @interface AccountManager
@interface MarkDownParser @interface MarkDownParser
+ (id)attributedStringFromMarkdownString:(id)arg1; + (id)attributedStringFromMarkdownString:(id)arg1;
@end @end
@interface UITraitCollection ()
+ (id)_currentTraitCollection;
@end

+ 19
- 4
tweak/Reddit.xm Просмотреть файл

id textColor; id textColor;
if (firstVersionPart == 2020) { 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"]; isNightMode = [[[%c(AccountManager) sharedManager] defaults] objectForKey:@"kUseNightKey"];
if (isNightMode) {
textColor = [[themeManager darkTheme] bodyTextColor];
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 { } else {
textColor = [[themeManager lightTheme] bodyTextColor];
if (isNightMode) {
textColor = [[themeManager darkTheme] bodyTextColor];
} else {
textColor = [[themeManager lightTheme] bodyTextColor];
}
} }
[themeManager release]; [themeManager release];
} else { } else {
if (secondVersionPart >= 45) { if (secondVersionPart >= 45) {

Загрузка…
Отмена
Сохранить