tweak to change the "custom no older notifications" text introduced in iOS 11
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Tweak.xm 1.7KB

4 yıl önce
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. @interface SBUILegibilityLabel : UIView
  2. @property (nonatomic,copy) NSString *string;
  3. @end
  4. @interface NCNotificationListSectionRevealHintView : UIView
  5. -(void)_updateHintTitle;
  6. @end
  7. static BOOL enabled;
  8. static NSString* customText = @"";
  9. #define kIdentifier @"com.yaypixxo.cnonprefs"
  10. #define kSettingsChangedNotification (CFStringRef)@"com.yaypixxo.cnonprefs/ReloadPrefs"
  11. #define kSettingsPath @"/var/mobile/Library/Preferences/com.yaypixxo.cnonprefs.plist"
  12. %hook NCNotificationListSectionRevealHintView
  13. -(void)layoutSubviews {
  14. %orig;
  15. if (enabled) {
  16. [MSHookIvar<UILabel *>(self, "_revealHintTitle") setString:customText];
  17. }
  18. }
  19. %end
  20. static void reloadPrefs() {
  21. CFPreferencesAppSynchronize((CFStringRef)kIdentifier);
  22. NSDictionary *prefs = nil;
  23. if ([NSHomeDirectory() isEqualToString:@"/var/mobile"]) {
  24. CFArrayRef keyList = CFPreferencesCopyKeyList((CFStringRef)kIdentifier, kCFPreferencesCurrentUser, kCFPreferencesAnyHost);
  25. if (keyList != nil) {
  26. prefs = (NSDictionary *)CFBridgingRelease(CFPreferencesCopyMultiple(keyList, (CFStringRef)kIdentifier, kCFPreferencesCurrentUser, kCFPreferencesAnyHost));
  27. if (prefs == nil)
  28. prefs = [NSDictionary dictionary];
  29. CFRelease(keyList);
  30. }
  31. }
  32. else {
  33. prefs = [NSDictionary dictionaryWithContentsOfFile:kSettingsPath];
  34. }
  35. enabled = [prefs objectForKey:@"enabled"] ? [(NSNumber *)[prefs objectForKey:@"enabled"] boolValue] : true;
  36. customText = [prefs objectForKey:@"customText"] ? [prefs objectForKey:@"customText"] : changeNotiTxt;
  37. }
  38. %ctor {
  39. reloadPrefs();
  40. CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), NULL, (CFNotificationCallback)reloadPrefs, kSettingsChangedNotification, NULL, CFNotificationSuspensionBehaviorDeliverImmediately);
  41. }