forked from yaypixxo/Kage
		
	hide labels on carplay and fix iOS 12 support for show time in ls status bar and hide cc grabber
This commit is contained in:
		
							
								
								
									
										124
									
								
								Tweak.x
									
									
									
									
									
								
							
							
						
						
									
										124
									
								
								Tweak.x
									
									
									
									
									
								
							| @ -24,6 +24,7 @@ static BOOL gridSwitcher; | |||||||
| static BOOL hideLSBatt; | static BOOL hideLSBatt; | ||||||
| static BOOL statusBarShowTimeLS; | static BOOL statusBarShowTimeLS; | ||||||
| static BOOL hideLabels; | static BOOL hideLabels; | ||||||
|  | static BOOL hideCarPlayLabels; | ||||||
| static BOOL hideFolderBadges; | static BOOL hideFolderBadges; | ||||||
| //static BOOL hideStatusBarLS; | //static BOOL hideStatusBarLS; | ||||||
| static BOOL hideCCGrabber; | static BOOL hideCCGrabber; | ||||||
| @ -35,6 +36,7 @@ static void notificationCallback(CFNotificationCenterRef center, void *observer, | |||||||
|     NSNumber *eHideLSBatt = (NSNumber *)[[NSUserDefaults standardUserDefaults] objectForKey:@"hideLSBatt" inDomain:nsDomainString]; |     NSNumber *eHideLSBatt = (NSNumber *)[[NSUserDefaults standardUserDefaults] objectForKey:@"hideLSBatt" inDomain:nsDomainString]; | ||||||
|     NSNumber *eStatusBarShowTimeLS = (NSNumber *)[[NSUserDefaults standardUserDefaults] objectForKey:@"statusBarShowTimeLS" inDomain:nsDomainString]; |     NSNumber *eStatusBarShowTimeLS = (NSNumber *)[[NSUserDefaults standardUserDefaults] objectForKey:@"statusBarShowTimeLS" inDomain:nsDomainString]; | ||||||
|     NSNumber *eHideLabels = (NSNumber *)[[NSUserDefaults standardUserDefaults] objectForKey:@"hideLabels" inDomain:nsDomainString]; |     NSNumber *eHideLabels = (NSNumber *)[[NSUserDefaults standardUserDefaults] objectForKey:@"hideLabels" inDomain:nsDomainString]; | ||||||
|  |     NSNumber *eHideCarPlayLabels = (NSNumber *)[[NSUserDefaults standardUserDefaults] objectForKey:@"hideCarPlayLabels" inDomain:nsDomainString]; | ||||||
|     NSNumber *eHideFolderBadges = (NSNumber *)[[NSUserDefaults standardUserDefaults] objectForKey:@"hideFolderBadges" inDomain:nsDomainString]; |     NSNumber *eHideFolderBadges = (NSNumber *)[[NSUserDefaults standardUserDefaults] objectForKey:@"hideFolderBadges" inDomain:nsDomainString]; | ||||||
|     //NSNumber *eHideStatusBarLS = (NSNumber *)[[NSUserDefaults standardUserDefaults] objectForKey:@"hideStatusBarLS" inDomain:nsDomainString]; |     //NSNumber *eHideStatusBarLS = (NSNumber *)[[NSUserDefaults standardUserDefaults] objectForKey:@"hideStatusBarLS" inDomain:nsDomainString]; | ||||||
|     NSNumber *eHideCCGrabber = (NSNumber *)[[NSUserDefaults standardUserDefaults] objectForKey:@"hideCCGrabber" inDomain:nsDomainString]; |     NSNumber *eHideCCGrabber = (NSNumber *)[[NSUserDefaults standardUserDefaults] objectForKey:@"hideCCGrabber" inDomain:nsDomainString]; | ||||||
| @ -45,6 +47,7 @@ static void notificationCallback(CFNotificationCenterRef center, void *observer, | |||||||
|     hideLSBatt = (eHideLSBatt) ? [eHideLSBatt boolValue]:NO; |     hideLSBatt = (eHideLSBatt) ? [eHideLSBatt boolValue]:NO; | ||||||
|     statusBarShowTimeLS = (eStatusBarShowTimeLS) ? [eStatusBarShowTimeLS boolValue]:NO; |     statusBarShowTimeLS = (eStatusBarShowTimeLS) ? [eStatusBarShowTimeLS boolValue]:NO; | ||||||
|     hideLabels = (eHideLabels) ? [eHideLabels boolValue]:NO; |     hideLabels = (eHideLabels) ? [eHideLabels boolValue]:NO; | ||||||
|  |     hideCarPlayLabels = (eHideCarPlayLabels) ? [eHideCarPlayLabels boolValue]:NO; | ||||||
|     hideFolderBadges = (eHideFolderBadges) ? [eHideFolderBadges boolValue]:NO; |     hideFolderBadges = (eHideFolderBadges) ? [eHideFolderBadges boolValue]:NO; | ||||||
|     //hideStatusBarLS = (eHideStatusBarLS) ? [eHideStatusBarLS boolValue]:NO; |     //hideStatusBarLS = (eHideStatusBarLS) ? [eHideStatusBarLS boolValue]:NO; | ||||||
|     hideCCGrabber = (eHideCCGrabber) ? [eHideCCGrabber boolValue]:NO; |     hideCCGrabber = (eHideCCGrabber) ? [eHideCCGrabber boolValue]:NO; | ||||||
| @ -68,6 +71,12 @@ static void notificationCallback(CFNotificationCenterRef center, void *observer, | |||||||
| @property (nonatomic,retain) UIView * controlCenterGrabberView; | @property (nonatomic,retain) UIView * controlCenterGrabberView; | ||||||
| @end | @end | ||||||
|  |  | ||||||
|  | #ifndef kCFCoreFoundationVersionNumber_iOS_13_0 | ||||||
|  | #define kCFCoreFoundationVersionNumber_iOS_13_0 1665.15 | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | #define kSLSystemVersioniOS13 kCFCoreFoundationVersionNumber >= kCFCoreFoundationVersionNumber_iOS_13_0 | ||||||
|  |  | ||||||
| // HIDE CC GRABBER START // | // HIDE CC GRABBER START // | ||||||
| %hook CSTeachableMomentsContainerView | %hook CSTeachableMomentsContainerView | ||||||
| - (void)layoutSubviews { | - (void)layoutSubviews { | ||||||
| @ -95,7 +104,7 @@ static void notificationCallback(CFNotificationCenterRef center, void *observer, | |||||||
| %end | %end | ||||||
| // QUICK ACTIONS BG END // | // QUICK ACTIONS BG END // | ||||||
|  |  | ||||||
| // HIDE BADGE TEXT START // | // HIDE FOLDER BADGE TEXT START // | ||||||
| %hook SBIcon | %hook SBIcon | ||||||
| -(id)badgeNumberOrString { | -(id)badgeNumberOrString { | ||||||
|     if (enabled && hideFolderBadges) { |     if (enabled && hideFolderBadges) { | ||||||
| @ -106,7 +115,7 @@ static void notificationCallback(CFNotificationCenterRef center, void *observer, | |||||||
|     } |     } | ||||||
| } | } | ||||||
| %end | %end | ||||||
| // HIDE BADGE TEXT END // | // HIDE FOLDER BADGE TEXT END // | ||||||
|  |  | ||||||
| // HIDE LABELS START // | // HIDE LABELS START // | ||||||
| %hook SBIconView | %hook SBIconView | ||||||
| @ -119,6 +128,96 @@ static void notificationCallback(CFNotificationCenterRef center, void *observer, | |||||||
| %end | %end | ||||||
| // HIDE LABELS END // | // HIDE LABELS END // | ||||||
|  |  | ||||||
|  | // stuff that only works on iOS 13 | ||||||
|  | %group ios13 | ||||||
|  |  | ||||||
|  | // SHOW TIME IN LS STATUSBAR START // | ||||||
|  | %hook CSCoverSheetViewController | ||||||
|  | - (bool)shouldShowLockStatusBarTime { | ||||||
|  |     if (enabled && statusBarShowTimeLS) { | ||||||
|  |         return YES; | ||||||
|  |     } | ||||||
|  |     else { | ||||||
|  |         return %orig; | ||||||
|  |     } | ||||||
|  | } | ||||||
|  | %end | ||||||
|  | // SHOW TIME IN LS STATUSBAR END // | ||||||
|  |  | ||||||
|  | // HIDE CC GRABBER START // | ||||||
|  | %hook CSTeachableMomentsContainerView | ||||||
|  | - (void)layoutSubviews { | ||||||
|  |     if (enabled && hideCCGrabber) { | ||||||
|  |         [self.controlCenterGrabberView setHidden:YES]; | ||||||
|  |     } | ||||||
|  |     else { | ||||||
|  |         [self.controlCenterGrabberView setHidden:NO]; | ||||||
|  |     } | ||||||
|  |     return %orig; | ||||||
|  | } | ||||||
|  | %end | ||||||
|  | // HIDE CC GRABBER END // | ||||||
|  |  | ||||||
|  | // HIDE CARPLAY LABELS START // | ||||||
|  | %hook CARIconView | ||||||
|  | +(CGSize)maxLabelSizeForIconImageSize:(CGSize)imageSize { | ||||||
|  |     if (enabled && hideCarPlayLabels) { | ||||||
|  |         return CGSizeZero; | ||||||
|  |     } | ||||||
|  |     else { | ||||||
|  |         return %orig; | ||||||
|  |     } | ||||||
|  | } | ||||||
|  | %end | ||||||
|  | // HIDE CARPLAY LABELS END // | ||||||
|  |  | ||||||
|  | %end // end ios13 group | ||||||
|  |  | ||||||
|  | // stuff that only works on iOS 12 | ||||||
|  | %group ios12 | ||||||
|  |  | ||||||
|  | // SHOW TIME IN LS STATUSBAR START // | ||||||
|  | %hook SBLockScreenViewControllerBase | ||||||
|  | - (bool)shouldShowLockStatusBarTime { | ||||||
|  |     if (enabled && statusBarShowTimeLS) { | ||||||
|  |         return YES; | ||||||
|  |     } | ||||||
|  |     else { | ||||||
|  |         return %orig; | ||||||
|  |     } | ||||||
|  | } | ||||||
|  | %end | ||||||
|  | // SHOW TIME IN LS STATUSBAR END // | ||||||
|  |  | ||||||
|  | // HIDE CC GRABBER START // | ||||||
|  | %hook SBDashBoardTeachableMomentsContainerView | ||||||
|  | - (void)layoutSubviews { | ||||||
|  |     if (enabled && hideCCGrabber) { | ||||||
|  |         [self.controlCenterGrabberView setHidden:YES]; | ||||||
|  |     } | ||||||
|  |     else { | ||||||
|  |         [self.controlCenterGrabberView setHidden:NO]; | ||||||
|  |     } | ||||||
|  |     return %orig; | ||||||
|  | } | ||||||
|  | %end | ||||||
|  | // HIDE CC GRABBER END // | ||||||
|  |  | ||||||
|  | // HIDE CARPLAY LABELS START // | ||||||
|  | %hook SBStarkIconView | ||||||
|  | +(CGSize)maxLabelSize { | ||||||
|  |     if (enabled && hideCarPlayLabels) { | ||||||
|  |         return CGSizeZero; | ||||||
|  |     } | ||||||
|  |     else { | ||||||
|  |         return %orig; | ||||||
|  |     } | ||||||
|  | } | ||||||
|  | %end | ||||||
|  | // HIDE CARPLAY LABELS END // | ||||||
|  |  | ||||||
|  | %end // end ios12 group | ||||||
|  |  | ||||||
| // GRID SWITCHER START // | // GRID SWITCHER START // | ||||||
| %hook SBAppSwitcherSettings | %hook SBAppSwitcherSettings | ||||||
| - (void)setGridSwitcherPageScale:(double)arg1 { | - (void)setGridSwitcherPageScale:(double)arg1 { | ||||||
| @ -176,21 +275,16 @@ static void notificationCallback(CFNotificationCenterRef center, void *observer, | |||||||
| %end | %end | ||||||
| // NO LS BATTERY END // | // NO LS BATTERY END // | ||||||
|  |  | ||||||
| // SHOW TIME IN LS STATUSBAR START // |  | ||||||
| %hook CSCoverSheetViewController |  | ||||||
| - (bool)shouldShowLockStatusBarTime { |  | ||||||
|     if (enabled && statusBarShowTimeLS) { |  | ||||||
|         return 1; |  | ||||||
|     } |  | ||||||
|     else { |  | ||||||
|         return %orig; |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| %end |  | ||||||
| // SHOW TIME IN LS STATUSBAR END // |  | ||||||
|  |  | ||||||
| // LISTENERS | // LISTENERS | ||||||
| %ctor { | %ctor { | ||||||
|  |     // check iOS version | ||||||
|  |     if (kSLSystemVersioniOS13) { | ||||||
|  |         %init(ios13); | ||||||
|  |     } | ||||||
|  |     else { | ||||||
|  |         %init(ios12); | ||||||
|  |     } | ||||||
|  |  | ||||||
|     // prefs changed listener |     // prefs changed listener | ||||||
|     notificationCallback(NULL, NULL, NULL, NULL, NULL); |     notificationCallback(NULL, NULL, NULL, NULL, NULL); | ||||||
|     CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), NULL, notificationCallback, (CFStringRef)nsNotificationString, NULL, CFNotificationSuspensionBehaviorCoalesce); |     CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), NULL, notificationCallback, (CFStringRef)nsNotificationString, NULL, CFNotificationSuspensionBehaviorCoalesce); | ||||||
|  | |||||||
| @ -94,6 +94,20 @@ | |||||||
| 			<key>PostNotification</key> | 			<key>PostNotification</key> | ||||||
| 			<string>com.yaypixxo.kage/preferences.changed</string> | 			<string>com.yaypixxo.kage/preferences.changed</string> | ||||||
| 		</dict> | 		</dict> | ||||||
|  | 		<dict> | ||||||
|  | 			<key>cell</key> | ||||||
|  | 			<string>PSSwitchCell</string> | ||||||
|  | 			<key>default</key> | ||||||
|  | 			<false/> | ||||||
|  | 			<key>defaults</key> | ||||||
|  | 			<string>com.yaypixxo.kage</string> | ||||||
|  | 			<key>key</key> | ||||||
|  | 			<string>hideCarPlayLabels</string> | ||||||
|  | 			<key>label</key> | ||||||
|  | 			<string>Hide Icon Labels (CarPlay)</string> | ||||||
|  | 			<key>PostNotification</key> | ||||||
|  | 			<string>com.yaypixxo.kage/preferences.changed</string> | ||||||
|  | 		</dict> | ||||||
| 		<dict> | 		<dict> | ||||||
| 			<key>cell</key> | 			<key>cell</key> | ||||||
| 			<string>PSSwitchCell</string> | 			<string>PSSwitchCell</string> | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user