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.

133 lines
4.0KB

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