Pārlūkot izejas kodu

addddd

tags/v2.0.0
Viggo Lekdorf pirms 4 gadiem
revīzija
9be81e2e71
12 mainītis faili ar 258 papildinājumiem un 0 dzēšanām
  1. +1
    -0
      CustomNoOlderNotifications.plist
  2. +14
    -0
      Makefile
  3. +5
    -0
      README.md
  4. +52
    -0
      Tweak.xm
  5. +5
    -0
      cnonprefs/CNONRootListController.h
  6. +41
    -0
      cnonprefs/CNONRootListController.m
  7. +16
    -0
      cnonprefs/Makefile
  8. +24
    -0
      cnonprefs/Resources/Info.plist
  9. +69
    -0
      cnonprefs/Resources/Root.plist
  10. Binārs
      cnonprefs/Resources/twitter.png
  11. +21
    -0
      cnonprefs/entry.plist
  12. +10
    -0
      control

+ 1
- 0
CustomNoOlderNotifications.plist Parādīt failu

@@ -0,0 +1 @@
{ Filter = { Bundles = ( "com.apple.springboard" ); }; }

+ 14
- 0
Makefile Parādīt failu

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

+ 5
- 0
README.md Parādīt failu

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

+ 52
- 0
Tweak.xm Parādīt failu

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

+ 5
- 0
cnonprefs/CNONRootListController.h Parādīt failu

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

@interface CNONRootListController : PSListController

@end

+ 41
- 0
cnonprefs/CNONRootListController.m Parādīt failu

@@ -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
- 0
cnonprefs/Makefile Parādīt failu

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

+ 24
- 0
cnonprefs/Resources/Info.plist Parādīt failu

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

+ 69
- 0
cnonprefs/Resources/Root.plist Parādīt failu

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

Binārs
cnonprefs/Resources/twitter.png Parādīt failu

Pirms Pēc
Platums: 29  |  Augstums: 29  |  Izmērs: 1.7KB

+ 21
- 0
cnonprefs/entry.plist Parādīt failu

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

+ 10
- 0
control Parādīt failu

@@ -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 <viggo@lekdorf.com>
Author: YaYPIXXO <viggo@lekdorf.com>
Section: Tweaks

Notiek ielāde…
Atcelt
Saglabāt