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.

Tweak.xm 2.1KB

4 år sedan
4 år sedan
4 år sedan
4 år sedan
4 år sedan
4 år sedan
4 år sedan
4 år sedan
4 år sedan
4 år sedan
4 år sedan
4 år sedan
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. @interface SBUILegibilityLabel : UIView
  2. @property (nonatomic,copy) NSString *string;
  3. @end
  4. @interface NCNotificationListSectionRevealHintView : UIView
  5. //-(void)_updateHintTitle;
  6. //-(void)setRevealHintTitle;
  7. @property (nonatomic,retain)SBUILegibilityLabel *revealHintTitle;
  8. @end
  9. // prefs
  10. @interface NSUserDefaults (CnonPrefs)
  11. -(id)objectForKey:(NSString *)key inDomain:(NSString *)domain;
  12. -(void)setObject:(id)value forKey:(NSString *)key inDomain:(NSString *)domain;
  13. @end
  14. static NSString *nsDomainString = @"com.yaypixxo.cnon";
  15. static NSString *nsNotificationString = @"com.yaypixxo.cnon/preferences.changed";
  16. // declare switch and string
  17. static BOOL enabled;
  18. static NSString *customText = @"";
  19. static void notificationCallback(CFNotificationCenterRef center, void *observer, CFStringRef name, const void *object, CFDictionaryRef userInfo) {
  20. NSNumber *eEnabled = (NSNumber *)[[NSUserDefaults standardUserDefaults] objectForKey:@"enabled" inDomain:nsDomainString];
  21. NSString *eCustomText = (NSString *)[[NSUserDefaults standardUserDefaults] objectForKey:@"customText" inDomain:nsDomainString];
  22. enabled = (eEnabled) ? [eEnabled boolValue]:NO;
  23. customText = eCustomText; //(eCustomText) ? [eCustomText value]:@"";
  24. }
  25. /*#ifndef kCFCoreFoundationVersionNumber_iOS_13_0
  26. #define kCFCoreFoundationVersionNumber_iOS_13_0 1665.15
  27. #endif
  28. #define kSLSystemVersioniOS13 kCFCoreFoundationVersionNumber >= kCFCoreFoundationVersionNumber_iOS_13_0*/
  29. /*%group ios13
  30. %hook NCNotificationListSectionRevealHintView
  31. -(void)setRevealHintTitle:(SBUILegibilityLabel *)arg1 {
  32. if (enabled) {
  33. arg1 = customText;
  34. }
  35. }
  36. %end
  37. %end*/
  38. //%group ios12
  39. %hook NCNotificationListSectionRevealHintView
  40. -(void)didMoveToWindow {
  41. %orig;
  42. if (enabled) {
  43. self.revealHintTitle.string = customText;
  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. }