14 Commits

Author SHA1 Message Date
4c780cf24d yaypwdpwd no respring needed 2020-01-05 18:46:45 +01:00
a197d363a0 fix respring (hopefully) 2020-01-05 18:35:17 +01:00
ed84d40ee6 fix respring 2020-01-05 18:31:28 +01:00
5a32a85e2a add iOS 13 support 2020-01-05 18:21:03 +01:00
042c85fe63 ughhh 2020-01-05 17:54:03 +01:00
a988ace5de Revert "center label on iOS 13"
This reverts commit 31e49bedc7.
2020-01-05 17:49:09 +01:00
31e49bedc7 center label on iOS 13 2020-01-05 17:39:45 +01:00
91ea103e63 center label on iOS 13 2020-01-05 17:39:08 +01:00
98a3a38cfc fix apply button freezing device 2020-01-05 16:57:32 +01:00
419938c34d remove need for respring 2020-01-05 16:49:52 +01:00
804936739b update control file 2020-01-05 15:54:14 +01:00
7ddac35e83 twitter 2020-01-05 14:54:44 +01:00
e01de210cb icon 2020-01-05 14:49:33 +01:00
bf6e2c6e01 Update 'README.md' 2020-01-03 12:39:25 +00:00
11 changed files with 97 additions and 66 deletions

View File

@ -1,14 +1,15 @@
ARCHS = arm64
ARCHS = arm64 arm64e
TARGET = iphone:clang:11.2:11.2
INSTALL_TARGET_PROCESSES = SpringBoard
include $(THEOS)/makefiles/common.mk
TWEAK_NAME = CustomNoOlderNotifications
CustomNoOlderNotifications_FILES = Tweak.xm
CustomNoOlderNotifications_CFLAGS = -fobjc-arc
include $(THEOS_MAKE_PATH)/tweak.mk
after-install::
install.exec "killall -9 SpringBoard"
SUBPROJECTS += cnonprefs
include $(THEOS_MAKE_PATH)/aggregate.mk

View File

@ -3,3 +3,7 @@
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)
## Installation
1. Add https://yaypixxo.com/ to your sources in your package manager
2. Search for and install CustomNoOlderNotifications

View File

@ -1,52 +1,71 @@
// respring function
/*@interface FBSystemService : NSObject
+(id)sharedInstance;
-(void)exitAndRelaunch:(bool)arg1;
@end
static void RespringDevice() {
[[%c(FBSystemService) sharedInstance] exitAndRelaunch:YES];
}*/
// headers
@interface SBUILegibilityLabel : UIView
@property (nonatomic,copy) NSString *string;
@property (assign,nonatomic) long long textAlignment;
@end
@interface NCNotificationListSectionRevealHintView : UIView
-(void)_updateHintTitle;
@interface NCNotificationListSectionRevealHintView : UIView
@property (nonatomic,retain)SBUILegibilityLabel *revealHintTitle;
@end
// prefs
@interface NSUserDefaults (CnonPrefs)
-(id)objectForKey:(NSString *)key inDomain:(NSString *)domain;
-(void)setObject:(id)value forKey:(NSString *)key inDomain:(NSString *)domain;
@end
static NSString *nsDomainString = @"com.yaypixxo.cnon";
static NSString *nsNotificationString = @"com.yaypixxo.cnon/preferences.changed";
// declare switch and string
static BOOL enabled;
static NSString* customText = @"";
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"
static void notificationCallback(CFNotificationCenterRef center, void *observer, CFStringRef name, const void *object, CFDictionaryRef userInfo) {
NSNumber *eEnabled = (NSNumber *)[[NSUserDefaults standardUserDefaults] objectForKey:@"enabled" inDomain:nsDomainString];
NSString *eCustomText = (NSString *)[[NSUserDefaults standardUserDefaults] objectForKey:@"customText" inDomain:nsDomainString];
enabled = (eEnabled) ? [eEnabled boolValue]:NO;
customText = eCustomText;
}
// check iOS version
#ifndef kCFCoreFoundationVersionNumber_iOS_13_0
#define kCFCoreFoundationVersionNumber_iOS_13_0 1665.15
#endif
#define kSLSystemVersioniOS13 kCFCoreFoundationVersionNumber >= kCFCoreFoundationVersionNumber_iOS_13_0
// hook class
%hook NCNotificationListSectionRevealHintView
-(void)layoutSubviews {
-(void)didMoveToWindow {
%orig;
if (enabled) {
[MSHookIvar<UILabel *>(self, "_revealHintTitle") setString:customText];
self.revealHintTitle.string = customText;
if (kSLSystemVersioniOS13) {
self.revealHintTitle.textAlignment = 1;
}
}
}
%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);
// prefs changed listener
notificationCallback(NULL, NULL, NULL, NULL, NULL);
CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), NULL, notificationCallback, (CFStringRef)nsNotificationString, NULL, CFNotificationSuspensionBehaviorCoalesce);
// respring notification listener
//CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), NULL, (CFNotificationCallback)RespringDevice, CFSTR("com.yaypixxo.cnon/respring"), NULL, CFNotificationSuspensionBehaviorDeliverImmediately);
}

