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.

78 lines
2.2KB

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