hide/show/change stuff on the LS and HS https://github.com/viggou/Kage
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

4 anni fa
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  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 hide3dDivs;
  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 *eHide3dDivs = (NSNumber *)[[NSUserDefaults standardUserDefaults] objectForKey:@"hide3dDivs" 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. hide3dDivs = (eHide3dDivs) ? [eHide3dDivs 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. // 3D TOUCH DIVS START //
  36. %hook SBUIActionKeylineView
  37. - (void)didMoveToSuperview {
  38. if (enabled && hide3dDivs) {
  39. }
  40. else {
  41. %orig;
  42. }
  43. }
  44. %end
  45. %hook _UIInterfaceActionBlankSeparatorView
  46. - (void)setConstantAxisDimension:(double)arg1 {
  47. if (enabled && hide3dDivs) {
  48. }
  49. else {
  50. %orig;
  51. }
  52. }
  53. %end
  54. // 3D TOUCH DIVS END //
  55. // GRID SWITCHER START //
  56. %hook SBAppSwitcherSettings
  57. - (void)setGridSwitcherPageScale:(double)arg1 {
  58. if (enabled && gridSwitcher) {
  59. arg1 = 0.4;
  60. }
  61. %orig;
  62. }
  63. - (void)setGridSwitcherHorizontalInterpageSpacingPortrait:(double)arg1 {
  64. if (enabled && gridSwitcher) {
  65. arg1 = 25.5;
  66. }
  67. %orig;
  68. }
  69. - (void)setGridSwitcherHorizontalInterpageSpacingLandscape:(double)arg1 {
  70. if (enabled && gridSwitcher) {
  71. arg1 = 11.6;
  72. }
  73. %orig;
  74. }
  75. - (void)setGridSwitcherVerticalNaturalSpacingPortrait:(double)arg1 {
  76. if (enabled && gridSwitcher) {
  77. arg1 = 42;
  78. }
  79. %orig;
  80. }
  81. - (void)setGridSwitcherVerticalNaturalSpacingLandscape:(double)arg1 {
  82. if (enabled && gridSwitcher) {
  83. arg1 = 38;
  84. }
  85. %orig;
  86. }
  87. - (void)setSwitcherStyle:(long long)arg1 {
  88. if (enabled && gridSwitcher) {
  89. arg1 = 2;
  90. }
  91. %orig;
  92. }
  93. %end
  94. // GRID SWITCHER END //
  95. // NO LS BATTERY START //
  96. %hook CSCoverSheetViewController
  97. - (void)_transitionChargingViewToVisible:(bool)arg1 showBattery:(bool)arg2 animated:(bool)arg3 {
  98. if (enabled && hideLSBatt) {
  99. arg1 = 0;
  100. }
  101. %orig;
  102. }
  103. %end
  104. // NO LS BATTERY END //
  105. // SHOW TIME IN LS STATUSBAR START //
  106. %hook CSCoverSheetViewController
  107. - (bool)shouldShowLockStatusBarTime {
  108. if (enabled && statusBarShowTimeLS) {
  109. return 1;
  110. }
  111. else {
  112. return %orig;
  113. }
  114. }
  115. %end
  116. // SHOW TIME IN LS STATUSBAR END //
  117. %ctor {
  118. // prefs changed listener
  119. notificationCallback(NULL, NULL, NULL, NULL, NULL);
  120. CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), NULL, notificationCallback, (CFStringRef)nsNotificationString, NULL, CFNotificationSuspensionBehaviorCoalesce);
  121. // respring listener
  122. CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), NULL, (CFNotificationCallback)RespringDevice, CFSTR("com.yaypixxo.kage/respring"), NULL, CFNotificationSuspensionBehaviorDeliverImmediately);
  123. }