Browse Source

add no beta alert feature

tags/v1.1.3
Viggo Lekdorf 4 years ago
parent
commit
2fd4b787a3
3 changed files with 74 additions and 47 deletions
  1. +58
    -45
      Tweak.x
  2. +2
    -2
      control
  3. +14
    -0
      kageprefs/Resources/Root.plist

+ 58
- 45
Tweak.x View File

// respring function
// Respring function
@interface FBSystemService : NSObject @interface FBSystemService : NSObject
+(id)sharedInstance; +(id)sharedInstance;
-(void)exitAndRelaunch:(bool)arg1; -(void)exitAndRelaunch:(bool)arg1;
[[%c(FBSystemService) sharedInstance] exitAndRelaunch:YES]; [[%c(FBSystemService) sharedInstance] exitAndRelaunch:YES];
} }


// prefs
// Prefs
@interface NSUserDefaults (KagePrefs) @interface NSUserDefaults (KagePrefs)
-(id)objectForKey:(NSString *)key inDomain:(NSString *)domain; -(id)objectForKey:(NSString *)key inDomain:(NSString *)domain;
-(void)setObject:(id)value forKey:(NSString *)key inDomain:(NSString *)domain; -(void)setObject:(id)value forKey:(NSString *)key inDomain:(NSString *)domain;
static NSString *nsDomainString = @"com.yaypixxo.kage"; static NSString *nsDomainString = @"com.yaypixxo.kage";
static NSString *nsNotificationString = @"com.yaypixxo.kage/preferences.changed"; static NSString *nsNotificationString = @"com.yaypixxo.kage/preferences.changed";


// declare pref things here (switches, buttons, etc.)
// Declare pref things here (switches, buttons, etc.)
static BOOL enabled; static BOOL enabled;
static BOOL hideQuickActionsBG; static BOOL hideQuickActionsBG;
static BOOL gridSwitcher; static BOOL gridSwitcher;
static BOOL hideNoOlderNotifs; static BOOL hideNoOlderNotifs;
//static BOOL hideStatusBarLS; //static BOOL hideStatusBarLS;
static BOOL hideCCGrabber; static BOOL hideCCGrabber;
static BOOL noBetaAlert;


static void notificationCallback(CFNotificationCenterRef center, void *observer, CFStringRef name, const void *object, CFDictionaryRef userInfo) { static void notificationCallback(CFNotificationCenterRef center, void *observer, CFStringRef name, const void *object, CFDictionaryRef userInfo) {
NSNumber *eEnabled = (NSNumber *)[[NSUserDefaults standardUserDefaults] objectForKey:@"enabled" inDomain:nsDomainString]; NSNumber *eEnabled = (NSNumber *)[[NSUserDefaults standardUserDefaults] objectForKey:@"enabled" inDomain:nsDomainString];
NSNumber *eHideNoOlderNotifs = (NSNumber *)[[NSUserDefaults standardUserDefaults] objectForKey:@"hideNoOlderNotifs" inDomain:nsDomainString]; NSNumber *eHideNoOlderNotifs = (NSNumber *)[[NSUserDefaults standardUserDefaults] objectForKey:@"hideNoOlderNotifs" 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];
NSNumber *eNoBetaAlert = (NSNumber *)[[NSUserDefaults standardUserDefaults] objectForKey:@"noBetaAlert" inDomain:nsDomainString];


enabled = (eEnabled) ? [eEnabled boolValue]:NO; enabled = (eEnabled) ? [eEnabled boolValue]:NO;
hideQuickActionsBG = (eHideQuickActionsBG) ? [eHideQuickActionsBG boolValue]:NO; hideQuickActionsBG = (eHideQuickActionsBG) ? [eHideQuickActionsBG boolValue]:NO;
hideNoOlderNotifs = (eHideNoOlderNotifs) ? [eHideNoOlderNotifs boolValue]:NO; hideNoOlderNotifs = (eHideNoOlderNotifs) ? [eHideNoOlderNotifs boolValue]:NO;
//hideStatusBarLS = (eHideStatusBarLS) ? [eHideStatusBarLS boolValue]:NO; //hideStatusBarLS = (eHideStatusBarLS) ? [eHideStatusBarLS boolValue]:NO;
hideCCGrabber = (eHideCCGrabber) ? [eHideCCGrabber boolValue]:NO; hideCCGrabber = (eHideCCGrabber) ? [eHideCCGrabber boolValue]:NO;
noBetaAlert = (eNoBetaAlert) ? [eNoBetaAlert boolValue]:NO;
} }


// headers and hooks
// Headers
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>


