This commit is contained in:
2020-01-03 01:34:14 +01:00
commit 9be81e2e71
12 changed files with 258 additions and 0 deletions

View File

@ -0,0 +1,5 @@
#import <Preferences/PSListController.h>
@interface CNONRootListController : PSListController
@end

View File

@ -0,0 +1,41 @@
#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

16
cnonprefs/Makefile Normal file
View File

@ -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)

View File

@ -0,0 +1,24 @@
<?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>

View File

@ -0,0 +1,69 @@
<?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>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

21
cnonprefs/entry.plist Normal file
View File

@ -0,0 +1,21 @@
<?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>