From 9be81e2e718a8e395c8e463e7a5ae38ac022b34e Mon Sep 17 00:00:00 2001 From: Viggo Lekdorf Date: Fri, 3 Jan 2020 01:34:14 +0100 Subject: [PATCH] addddd --- CustomNoOlderNotifications.plist | 1 + Makefile | 14 ++++++ README.md | 5 +++ Tweak.xm | 52 ++++++++++++++++++++++ cnonprefs/CNONRootListController.h | 5 +++ cnonprefs/CNONRootListController.m | 41 +++++++++++++++++ cnonprefs/Makefile | 16 +++++++ cnonprefs/Resources/Info.plist | 24 ++++++++++ cnonprefs/Resources/Root.plist | 69 +++++++++++++++++++++++++++++ cnonprefs/Resources/twitter.png | Bin 0 -> 1755 bytes cnonprefs/entry.plist | 21 +++++++++ control | 10 +++++ 12 files changed, 258 insertions(+) create mode 100644 CustomNoOlderNotifications.plist create mode 100644 Makefile create mode 100644 README.md create mode 100644 Tweak.xm create mode 100644 cnonprefs/CNONRootListController.h create mode 100644 cnonprefs/CNONRootListController.m create mode 100644 cnonprefs/Makefile create mode 100644 cnonprefs/Resources/Info.plist create mode 100644 cnonprefs/Resources/Root.plist create mode 100644 cnonprefs/Resources/twitter.png create mode 100644 cnonprefs/entry.plist create mode 100644 control 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 0000000000000000000000000000000000000000..3f9a33262416fbfe6e6bea166f22635a461bed06 GIT binary patch literal 1755 zcmeAS@N?(olHy`uVBq!ia0vp^vLMXC1|-8Kr}G0T#^NA%Cx&(BWL^R}oCO|{#S9GG z!XV7ZFl&wkP(fs7NJL45ua8x7ey(0(N`6wRUPW#JP&EUCO@$SZnVVXYs8ErclUHn2 zVXFjIVFhG^g!Ppaz)DK8ZIvQ?0~DO|i&7O#^-S~(l1AfjnEK zjFOT9D}DX)@^Za$W4-*MbbUihOG|wNBYh(yU7!lx;>x^|#0uTKVr7USFmqf|i<65o z3raHc^AtelCMM;Vme?vOfh>Xph&xL%(-1c06+^uR^q@XSM&D4+Kp$>4P^%3{)XKjo zGZknv$b36P8?Z_gF{nK@`XI}Z90TzwSQO}0J1!f2c(B=V`5aP@WME*G_H=O!@!)+M z7MmdxDq{Ei+?jVd|7MwF8YJCS3%Ftunj*@o8M{;|W5HL&*{_;8>^c;}9BTwq-!?1# zTA<(BwXdTqZ^f-u5iXevyfjNTPBMvDz0h!>Z?DwsyEpIt+g2i$BBjVH#BP4L&{KwbyI}iJqjhXxF%x2&HdeSG&+fg;F zlZjp6`O!H~Sf6}03jUEg_w7QA}HT zC$#(>1x;n{{drfjdhzUhX<1wUg)?tuygXT^e{oY>_Uk?D0(K$GVnZ7G8$-e(ras-> zJ4bByGF55Um6xi*-_PA5bNkoDGkoXfZGNOaHQMK3NJam$&m9KQ<-eA?PPppjTfEY4 z+tW+;L_0&wrA|sSglKc^$d-F{eR3*mO{&Yp%YqUQZRak09WCy-G8W? z{(V{U*Js|T+`@{r0eQ}M8B}X$m-sX-_nRrX<=WEVuTx%6*tMcjonQX!SKWXMCAAVN zVzD2-BndREUt-18SIlSnIBL_~MKj-?U!?V3PV0<}0N1|4(o&~aYg0F9>rS!!z5Kw- z&M)q9neP`*yf8J}dc~1$dz&lua{_JV?Z2IzxJ={nqsIaU>h72Al^)q;hTFW;kJSCG zlo+>sd&!$XCz(sOHuDO!+E1R&-ITVmSEJybfMD4RHUVv~&;OH-9ZE3!bolo!rtMxF zDO%}%jXUNpnz!`R*XHMqC0TYBX009q$`=+a%U6-pIRCh)mF=+3O|_X^lk~lLr&na_ z2`x(s>1PN{tH0r0qUt^6rr)ox+UM5>S@6jG668>s82k0F*GX>KwgVh*3M*f?C>i`- z{b@~P8gEHz)9#*g(%f!pQ&lWvwC3DRFZpJtsI7YHl3LuEiX|6H4*v2`aM>SKS8O!B z&PvK)V_?MjDXxKSe_c+C)!f_rjpdM4_ggJ!{Hmb`6>e5qM^ z@{^Ub_|+}?iR=d-#5HDUXvQ85?pVFn!8!JF>rJM8Tc2FMaod~k`=+-KmNraZ=ksFA zzf&`tceePPVh;){5_kA2w(`h=i?zHJexi3)xo&Q3WB$6}f|Kd1@DFR2=5x-`_wUL1 zWmF{bzo;YiM#MVJ_r3DxOQq+P%c~muY~%@Cp5w6~<8q*+iFj>zldFKed!Jv>x%iOi zxz6_Y_s={g8aTN;|8U@+oyRi&eCYdru0+MBIC#EZ_3a?e#m~ITx4ronDfaHo_nl|C zc_ZC28D@q4y_Y`~Autd%e@Www~?l&tCdXN38p_mgKK_ n8TyU8Hl3OFHa7O}bI~8tpF3TD=+ + + + + 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