tweak to change the "custom no older notifications" text introduced in iOS 11 https://yaypixxo.com/depictions?p=com.yaypixxo.cnon
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.

71 lines
2.4KB

  1. // respring function
  2. /*@interface FBSystemService : NSObject
  3. +(id)sharedInstance;
  4. -(void)exitAndRelaunch:(bool)arg1;
  5. @end
  6. static void RespringDevice() {
  7. [[%c(FBSystemService) sharedInstance] exitAndRelaunch:YES];
  8. }*/
  9. // headers
  10. @interface SBUILegibilityLabel : UIView
  11. @property (nonatomic,copy) NSString *string;
  12. @property (assign,nonatomic) long long textAlignment;
  13. @end
  14. @interface NCNotificationListSectionRevealHintView : UIView
  15. @property (nonatomic,retain)SBUILegibilityLabel *revealHintTitle;
  16. @end
  17. // prefs
  18. @interface NSUserDefaults (CnonPrefs)
  19. -(id)objectForKey:(NSString *)key inDomain:(NSString *)domain;
  20. -(void)setObject:(id)value forKey:(NSString *)key inDomain:(NSString *)domain;
  21. @end
  22. static NSString *nsDomainString = @"com.yaypixxo.cnon";
  23. static NSString *nsNotificationString = @"com.yaypixxo.cnon/preferences.changed";
  24. // declare switch and string
  25. static BOOL enabled;
  26. static NSString *customText = @"";
  27. static void notificationCallback(CFNotificationCenterRef center, void *observer, CFStringRef name, const void *object, CFDictionaryRef userInfo) {
  28. NSNumber *eEnabled = (NSNumber *)[[NSUserDefaults standardUserDefaults] objectForKey:@"enabled" inDomain:nsDomainString];
  29. NSString *eCustomText = (NSString *)[[NSUserDefaults standardUserDefaults] objectForKey:@"customText" inDomain:nsDomainString];
  30. enabled = (eEnabled) ? [eEnabled boolValue]:NO;
  31. customText = eCustomText;
  32. }
  33. // check iOS version
  34. #ifndef kCFCoreFoundationVersionNumber_iOS_13_0
  35. #define kCFCoreFoundationVersionNumber_iOS_13_0 1665.15
  36. #endif
  37. #define kSLSystemVersioniOS13 kCFCoreFoundationVersionNumber >= kCFCoreFoundationVersionNumber_iOS_13_0
  38. // hook class
  39. %hook NCNotificationListSectionRevealHintView
  40. -(void)didMoveToWindow {
  41. %orig;
  42. if (enabled) {
  43. self.revealHintTitle.string = customText;
  44. if (kSLSystemVersioniOS13) {
  45. self.revealHintTitle.textAlignment = 1;
  46. }
  47. }
  48. }
  49. %end
  50. %ctor {
  51. // prefs changed listener
  52. notificationCallback(NULL, NULL, NULL, NULL, NULL);
  53. CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), NULL, notificationCallback, (CFStringRef)nsNotificationString, NULL, CFNotificationSuspensionBehaviorCoalesce);
  54. // respring notification listener
  55. //CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), NULL, (CFNotificationCallback)RespringDevice, CFSTR("com.yaypixxo.cnon/respring"), NULL, CFNotificationSuspensionBehaviorDeliverImmediately);
  56. }