From 685b9adde0dc2dd1594367de3a570bddc0ddd842 Mon Sep 17 00:00:00 2001 From: Adam Demasi Date: Sun, 7 Apr 2019 15:32:31 +0930 Subject: [PATCH] [prefs] support nav bar tint on iOS 6 --- prefs/PSListController+HBTintAdditions.x | 2 +- prefs/Tint.x | 20 ++++++++++++++------ 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/prefs/PSListController+HBTintAdditions.x b/prefs/PSListController+HBTintAdditions.x index 2ca8f0e..bb770fa 100644 --- a/prefs/PSListController+HBTintAdditions.x +++ b/prefs/PSListController+HBTintAdditions.x @@ -93,7 +93,7 @@ BOOL translucentNavigationBar = NO; } // if we have a translucent navigation bar, apply it - translucentNavigationBar = self.hb_appearanceSettings ? self.hb_appearanceSettings.translucent : IS_IOS_OR_NEWER(iOS_7_0); + translucentNavigationBar = self.hb_appearanceSettings ? self.hb_appearanceSettings.translucentNavigationBar : IS_IOS_OR_NEWER(iOS_7_0); self._hb_realNavigationController.navigationBar.translucent = translucentNavigationBar; if ([self respondsToSelector:@selector(setEdgesForExtendedLayout:)]) { diff --git a/prefs/Tint.x b/prefs/Tint.x index dbd1fab..eed6060 100644 --- a/prefs/Tint.x +++ b/prefs/Tint.x @@ -97,18 +97,21 @@ BOOL animateBarTintColor = NO; // if we have a custom tint color, or we no longer have a custom tint color, but one is currently // set, and it should be animated, ask for it to be - if ((backgroundColor || self.barTintColor) && animated) { - animateBarTintColor = YES; - } + if (IS_IOS_OR_NEWER(iOS_7_0)) { + if ((backgroundColor || self.barTintColor) && animated) { + animateBarTintColor = YES; + } - // set the bar tint color - self.barTintColor = backgroundColor; + // set the bar tint color + self.barTintColor = backgroundColor; + } } %end #pragma mark - Animation hack +%group BackdropHax %hook _UIBackdropView - (void)applySettings:(id)settings { @@ -124,13 +127,14 @@ BOOL animateBarTintColor = NO; } } +%end %end #pragma mark - Constructor %ctor { // this entire thing isn't particularly useful if the OS doesn’t support it - if (!IS_IOS_OR_NEWER(iOS_7_0)) { + if (!IS_IOS_OR_NEWER(iOS_6_0)) { return; } @@ -143,4 +147,8 @@ BOOL animateBarTintColor = NO; } else { %init(JonyIve); } + + if (IS_IOS_OR_NEWER(iOS_7_0)) { + %init(BackdropHax); + } }