Skip to content

Commit

Permalink
[prefs] support nav bar tint on iOS 6
Browse files Browse the repository at this point in the history
  • Loading branch information
kirb committed Apr 7, 2019
1 parent 3e5de17 commit 685b9ad
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
2 changes: 1 addition & 1 deletion prefs/PSListController+HBTintAdditions.x
Expand Up @@ -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:)]) {
Expand Down
20 changes: 14 additions & 6 deletions prefs/Tint.x
Expand Up @@ -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 {
Expand All @@ -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;
}

Expand All @@ -143,4 +147,8 @@ BOOL animateBarTintColor = NO;
} else {
%init(JonyIve);
}

if (IS_IOS_OR_NEWER(iOS_7_0)) {
%init(BackdropHax);
}
}

0 comments on commit 685b9ad

Please sign in to comment.