Browse Source

hide labels on carplay and fix iOS 12 support for show time in ls status bar and hide cc grabber

tags/v1.1.0
Viggo Lekdorf 4 years ago
parent
commit
2463b57683
2 changed files with 121 additions and 13 deletions
  1. +107
    -13
      Tweak.x
  2. +14
    -0
      kageprefs/Resources/Root.plist

+ 107
- 13
Tweak.x View File

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;
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];
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;
@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 {
%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) {
} }
} }
%end %end
// HIDE BADGE TEXT END //
// HIDE FOLDER BADGE TEXT END //


// HIDE LABELS START // // HIDE LABELS START //
%hook SBIconView %hook SBIconView
%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 {
%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;
// LISTENERS
%ctor {
// check iOS version
if (kSLSystemVersioniOS13) {
%init(ios13);
} }
else { else {
return %orig;
%init(ios12);
} }
}
%end
// SHOW TIME IN LS STATUSBAR END //


// LISTENERS
%ctor {
// 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);

+ 14
- 0
kageprefs/Resources/Root.plist View File

<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>

Loading…
Cancel
Save