From 33801c5f0f497b7680ad88eccba106b5a9d9c156 Mon Sep 17 00:00:00 2001 From: yaypixxo Date: Fri, 3 Jan 2020 16:05:52 +0100 Subject: [PATCH] hide folder badges (probably not the best way to do it) --- Tweak.x | 22 +++++++++++++++++++++- kageprefs/Resources/Root.plist | 18 ++++++++++++++++-- 2 files changed, 37 insertions(+), 3 deletions(-) diff --git a/Tweak.x b/Tweak.x index f2e4834..4108ae6 100644 --- a/Tweak.x +++ b/Tweak.x @@ -24,6 +24,7 @@ static BOOL gridSwitcher; static BOOL hideLSBatt; static BOOL statusBarShowTimeLS; static BOOL hideLabels; +static BOOL hideFolderBadges; static void notificationCallback(CFNotificationCenterRef center, void *observer, CFStringRef name, const void *object, CFDictionaryRef userInfo) { NSNumber *eEnabled = (NSNumber *)[[NSUserDefaults standardUserDefaults] objectForKey:@"enabled" inDomain:nsDomainString]; @@ -32,6 +33,7 @@ static void notificationCallback(CFNotificationCenterRef center, void *observer, NSNumber *eHideLSBatt = (NSNumber *)[[NSUserDefaults standardUserDefaults] objectForKey:@"hideLSBatt" inDomain:nsDomainString]; NSNumber *eStatusBarShowTimeLS = (NSNumber *)[[NSUserDefaults standardUserDefaults] objectForKey:@"statusBarShowTimeLS" inDomain:nsDomainString]; NSNumber *eHideLabels = (NSNumber *)[[NSUserDefaults standardUserDefaults] objectForKey:@"hideLabels" inDomain:nsDomainString]; + NSNumber *eHideFolderBadges = (NSNumber *)[[NSUserDefaults standardUserDefaults] objectForKey:@"hideFolderBadges" inDomain:nsDomainString]; enabled = (eEnabled) ? [eEnabled boolValue]:NO; hideQuickActionsBG = (eHideQuickActionsBG) ? [eHideQuickActionsBG boolValue]:NO; @@ -39,15 +41,20 @@ static void notificationCallback(CFNotificationCenterRef center, void *observer, hideLSBatt = (eHideLSBatt) ? [eHideLSBatt boolValue]:NO; statusBarShowTimeLS = (eStatusBarShowTimeLS) ? [eStatusBarShowTimeLS boolValue]:NO; hideLabels = (eHideLabels) ? [eHideLabels boolValue]:NO; + hideFolderBadges = (eHideFolderBadges) ? [eHideFolderBadges boolValue]:NO; } -// hooks and stuff +// headers and hooks #import @interface SBIconView : UIView -(void)setLabelHidden:(BOOL)hidden; @end +@interface SBIcon : NSObject +-(id)badgeNumberOrString; +@end + // QUICK ACTIONS BG START // %hook UICoverSheetButton -(id)_backgroundEffectsWithBrightness:(double)arg1 { @@ -61,6 +68,19 @@ static void notificationCallback(CFNotificationCenterRef center, void *observer, %end // QUICK ACTIONS BG END // +// HIDE BADGE TEXT START // +%hook SBIcon +-(id)badgeNumberOrString { + if (enabled && hideFolderBadges) { + return @""; + } + else { + return %orig; + } +} +%end +// HIDE BADGE TEXT END // + // HIDE LABELS START // %hook SBIconView -(void)setLabelHidden:(BOOL)hidden { diff --git a/kageprefs/Resources/Root.plist b/kageprefs/Resources/Root.plist index 0d8ac11..a265812 100644 --- a/kageprefs/Resources/Root.plist +++ b/kageprefs/Resources/Root.plist @@ -22,7 +22,7 @@ cell PSGroupCell footerText - + * requires respring cell @@ -94,11 +94,25 @@ PostNotification com.yaypixxo.kage/preferences.changed + + cell + PSSwitchCell + default + + defaults + com.yaypixxo.kage + key + hideFolderBadges + label + Hide Folder Badges + PostNotification + com.yaypixxo.kage/preferences.changed + cell PSGroupCell footerText - * requires respring + Kage - By YaYPIXXO cell