/*@interface SBFolderView : UIView /*@interface SBFolderView : UIView


#define kSLSystemVersioniOS13 kCFCoreFoundationVersionNumber >= kCFCoreFoundationVersionNumber_iOS_13_0 #define kSLSystemVersioniOS13 kCFCoreFoundationVersionNumber >= kCFCoreFoundationVersionNumber_iOS_13_0


%group universal
%group universal // Stuff that works on both iOS 12 & iOS 13 (and some things 9+)


// HIDE NO OLDER NOTIFICATIONS START //
// Hide no older notifications
%hook NCNotificationListSectionRevealHintView %hook NCNotificationListSectionRevealHintView


-(void)didMoveToWindow { -(void)didMoveToWindow {
} }


%end %end
// HIDE NO OLDER NOTIFICATIONS END //


// HIDE QUICK ACTIONS BG START //
// Hide quick actions BG
%hook UICoverSheetButton %hook UICoverSheetButton
-(id)_backgroundEffectsWithBrightness:(double)arg1 { -(id)_backgroundEffectsWithBrightness:(double)arg1 {
if (enabled && hideQuickActionsBG) { if (enabled && hideQuickActionsBG) {
} }
} }
%end %end
// HIDE QUICK ACTIONS BG END //


// HIDE FOLDER BADGE TEXT START //
// Hide folder badges text
%hook SBIcon %hook SBIcon
-(id)badgeNumberOrString { -(id)badgeNumberOrString {
if (enabled && hideFolderBadges) { if (enabled && hideFolderBadges) {
} }
} }
%end %end
// HIDE FOLDER BADGE TEXT END //


// HIDE LABELS START //
// Hide icon labels
%hook SBIconView %hook SBIconView
-(void)setLabelHidden:(BOOL)hidden { -(void)setLabelHidden:(BOOL)hidden {
if (enabled && hideLabels) { if (enabled && hideLabels) {
%orig; %orig;
} }
%end %end
// HIDE LABELS END //


// GRID SWITCHER START //
// Grid switcher
%hook SBAppSwitcherSettings %hook SBAppSwitcherSettings
- (void)setGridSwitcherPageScale:(double)arg1 { - (void)setGridSwitcherPageScale:(double)arg1 {
if (enabled && gridSwitcher) { if (enabled && gridSwitcher) {
%orig; %orig;
} }
%end %end
// GRID SWITCHER END //


// NO LS BATTERY START //
// Hide LS battery
%hook CSCoverSheetViewController %hook CSCoverSheetViewController
- (void)_transitionChargingViewToVisible:(bool)arg1 showBattery:(bool)arg2 animated:(bool)arg3 { - (void)_transitionChargingViewToVisible:(bool)arg1 showBattery:(bool)arg2 animated:(bool)arg3 {
if (enabled && hideLSBatt) { if (enabled && hideLSBatt) {
%orig; %orig;
} }
%end %end
// NO LS BATTERY END //


// SHOW FOLDER TITLE START //
// Hide folder title
%hook SBFloatyFolderView %hook SBFloatyFolderView
-(BOOL)_showsTitle { -(BOOL)_showsTitle {
if (enabled && hideFolderTitle) { if (enabled && hideFolderTitle) {
} }
} }
%end %end
// SHOW FOLDER TITLE END //


// HIDE FOLDER BACKGROUND START //
// Hide folder backgrounds
%hook SBFloatyFolderView %hook SBFloatyFolderView
-(void)setBackgroundAlpha:(CGFloat)arg1 { -(void)setBackgroundAlpha:(CGFloat)arg1 {
if (enabled && hideFolderBG) { if (enabled && hideFolderBG) {
} }
%end*/ %end*/


// HIDE FOLDER BACKGROUND END //

// HIDE FOLDER DOTS START //
// Hide folder dots
%hook SBIconListPageControl %hook SBIconListPageControl
-(void)layoutSubviews { -(void)layoutSubviews {
if (enabled && hideFolderDots) { if (enabled && hideFolderDots) {
} }
} }
%end %end
// HIDE FOLDER DOTS END //


%end // end universal group
// Hide beta alert

// iOS 9-10
%hook SBIconController
-(void)showDeveloperBuildExpirationAlertIfNecesarryFromLockscreen:(BOOL)arg1 toLauncher:(BOOL)arg2 {
if (enabled && noBetaAlert) {

}
else {
%orig;
}
}
%end

// iOS 11-13
%hook SBDeveloperBuildExpirationTrigger
-(void)showDeveloperBuildExpirationAlertIfNecesarryFromLockscreen:(BOOL)arg1 toLauncher:(BOOL)arg2 {
if (enabled && noBetaAlert) {

}
else {
%orig;
}
}
%end

%end // End universal group


// stuff that only works on iOS 13
// Stuff that only works on iOS 13
%group ios13 %group ios13