View File

@ -1,41 +1,44 @@
#include "CNONRootListController.h"
#import <spawn.h>
@implementation CNONRootListController
- (NSArray *)specifiers {
if (!_specifiers) {
_specifiers = [[self loadSpecifiersFromPlistName:@"Root" target:self] retain];
_specifiers = [self loadSpecifiersFromPlistName:@"Root" target:self];
}
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 {
-(void)openTwitter {
NSURL *url;
// check which of these apps are installed
if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"tweetbot:"]]) {
url = [NSURL URLWithString:@"tweetbot:///user_profile/Ra1nPix"];
} else if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"twitterrific:"]]) {
}
else if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"twitterrific:"]]) {
url = [NSURL URLWithString:@"twitterrific:///profile?screen_name=Ra1nPix"];
} else if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"tweetings:"]]) {
}
else if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"tweetings:"]]) {
url = [NSURL URLWithString:@"tweetings:///user?screen_name=Ra1nPix"];
} else if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"twitter:"]]) {
}
else if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"twitter:"]]) {
url = [NSURL URLWithString:@"twitter://user?screen_name=Ra1nPix"];
} else {
}
else {
url = [NSURL URLWithString:@"https://mobile.twitter.com/Ra1nPix"];
}
// [[UIApplication sharedApplication] openURL:url options:@{} completionHandler:nil];
[[UIApplication sharedApplication] openURL:url];
// open my profile in the app chosen above
// if you're compiling with an iOS 10 or lower sdk you can leave out options:@{} and completionHandler:nil
[[UIApplication sharedApplication] openURL:url options:@{} completionHandler:nil];
}
// send respring notification
-(void)apply {
[self.view endEditing:YES];
//CFNotificationCenterPostNotification(CFNotificationCenterGetDarwinNotifyCenter(), CFSTR("com.yaypixxo.cnon/respring"), NULL, NULL, YES);
}
@end

View File

@ -1,13 +1,15 @@
ARCHS = arm64
TARGET = iphone:11.2:11.2
ARCHS = arm64 arm64e
TARGET = iphone:clang: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
cnonprefs_CFLAGS = -fobjc-arc
include $(THEOS_MAKE_PATH)/bundle.mk

BIN
cnonprefs/Resources/.DS_Store vendored Normal file

Binary file not shown.

View File

@ -10,25 +10,25 @@
<key>default</key>
<true/>
<key>defaults</key>
<string>com.yaypixxo.cnonprefs</string>
<string>com.yaypixxo.cnon</string>
<key>key</key>
<string>enabled</string>
<key>label</key>
<string>Enable</string>
<key>PostNotification</key>
<string>com.yaypixxo.cnonprefs/ReloadPrefs</string>
<string>com.yaypixxo.cnon/preferences.changed</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>
<string>Type your custom text or leave blank to hide the text</string>
</dict>
<dict>
<key>cell</key>
<string>PSEditTextCell</string>
<key>defaults</key>
<string>com.yaypixxo.cnonprefs</string>
<string>com.yaypixxo.cnon</string>
<key>default</key>
<string></string>
<key>key</key>
@ -36,21 +36,21 @@
<key>placeholder</key>
<string>custom text here</string>
<key>PostNotification</key>
<string>com.yaypixxo.cnonprefs/ReloadPrefs</string>
<string>com.yaypixxo.cnon/preferences.changed</string>
</dict>
<dict>
<key>cell</key>
<string>PSButtonCell</string>
<key>action</key>
<string>respring</string>
<string>apply</string>
<key>label</key>
<string>Respring</string>
<string>Apply</string>
</dict>
<dict>
<key>cell</key>
<string>PSGroupCell</string>
<key>label</key>
<string>Follow me</string>
<string>Follow me on Twitter</string>
</dict>
<dict>
<key>action</key>
@ -64,6 +64,6 @@
</dict>
</array>
<key>title</key>
<string>CNON</string>
<string>CustomNoOlderNotifications</string>
</dict>
</plist>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@ -1,10 +1,12 @@
Package: com.yaypixxo.cnon
Name: CustomNoOlderNotifications
Depends: mobilesubstrate, preferenceloader
Version: 2.0.0
Version: 2.2.0
Architecture: iphoneos-arm
Description: Change the "No Older Notifications" text to a custom one!
Depiction: http://yaypixxo.com/depiction?p=com.yaypixxo.cnon
Icon: https://yaypixxo.com/assets/com.yaypixxo.cnon.png
Depiction: https://yaypixxo.com/depictions?p=com.yaypixxo.cnon
SileoDepiction: https://yaypixxo.com/sileo/com.yaypixxo.com
Maintainer: YaYPIXXO <viggo@lekdorf.com>
Author: YaYPIXXO <viggo@lekdorf.com>
Section: Tweaks