From aa21f3c313c498ed15a93b3522415d4a9bf95045 Mon Sep 17 00:00:00 2001 From: Adam Demasi Date: Sun, 18 Jun 2017 12:49:16 +0930 Subject: [PATCH] [prefs] add workaround for notifications vc tint color derping out --- prefs/HBCZRootListController.x | 37 +++++++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 10 deletions(-) diff --git a/prefs/HBCZRootListController.x b/prefs/HBCZRootListController.x index 27f8c71..0d409e3 100644 --- a/prefs/HBCZRootListController.x +++ b/prefs/HBCZRootListController.x @@ -65,11 +65,38 @@ [overscrollView addSubview:hiLabel]; } +#pragma mark - PSListController + - (void)reloadSpecifiers { [super reloadSpecifiers]; [self _setUpSpecifiers]; } +- (void)setPreferenceValue:(id)value specifier:(PSSpecifier *)specifier { + [super setPreferenceValue:value specifier:specifier]; + + // if the typestatus plus specifier has been toggled, update the enabled/disabled state of the + // notification specifiers + if ([specifier.identifier isEqualToString:@"TypeStatusPlus"]) { + [self _setUpSpecifiers]; + } +} + +- (void)showController:(PSViewController *)controller animate:(BOOL)animated { + // remove the tint from the notifications vc, because it derps out the alert style section + if ([controller isKindOfClass:%c(BulletinBoardAppDetailController)]) { + HBAppearanceSettings *appearanceSettings = [self.hb_appearanceSettings copy]; + appearanceSettings.tintColor = nil; + ((PSListController *)controller).hb_appearanceSettings = appearanceSettings; + + [UISwitch appearanceWhenContainedInInstancesOfClasses:@[ controller.class ]].onTintColor = self.hb_appearanceSettings.tintColor; + } + + [super showController:controller animate:animated]; +} + +#pragma mark - Setup + - (void)_setUpSpecifiers { // grab the typestatus plus bundle // NSBundle *plusBundle = [NSBundle bundleWithPath:@"/Library/PreferenceBundles/TypeStatusPlus.bundle"]; @@ -122,14 +149,4 @@ } } -- (void)setPreferenceValue:(id)value specifier:(PSSpecifier *)specifier { - [super setPreferenceValue:value specifier:specifier]; - - // if the typestatus plus specifier has been toggled, update the enabled/disabled state of the - // notification specifiers - if ([specifier.identifier isEqualToString:@"TypeStatusPlus"]) { - [self _setUpSpecifiers]; - } -} - @end