tweak to change the "custom no older notifications" text introduced in iOS 11
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

52 lines
1.7KB

  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. }