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.

132 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. // QUICK ACTIONS BG END //
  46. // GRID SWITCHER START //
  47. %hook SBAppSwitcherSettings
  48. - (void)setGridSwitcherPageScale:(double)arg1 {
  49. if (enabled && gridSwitcher) {
  50. arg1 = 0.4;
  51. }
  52. %orig;
  53. }
  54. - (void)setGridSwitcherHorizontalInterpageSpacingPortrait:(double)arg1 {
  55. if (enabled && gridSwitcher) {
  56. arg1 = 25.5;
  57. }
  58. %orig;
  59. }
  60. - (void)setGridSwitcherHorizontalInterpageSpacingLandscape:(double)arg1 {
  61. if (enabled && gridSwitcher) {
  62. arg1 = 11.6;
  63. }
  64. %orig;
  65. }
  66. - (void)setGridSwitcherVerticalNaturalSpacingPortrait:(double)arg1 {
  67. if (enabled && gridSwitcher) {
  68. arg1 = 42;
  69. }
  70. %orig;
  71. }
  72. - (void)setGridSwitcherVerticalNaturalSpacingLandscape:(double)arg1 {
  73. if (enabled && gridSwitcher) {
  74. arg1 = 38;
  75. }
  76. %orig;
  77. }
  78. - (void)setSwitcherStyle:(long long)arg1 {
  79. if (enabled && gridSwitcher) {
  80. arg1 = 2;
  81. }
  82. %orig;
  83. }
  84. %end
  85. // GRID SWITCHER END //
  86. // NO LS BATTERY START //
  87. %hook CSCoverSheetViewController
  88. - (void)_transitionChargingViewToVisible:(bool)arg1 showBattery:(bool)arg2 animated:(bool)arg3 {
  89. if (enabled && hideLSBatt) {
  90. arg1 = 0;
  91. }
  92. %orig;
  93. }
  94. %end
  95. // NO LS BATTERY END //
  96. // SHOW TIME IN LS STATUSBAR START //
  97. %hook CSCoverSheetViewController
  98. - (bool)shouldShowLockStatusBarTime {
  99. if (enabled && statusBarShowTimeLS) {
  100. return 1;
  101. }
  102. else {
  103. return %orig;
  104. }
  105. }
  106. %end
  107. // SHOW TIME IN LS STATUSBAR END //
  108. %ctor {
  109. // prefs changed listener
  110. notificationCallback(NULL, NULL, NULL, NULL, NULL);
  111. CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), NULL, notificationCallback, (CFStringRef)nsNotificationString, NULL, CFNotificationSuspensionBehaviorCoalesce);
  112. // respring listener
  113. CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), NULL, (CFNotificationCallback)RespringDevice, CFSTR("com.yaypixxo.kage/respring"), NULL, CFNotificationSuspensionBehaviorDeliverImmediately);
  114. }