{ Filter = { Bundles = ( "com.apple.springboard" ); }; } |
ARCHS = arm64 | |||||
TARGET = iphone:clang:11.2:11.2 | |||||
include $(THEOS)/makefiles/common.mk | |||||
TWEAK_NAME = CustomNoOlderNotifications | |||||
CustomNoOlderNotifications_FILES = Tweak.xm | |||||
include $(THEOS_MAKE_PATH)/tweak.mk | |||||
after-install:: | |||||
install.exec "killall -9 SpringBoard" | |||||
SUBPROJECTS += cnonprefs | |||||
include $(THEOS_MAKE_PATH)/aggregate.mk |
# CustomNoOlderNotifications | |||||
CustomNoOlderNotifications or CNON for short is the first tweak I ever made | |||||
It has been tested on iOS 11 and 12 and works (don't know about iOS 13) |
@interface SBUILegibilityLabel : UIView | |||||
@property (nonatomic,copy) NSString *string; | |||||
@end | |||||
@interface NCNotificationListSectionRevealHintView : UIView | |||||
-(void)_updateHintTitle; | |||||
@end | |||||
static BOOL enabled; | |||||
static NSString* customText = @""; | |||||
#define kIdentifier @"com.yaypixxo.cnonprefs" | |||||
#define kSettingsChangedNotification (CFStringRef)@"com.yaypixxo.cnonprefs/ReloadPrefs" | |||||
#define kSettingsPath @"/var/mobile/Library/Preferences/com.yaypixxo.cnonprefs.plist" | |||||
%hook NCNotificationListSectionRevealHintView | |||||
-(void)layoutSubviews { | |||||
%orig; | |||||
if (enabled) { | |||||
[MSHookIvar<UILabel *>(self, "_revealHintTitle") setString:customText]; | |||||
} | |||||
} | |||||
%end | |||||
static void reloadPrefs() { | |||||
CFPreferencesAppSynchronize((CFStringRef)kIdentifier); | |||||
NSDictionary *prefs = nil; | |||||
if ([NSHomeDirectory() isEqualToString:@"/var/mobile"]) { | |||||
CFArrayRef keyList = CFPreferencesCopyKeyList((CFStringRef)kIdentifier, kCFPreferencesCurrentUser, kCFPreferencesAnyHost); | |||||
if (keyList != nil) { | |||||
prefs = (NSDictionary *)CFBridgingRelease(CFPreferencesCopyMultiple(keyList, (CFStringRef)kIdentifier, kCFPreferencesCurrentUser, kCFPreferencesAnyHost)); | |||||
if (prefs == nil) | |||||
prefs = [NSDictionary dictionary]; | |||||
CFRelease(keyList); | |||||
} | |||||
} | |||||
else { | |||||
prefs = [NSDictionary dictionaryWithContentsOfFile:kSettingsPath]; | |||||
} | |||||
enabled = [prefs objectForKey:@"enabled"] ? [(NSNumber *)[prefs objectForKey:@"enabled"] boolValue] : true; | |||||
customText = [prefs objectForKey:@"customText"] ? [prefs objectForKey:@"customText"] : changeNotiTxt; | |||||
} | |||||
%ctor { | |||||
reloadPrefs(); | |||||
CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), NULL, (CFNotificationCallback)reloadPrefs, kSettingsChangedNotification, NULL, CFNotificationSuspensionBehaviorDeliverImmediately); | |||||
} |
#import <Preferences/PSListController.h> | |||||
@interface CNONRootListController : PSListController | |||||
@end |
#include "CNONRootListController.h" | |||||
#import <spawn.h> | |||||
@implementation CNONRootListController | |||||
- (NSArray *)specifiers { | |||||
if (!_specifiers) { | |||||
_specifiers = [[self loadSpecifiersFromPlistName:@"Root" target:self] retain]; | |||||
} | |||||
return _specifiers; | |||||
} | |||||
- (void)respring:(id)sender { | |||||
[self.view endEditing:YES]; | |||||
[NSThread sleepForTimeInterval:0.5f]; | |||||
pid_t pid; | |||||
const char* args[] = {"killall", "backboardd", NULL}; | |||||
posix_spawn(&pid, "/usr/bin/killall", NULL, NULL, (char* const*)args, NULL); | |||||
} | |||||
- (void)openTwitter { | |||||
NSURL *url; | |||||
if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"tweetbot:"]]) { | |||||
url = [NSURL URLWithString:@"tweetbot:///user_profile/Ra1nPix"]; | |||||
} else if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"twitterrific:"]]) { | |||||
url = [NSURL URLWithString:@"twitterrific:///profile?screen_name=Ra1nPix"]; | |||||
} else if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"tweetings:"]]) { | |||||
url = [NSURL URLWithString:@"tweetings:///user?screen_name=Ra1nPix"]; | |||||
} else if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"twitter:"]]) { | |||||
url = [NSURL URLWithString:@"twitter://user?screen_name=Ra1nPix"]; | |||||
} else { | |||||
url = [NSURL URLWithString:@"https://mobile.twitter.com/Ra1nPix"]; | |||||
} | |||||
// [[UIApplication sharedApplication] openURL:url options:@{} completionHandler:nil]; | |||||
[[UIApplication sharedApplication] openURL:url]; | |||||
} | |||||
@end |
ARCHS = arm64 | |||||
TARGET = iphone:11.2:11.2 | |||||
include $(THEOS)/makefiles/common.mk | |||||
BUNDLE_NAME = cnonprefs | |||||
cnonprefs_FILES = CNONRootListController.m | |||||
cnonprefs_INSTALL_PATH = /Library/PreferenceBundles | |||||
cnonprefs_FRAMEWORKS = UIKit | |||||
cnonprefs_PRIVATE_FRAMEWORKS = Preferences | |||||
include $(THEOS_MAKE_PATH)/bundle.mk | |||||
internal-stage:: | |||||
$(ECHO_NOTHING)mkdir -p $(THEOS_STAGING_DIR)/Library/PreferenceLoader/Preferences$(ECHO_END) | |||||
$(ECHO_NOTHING)cp entry.plist $(THEOS_STAGING_DIR)/Library/PreferenceLoader/Preferences/cnonprefs.plist$(ECHO_END) |
<?xml version="1.0" encoding="UTF-8"?> | |||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |||||
<plist version="1.0"> | |||||
<dict> | |||||
<key>CFBundleDevelopmentRegion</key> | |||||
<string>English</string> | |||||
<key>CFBundleExecutable</key> | |||||
<string>cnonprefs</string> | |||||
<key>CFBundleIdentifier</key> | |||||
<string>com.yaypixxo.cnonprefs</string> | |||||
<key>CFBundleInfoDictionaryVersion</key> | |||||
<string>6.0</string> | |||||
<key>CFBundlePackageType</key> | |||||
<string>BNDL</string> | |||||
<key>CFBundleShortVersionString</key> | |||||
<string>1.0.0</string> | |||||
<key>CFBundleSignature</key> | |||||
<string>????</string> | |||||
<key>CFBundleVersion</key> | |||||
<string>1.0</string> | |||||
<key>NSPrincipalClass</key> | |||||
<string>CNONRootListController</string> | |||||
</dict> | |||||
</plist> |
<?xml version="1.0" encoding="UTF-8"?> | |||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |||||
<plist version="1.0"> | |||||
<dict> | |||||
<key>items</key> | |||||
<array> | |||||
<dict> | |||||
<key>cell</key> | |||||
<string>PSSwitchCell</string> | |||||
<key>default</key> | |||||
<true/> | |||||
<key>defaults</key> | |||||
<string>com.yaypixxo.cnonprefs</string> | |||||
<key>key</key> | |||||
<string>enabled</string> | |||||
<key>label</key> | |||||
<string>Enable</string> | |||||
<key>PostNotification</key> | |||||
<string>com.yaypixxo.cnonprefs/ReloadPrefs</string> | |||||
</dict> | |||||
<dict> | |||||
<key>cell</key> | |||||
<string>PSGroupCell</string> | |||||
<key>footerText</key> | |||||
<string>Type your custom message or leave blank to hide the text.</string> | |||||
</dict> | |||||
<dict> | |||||
<key>cell</key> | |||||
<string>PSEditTextCell</string> | |||||
<key>defaults</key> | |||||
<string>com.yaypixxo.cnonprefs</string> | |||||
<key>default</key> | |||||
<string></string> | |||||
<key>key</key> | |||||
<string>customText</string> | |||||
<key>placeholder</key> | |||||
<string>custom text here</string> | |||||
<key>PostNotification</key> | |||||
<string>com.yaypixxo.cnonprefs/ReloadPrefs</string> | |||||
</dict> | |||||
<dict> | |||||
<key>cell</key> | |||||
<string>PSButtonCell</string> | |||||
<key>action</key> | |||||
<string>respring</string> | |||||
<key>label</key> | |||||
<string>Respring</string> | |||||
</dict> | |||||
<dict> | |||||
<key>cell</key> | |||||
<string>PSGroupCell</string> | |||||
<key>label</key> | |||||
<string>Follow me</string> | |||||
</dict> | |||||
<dict> | |||||
<key>action</key> | |||||
<string>openTwitter</string> | |||||
<key>cell</key> | |||||
<string>PSButtonCell</string> | |||||
<key>icon</key> | |||||
<string>twitter.png</string> | |||||
<key>label</key> | |||||
<string>@Ra1nPix</string> | |||||
</dict> | |||||
</array> | |||||
<key>title</key> | |||||
<string>CNON</string> | |||||
</dict> | |||||
</plist> |
<?xml version="1.0" encoding="UTF-8"?> | |||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |||||
<plist version="1.0"> | |||||
<dict> | |||||
<key>entry</key> | |||||
<dict> | |||||
<key>bundle</key> | |||||
<string>cnonprefs</string> | |||||
<key>cell</key> | |||||
<string>PSLinkCell</string> | |||||
<key>detail</key> | |||||
<string>CNONRootListController</string> | |||||
<key>icon</key> | |||||
<string>icon.png</string> | |||||
<key>isController</key> | |||||
<true/> | |||||
<key>label</key> | |||||
<string>CustomNoOlderNotifications</string> | |||||
</dict> | |||||
</dict> | |||||
</plist> |
Package: com.yaypixxo.cnon | |||||
Name: CustomNoOlderNotifications | |||||
Depends: mobilesubstrate, preferenceloader | |||||
Version: 2.0.0 | |||||
Architecture: iphoneos-arm | |||||
Description: Change the "No Older Notifications" text to a custom one! | |||||
Depiction: http://yaypixxo.com/depiction?p=com.yaypixxo.cnon | |||||
Maintainer: YaYPIXXO <viggo@lekdorf.com> | |||||
Author: YaYPIXXO <viggo@lekdorf.com> | |||||
Section: Tweaks |