// SHOW TIME IN LS STATUSBAR START //
// Show time in LS statusbar
%hook CSCoverSheetViewController %hook CSCoverSheetViewController
- (bool)shouldShowLockStatusBarTime { - (bool)shouldShowLockStatusBarTime {
if (enabled && statusBarShowTimeLS) { if (enabled && statusBarShowTimeLS) {
} }
} }
%end %end
// SHOW TIME IN LS STATUSBAR END //


// HIDE CC GRABBER START //
// Hide CC LS grabber
%hook CSTeachableMomentsContainerView %hook CSTeachableMomentsContainerView
- (void)layoutSubviews { - (void)layoutSubviews {
if (enabled && hideCCGrabber) { if (enabled && hideCCGrabber) {
return %orig; return %orig;
} }
%end %end
// HIDE CC GRABBER END //


// HIDE CARPLAY LABELS START //
// Hide CarPlay labels
/*%hook CARIconView /*%hook CARIconView
+(CGSize)maxLabelSizeForIconImageSize:(CGSize)imageSize { +(CGSize)maxLabelSizeForIconImageSize:(CGSize)imageSize {
if (enabled && hideCarPlayLabels) { if (enabled && hideCarPlayLabels) {
} }
} }
%end*/ %end*/
// HIDE CARPLAY LABELS END //


%end // end ios13 group
%end // End ios13 group


// stuff that only works on iOS 12
// Stuff that only works on iOS 12
%group ios12 %group ios12


// SHOW TIME IN LS STATUSBAR START //
// Show time in LS statusbar
%hook SBLockScreenViewControllerBase %hook SBLockScreenViewControllerBase
- (bool)shouldShowLockStatusBarTime { - (bool)shouldShowLockStatusBarTime {
if (enabled && statusBarShowTimeLS) { if (enabled && statusBarShowTimeLS) {
} }
} }
%end %end
// SHOW TIME IN LS STATUSBAR END //


// HIDE CC GRABBER START //
// Hide CC LS grabber
%hook SBDashBoardTeachableMomentsContainerView %hook SBDashBoardTeachableMomentsContainerView
- (void)layoutSubviews { - (void)layoutSubviews {
if (enabled && hideCCGrabber) { if (enabled && hideCCGrabber) {
return %orig; return %orig;
} }
%end %end
// HIDE CC GRABBER END //


// HIDE CARPLAY LABELS START //
// Hide CarPlay labels
/*%hook SBStarkIconView /*%hook SBStarkIconView
+(CGSize)maxLabelSize { +(CGSize)maxLabelSize {
if (enabled && hideCarPlayLabels) { if (enabled && hideCarPlayLabels) {
} }
} }
%end*/ %end*/
// HIDE CARPLAY LABELS END //


%end // end ios12 group
%end // End ios12 group


// LISTENERS
// Listeners
%ctor { %ctor {
%init(universal); %init(universal);
// check iOS version
// Check iOS version
if (kSLSystemVersioniOS13) { if (kSLSystemVersioniOS13) {
%init(ios13); %init(ios13);
} }
%init(ios12); %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);


// respring listener
// Respring listener
CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), NULL, (CFNotificationCallback)RespringDevice, CFSTR("com.yaypixxo.kage/respring"), NULL, CFNotificationSuspensionBehaviorDeliverImmediately); CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), NULL, (CFNotificationCallback)RespringDevice, CFSTR("com.yaypixxo.kage/respring"), NULL, CFNotificationSuspensionBehaviorDeliverImmediately);
} }

+ 2
- 2
control View File

Package: com.yaypixxo.kage Package: com.yaypixxo.kage
Name: Kage Name: Kage
Depends: mobilesubstrate, preferenceloader Depends: mobilesubstrate, preferenceloader
Version: 1.1.2
Version: 1.1.3
Architecture: iphoneos-arm Architecture: iphoneos-arm
Description: show/hide/change ls and hs stuff!
Description: Show/hide/change LS and HS stuff
Icon: https://yaypixxo.com/assets/com.yaypixxo.kage.png Icon: https://yaypixxo.com/assets/com.yaypixxo.kage.png
Depiction: https://yaypixxo.com/depictions?p=com.yaypixxo.kage Depiction: https://yaypixxo.com/depictions?p=com.yaypixxo.kage
SileoDepiction: https://yaypixxo.com/sileo/com.yaypixxo.kage SileoDepiction: https://yaypixxo.com/sileo/com.yaypixxo.kage

+ 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>noBetaAlert</string>
<key>label</key>
<string>No Beta iOS Alert</string>
<key>PostNotification</key>
<string>com.yaypixxo.kage/preferences.changed</string>
</dict>
<dict> <dict>
<key>cell</key> <key>cell</key>
<string>PSGroupCell</string> <string>PSGroupCell</string>

Loading…
Cancel
Save