Browse Source

Add Reddit 2020.29.0 support

master
lint 3 years ago
parent
commit
7e1db92b2f
2 changed files with 10 additions and 3 deletions
  1. +4
    -1
      tweak/Reddit.h
  2. +6
    -2
      tweak/Reddit.xm

+ 4
- 1
tweak/Reddit.h View File

@interface AccountManager @interface AccountManager
@property(assign, nonatomic) id defaults; @property(assign, nonatomic) id defaults;
+ (id)sharedManager; + (id)sharedManager;
@end
@end
@interface AppDelegate : UIResponder
@property(strong, nonatomic) AccountManager *accountManager;
@end
/* ---- Reddit v3 ---- */ /* ---- Reddit v3 ---- */

+ 6
- 2
tweak/Reddit.xm View File

id textColor; id textColor;
if (firstVersionPart == 2020) { if (firstVersionPart == 2020) {
AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
AppSettings *appSettings = [%c(AppSettings) sharedSettings]; AppSettings *appSettings = [%c(AppSettings) sharedSettings];
AccountManager *accountManager = secondVersionPart >= 29 ? [appDelegate accountManager] : [%c(AccountManager) sharedManager];
themeManager = [[%c(ThemeManager) alloc] initWithAppSettings:appSettings]; themeManager = [[%c(ThemeManager) alloc] initWithAppSettings:appSettings];
isNightMode = [[[%c(AccountManager) sharedManager] defaults] objectForKey:@"kUseNightKey"];
isNightMode = [[accountManager defaults] objectForKey:@"kUseNightKey"];
if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"13.0") && [appSettings isAutoDarkModeEnabled]) { if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"13.0") && [appSettings isAutoDarkModeEnabled]) {
id textColor; id textColor;
if (firstVersionPart == 2020) { if (firstVersionPart == 2020) {
AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
AccountManager *accountManager = secondVersionPart >= 29 ? [appDelegate accountManager] : [%c(AccountManager) sharedManager];
themeManager = [[%c(ThemeManager) alloc] initWithAppSettings:[%c(AppSettings) sharedSettings]]; themeManager = [[%c(ThemeManager) alloc] initWithAppSettings:[%c(AppSettings) sharedSettings]];
isNightMode = [[[%c(AccountManager) sharedManager] defaults] objectForKey:@"kUseNightKey"];
isNightMode = [[accountManager defaults] objectForKey:@"kUseNightKey"];
if (isNightMode) { if (isNightMode) {
textColor = [[themeManager darkTheme] bodyTextColor]; textColor = [[themeManager darkTheme] bodyTextColor];

Loading…
Cancel
Save