add no beta alert feature

This commit is contained in:
2020-06-30 02:08:48 +02:00
parent c66c64af42
commit 2fd4b787a3
3 changed files with 74 additions and 47 deletions

103
Tweak.x
View File

@ -1,4 +1,4 @@
// respring function // Respring function
@interface FBSystemService : NSObject @interface FBSystemService : NSObject
+(id)sharedInstance; +(id)sharedInstance;
-(void)exitAndRelaunch:(bool)arg1; -(void)exitAndRelaunch:(bool)arg1;
@ -8,7 +8,7 @@ static void RespringDevice() {
[[%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;
@ -17,7 +17,7 @@ static void RespringDevice() {
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;
@ -33,6 +33,7 @@ static BOOL hideFolderDots;
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];
@ -50,6 +51,7 @@ static void notificationCallback(CFNotificationCenterRef center, void *observer,
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;
@ -66,9 +68,10 @@ static void notificationCallback(CFNotificationCenterRef center, void *observer,
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
@ -130,9 +133,9 @@ static void notificationCallback(CFNotificationCenterRef center, void *observer,
#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 {
@ -143,9 +146,8 @@ static void notificationCallback(CFNotificationCenterRef center, void *observer,
} }
%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) {
@ -156,9 +158,8 @@ static void notificationCallback(CFNotificationCenterRef center, void *observer,
} }
} }
%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) {
@ -169,9 +170,8 @@ static void notificationCallback(CFNotificationCenterRef center, void *observer,
} }
} }
%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) {
@ -180,9 +180,8 @@ static void notificationCallback(CFNotificationCenterRef center, void *observer,
%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) {
@ -226,9 +225,8 @@ static void notificationCallback(CFNotificationCenterRef center, void *observer,
%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) {
@ -237,9 +235,8 @@ static void notificationCallback(CFNotificationCenterRef center, void *observer,
%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) {
@ -250,9 +247,8 @@ static void notificationCallback(CFNotificationCenterRef center, void *observer,
} }
} }
%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) {
@ -305,9 +301,7 @@ static void notificationCallback(CFNotificationCenterRef center, void *observer,
} }
%end*/ %end*/
// HIDE FOLDER BACKGROUND END // // Hide folder dots
// HIDE FOLDER DOTS START //
%hook SBIconListPageControl %hook SBIconListPageControl
-(void)layoutSubviews { -(void)layoutSubviews {
if (enabled && hideFolderDots) { if (enabled && hideFolderDots) {
@ -318,14 +312,39 @@ static void notificationCallback(CFNotificationCenterRef center, void *observer,
} }
} }
%end %end
// HIDE FOLDER DOTS END //
%end // end universal group // Hide beta alert
// stuff that only works on iOS 13 // 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
%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) {
@ -336,9 +355,8 @@ static void notificationCallback(CFNotificationCenterRef center, void *observer,
} }
} }
%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) {
@ -350,9 +368,8 @@ static void notificationCallback(CFNotificationCenterRef center, void *observer,
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) {
@ -363,14 +380,13 @@ static void notificationCallback(CFNotificationCenterRef center, void *observer,
} }
} }
%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) {
@ -381,9 +397,8 @@ static void notificationCallback(CFNotificationCenterRef center, void *observer,
} }
} }
%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) {
@ -395,9 +410,8 @@ static void notificationCallback(CFNotificationCenterRef center, void *observer,
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) {
@ -408,14 +422,13 @@ static void notificationCallback(CFNotificationCenterRef center, void *observer,
} }
} }
%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);
} }
@ -423,10 +436,10 @@ static void notificationCallback(CFNotificationCenterRef center, void *observer,
%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);
} }

View File

@ -1,9 +1,9 @@
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

View File

@ -220,6 +220,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>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>