hide/show/change stuff on the LS and HS
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

135 lines
4.1KB

  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. // prefs
  10. @interface NSUserDefaults (KagePrefs)
  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.kage";
  15. static NSString *nsNotificationString = @"com.yaypixxo.kage/preferences.changed";
  16. // declare pref things here (switches, buttons, etc.)
  17. static BOOL enabled;
  18. static BOOL hideQuickActionsBG;
  19. static BOOL gridSwitcher;
  20. static BOOL hideLSBatt;
  21. static BOOL statusBarShowTimeLS;
  22. static void notificationCallback(CFNotificationCenterRef center, void *observer, CFStringRef name, const void *object, CFDictionaryRef userInfo) {
  23. NSNumber *eEnabled = (NSNumber *)[[NSUserDefaults standardUserDefaults] objectForKey:@"enabled" inDomain:nsDomainString];
  24. NSNumber *eHideQuickActionsBG = (NSNumber *)[[NSUserDefaults standardUserDefaults] objectForKey:@"hideQuickActionsBG" inDomain:nsDomainString];
  25. NSNumber *eGridSwitcher = (NSNumber *)[[NSUserDefaults standardUserDefaults] objectForKey:@"gridSwitcher" inDomain:nsDomainString];
  26. NSNumber *eHideLSBatt = (NSNumber *)[[NSUserDefaults standardUserDefaults] objectForKey:@"hideLSBatt" inDomain:nsDomainString];
  27. NSNumber *eStatusBarShowTimeLS = (NSNumber *)[[NSUserDefaults standardUserDefaults] objectForKey:@"statusBarShowTimeLS" inDomain:nsDomainString];
  28. enabled = (eEnabled) ? [eEnabled boolValue]:NO;
  29. hideQuickActionsBG = (eHideQuickActionsBG) ? [eHideQuickActionsBG boolValue]:NO;
  30. gridSwitcher = (eGridSwitcher) ? [eGridSwitcher boolValue]:NO;
  31. hideLSBatt = (eHideLSBatt) ? [eHideLSBatt boolValue]:NO;
  32. statusBarShowTimeLS = (eStatusBarShowTimeLS) ? [eStatusBarShowTimeLS boolValue]:NO;
  33. }
  34. // hooks and stuff
  35. #import <UIKit/UIKit.h>
  36. // QUICK ACTIONS BG START //
  37. %hook UICoverSheetButton
  38. -(id)_backgroundEffectsWithBrightness:(double)arg1 {
  39. if (enabled && hideQuickActionsBG) {
  40. return 0;
  41. }
  42. else {
  43. return %orig;
  44. }
  45. }
  46. %end
  47. // QUICK ACTIONS BG END //
  48. // GRID SWITCHER START //
  49. %hook SBAppSwitcherSettings
  50. - (void)setGridSwitcherPageScale:(double)arg1 {
  51. if (enabled && gridSwitcher) {
  52. arg1 = 0.4;
  53. }
  54. %orig;
  55. }
  56. - (void)setGridSwitcherHorizontalInterpageSpacingPortrait:(double)arg1 {
  57. if (enabled && gridSwitcher) {
  58. arg1 = 25.5;
  59. }
  60. %orig;
  61. }
  62. - (void)setGridSwitcherHorizontalInterpageSpacingLandscape:(double)arg1 {
  63. if (enabled && gridSwitcher) {
  64. arg1 = 11.6;
  65. }
  66. %orig;
  67. }
  68. - (void)setGridSwitcherVerticalNaturalSpacingPortrait:(double)arg1 {
  69. if (enabled && gridSwitcher) {
  70. arg1 = 42;
  71. }
  72. %orig;
  73. }
  74. - (void)setGridSwitcherVerticalNaturalSpacingLandscape:(double)arg1 {
  75. if (enabled && gridSwitcher) {
  76. arg1 = 38;
  77. }
  78. %orig;
  79. }
  80. - (void)setSwitcherStyle:(long long)arg1 {
  81. if (enabled && gridSwitcher) {
  82. arg1 = 2;
  83. }
  84. %orig;
  85. }
  86. %end
  87. // GRID SWITCHER END //
  88. // NO LS BATTERY START //
  89. %hook CSCoverSheetViewController
  90. - (void)_transitionChargingViewToVisible:(bool)arg1 showBattery:(bool)arg2 animated:(bool)arg3 {
  91. if (enabled && hideLSBatt) {
  92. arg1 = 0;
  93. }
  94. %orig;
  95. }
  96. %end
  97. // NO LS BATTERY END //
  98. // SHOW TIME IN LS STATUSBAR START //
  99. %hook CSCoverSheetViewController
  100. - (bool)shouldShowLockStatusBarTime {
  101. if (enabled && statusBarShowTimeLS) {
  102. return 1;
  103. }
  104. else {
  105. return %orig;
  106. }
  107. }
  108. %end
  109. // SHOW TIME IN LS STATUSBAR END //
  110. // LISTENERS
  111. %ctor {
  112. // prefs changed listener
  113. notificationCallback(NULL, NULL, NULL, NULL, NULL);
  114. CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), NULL, notificationCallback, (CFStringRef)nsNotificationString, NULL, CFNotificationSuspensionBehaviorCoalesce);
  115. // respring listener
  116. CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), NULL, (CFNotificationCallback)RespringDevice, CFSTR("com.yaypixxo.kage/respring"), NULL, CFNotificationSuspensionBehaviorDeliverImmediately);
  117. }