commit 9be81e2e718a8e395c8e463e7a5ae38ac022b34e Author: Viggo Lekdorf Date: Fri Jan 3 01:34:14 2020 +0100 addddd diff --git a/CustomNoOlderNotifications.plist b/CustomNoOlderNotifications.plist new file mode 100644 index 0000000..10dc654 --- /dev/null +++ b/CustomNoOlderNotifications.plist @@ -0,0 +1 @@ +{ Filter = { Bundles = ( "com.apple.springboard" ); }; } diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..1e127cf --- /dev/null +++ b/Makefile @@ -0,0 +1,14 @@ +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 diff --git a/README.md b/README.md new file mode 100644 index 0000000..9072550 --- /dev/null +++ b/README.md @@ -0,0 +1,5 @@ +# 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) diff --git a/Tweak.xm b/Tweak.xm new file mode 100644 index 0000000..feea7e1 --- /dev/null +++ b/Tweak.xm @@ -0,0 +1,52 @@ +@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(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); +} \ No newline at end of file diff --git a/cnonprefs/CNONRootListController.h b/cnonprefs/CNONRootListController.h new file mode 100644 index 0000000..c4d1249 --- /dev/null +++ b/cnonprefs/CNONRootListController.h @@ -0,0 +1,5 @@ +#import + +@interface CNONRootListController : PSListController + +@end diff --git a/cnonprefs/CNONRootListController.m b/cnonprefs/CNONRootListController.m new file mode 100644 index 0000000..d786a6e --- /dev/null +++ b/cnonprefs/CNONRootListController.m @@ -0,0 +1,41 @@ +#include "CNONRootListController.h" +#import + +@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 diff --git a/cnonprefs/Makefile b/cnonprefs/Makefile new file mode 100644 index 0000000..62cb2c9 --- /dev/null +++ b/cnonprefs/Makefile @@ -0,0 +1,16 @@ +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) diff --git a/cnonprefs/Resources/Info.plist b/cnonprefs/Resources/Info.plist new file mode 100644 index 0000000..6bbf826 --- /dev/null +++ b/cnonprefs/Resources/Info.plist @@ -0,0 +1,24 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + cnonprefs + CFBundleIdentifier + com.yaypixxo.cnonprefs + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + BNDL + CFBundleShortVersionString + 1.0.0 + CFBundleSignature + ???? + CFBundleVersion + 1.0 + NSPrincipalClass + CNONRootListController + + diff --git a/cnonprefs/Resources/Root.plist b/cnonprefs/Resources/Root.plist new file mode 100644 index 0000000..00ec691 --- /dev/null +++ b/cnonprefs/Resources/Root.plist @@ -0,0 +1,69 @@ + + + + + items + + + cell + PSSwitchCell + default + + defaults + com.yaypixxo.cnonprefs + key + enabled + label + Enable + PostNotification + com.yaypixxo.cnonprefs/ReloadPrefs + + + cell + PSGroupCell + footerText + Type your custom message or leave blank to hide the text. + + + cell + PSEditTextCell + defaults + com.yaypixxo.cnonprefs + default + + key + customText + placeholder + custom text here + PostNotification + com.yaypixxo.cnonprefs/ReloadPrefs + + + cell + PSButtonCell + action + respring + label + Respring + + + cell + PSGroupCell + label + Follow me + + + action + openTwitter + cell + PSButtonCell + icon + twitter.png + label + @Ra1nPix + + + title + CNON + + diff --git a/cnonprefs/Resources/twitter.png b/cnonprefs/Resources/twitter.png new file mode 100644 index 0000000..3f9a332 Binary files /dev/null and b/cnonprefs/Resources/twitter.png differ diff --git a/cnonprefs/entry.plist b/cnonprefs/entry.plist new file mode 100644 index 0000000..c047f65 --- /dev/null +++ b/cnonprefs/entry.plist @@ -0,0 +1,21 @@ + + + + + entry + + bundle + cnonprefs + cell + PSLinkCell + detail + CNONRootListController + icon + icon.png + isController + + label + CustomNoOlderNotifications + + + diff --git a/control b/control new file mode 100644 index 0000000..180f3c2 --- /dev/null +++ b/control @@ -0,0 +1,10 @@ +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 +Author: YaYPIXXO +Section: Tweaks