hide/show/change stuff on the LS and HS
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.

292 satır
8.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. // 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 BOOL hideLabels;
  23. static BOOL hideCarPlayLabels;
  24. static BOOL hideFolderBadges;
  25. //static BOOL hideStatusBarLS;
  26. static BOOL hideCCGrabber;
  27. static void notificationCallback(CFNotificationCenterRef center, void *observer, CFStringRef name, const void *object, CFDictionaryRef userInfo) {
  28. NSNumber *eEnabled = (NSNumber *)[[NSUserDefaults standardUserDefaults] objectForKey:@"enabled" inDomain:nsDomainString];
  29. NSNumber *eHideQuickActionsBG = (NSNumber *)[[NSUserDefaults standardUserDefaults] objectForKey:@"hideQuickActionsBG" inDomain:nsDomainString];
  30. NSNumber *eGridSwitcher = (NSNumber *)[[NSUserDefaults standardUserDefaults] objectForKey:@"gridSwitcher" inDomain:nsDomainString];
  31. NSNumber *eHideLSBatt = (NSNumber *)[[NSUserDefaults standardUserDefaults] objectForKey:@"hideLSBatt" inDomain:nsDomainString];
  32. NSNumber *eStatusBarShowTimeLS = (NSNumber *)[[NSUserDefaults standardUserDefaults] objectForKey:@"statusBarShowTimeLS" inDomain:nsDomainString];
  33. NSNumber *eHideLabels = (NSNumber *)[[NSUserDefaults standardUserDefaults] objectForKey:@"hideLabels" inDomain:nsDomainString];
  34. NSNumber *eHideCarPlayLabels = (NSNumber *)[[NSUserDefaults standardUserDefaults] objectForKey:@"hideCarPlayLabels" inDomain:nsDomainString];
  35. NSNumber *eHideFolderBadges = (NSNumber *)[[NSUserDefaults standardUserDefaults] objectForKey:@"hideFolderBadges" inDomain:nsDomainString];
  36. //NSNumber *eHideStatusBarLS = (NSNumber *)[[NSUserDefaults standardUserDefaults] objectForKey:@"hideStatusBarLS" inDomain:nsDomainString];
  37. NSNumber *eHideCCGrabber = (NSNumber *)[[NSUserDefaults standardUserDefaults] objectForKey:@"hideCCGrabber" inDomain:nsDomainString];
  38. enabled = (eEnabled) ? [eEnabled boolValue]:NO;
  39. hideQuickActionsBG = (eHideQuickActionsBG) ? [eHideQuickActionsBG boolValue]:NO;
  40. gridSwitcher = (eGridSwitcher) ? [eGridSwitcher boolValue]:NO;
  41. hideLSBatt = (eHideLSBatt) ? [eHideLSBatt boolValue]:NO;
  42. statusBarShowTimeLS = (eStatusBarShowTimeLS) ? [eStatusBarShowTimeLS boolValue]:NO;
  43. hideLabels = (eHideLabels) ? [eHideLabels boolValue]:NO;
  44. hideCarPlayLabels = (eHideCarPlayLabels) ? [eHideCarPlayLabels boolValue]:NO;
  45. hideFolderBadges = (eHideFolderBadges) ? [eHideFolderBadges boolValue]:NO;
  46. //hideStatusBarLS = (eHideStatusBarLS) ? [eHideStatusBarLS boolValue]:NO;
  47. hideCCGrabber = (eHideCCGrabber) ? [eHideCCGrabber boolValue]:NO;
  48. }
  49. // headers and hooks
  50. #import <UIKit/UIKit.h>
  51. @interface SBIconView : UIView
  52. -(void)setLabelHidden:(BOOL)hidden;
  53. @end
  54. @interface SBIcon : NSObject
  55. -(id)badgeNumberOrString;
  56. @end
  57. @interface CSTeachableMomentsContainerView {
  58. }
  59. @property (nonatomic,retain) UIView * controlCenterGrabberView;
  60. @end
  61. @interface SBDashBoardTeachableMomentsContainerView {
  62. }
  63. @property (nonatomic,retain) UIView * controlCenterGrabberView;
  64. @end
  65. #ifndef kCFCoreFoundationVersionNumber_iOS_13_0
  66. #define kCFCoreFoundationVersionNumber_iOS_13_0 1665.15
  67. #endif
  68. #define kSLSystemVersioniOS13 kCFCoreFoundationVersionNumber >= kCFCoreFoundationVersionNumber_iOS_13_0
  69. %group universal
  70. // QUICK ACTIONS BG START //
  71. %hook UICoverSheetButton
  72. -(id)_backgroundEffectsWithBrightness:(double)arg1 {
  73. if (enabled && hideQuickActionsBG) {
  74. return 0;
  75. }
  76. else {
  77. return %orig;
  78. }
  79. }
  80. %end
  81. // QUICK ACTIONS BG END //
  82. // HIDE FOLDER BADGE TEXT START //
  83. %hook SBIcon
  84. -(id)badgeNumberOrString {
  85. if (enabled && hideFolderBadges) {
  86. return @"";
  87. }
  88. else {
  89. return %orig;
  90. }
  91. }
  92. %end
  93. // HIDE FOLDER BADGE TEXT END //
  94. // HIDE LABELS START //
  95. %hook SBIconView
  96. -(void)setLabelHidden:(BOOL)hidden {
  97. if (enabled && hideLabels) {
  98. hidden = YES;
  99. }
  100. %orig;
  101. }
  102. %end
  103. // HIDE LABELS END //
  104. // GRID SWITCHER START //
  105. %hook SBAppSwitcherSettings
  106. - (void)setGridSwitcherPageScale:(double)arg1 {
  107. if (enabled && gridSwitcher) {
  108. arg1 = 0.4;
  109. }
  110. %orig;
  111. }
  112. - (void)setGridSwitcherHorizontalInterpageSpacingPortrait:(double)arg1 {
  113. if (enabled && gridSwitcher) {
  114. arg1 = 25.5;
  115. }
  116. %orig;
  117. }
  118. - (void)setGridSwitcherHorizontalInterpageSpacingLandscape:(double)arg1 {
  119. if (enabled && gridSwitcher) {
  120. arg1 = 11.6;
  121. }
  122. %orig;
  123. }
  124. - (void)setGridSwitcherVerticalNaturalSpacingPortrait:(double)arg1 {
  125. if (enabled && gridSwitcher) {
  126. arg1 = 42;
  127. }
  128. %orig;
  129. }
  130. - (void)setGridSwitcherVerticalNaturalSpacingLandscape:(double)arg1 {
  131. if (enabled && gridSwitcher) {
  132. arg1 = 38;
  133. }
  134. %orig;
  135. }
  136. - (void)setSwitcherStyle:(long long)arg1 {
  137. if (enabled && gridSwitcher) {
  138. arg1 = 2;
  139. }
  140. %orig;
  141. }
  142. %end
  143. // GRID SWITCHER END //
  144. // NO LS BATTERY START //
  145. %hook CSCoverSheetViewController
  146. - (void)_transitionChargingViewToVisible:(bool)arg1 showBattery:(bool)arg2 animated:(bool)arg3 {
  147. if (enabled && hideLSBatt) {
  148. arg1 = 0;
  149. }
  150. %orig;
  151. }
  152. %end
  153. // NO LS BATTERY END //
  154. %end // end universal group
  155. // stuff that only works on iOS 13
  156. %group ios13
  157. // SHOW TIME IN LS STATUSBAR START //
  158. %hook CSCoverSheetViewController
  159. - (bool)shouldShowLockStatusBarTime {
  160. if (enabled && statusBarShowTimeLS) {
  161. return YES;
  162. }
  163. else {
  164. return %orig;
  165. }
  166. }
  167. %end
  168. // SHOW TIME IN LS STATUSBAR END //
  169. // HIDE CC GRABBER START //
  170. %hook CSTeachableMomentsContainerView
  171. - (void)layoutSubviews {
  172. if (enabled && hideCCGrabber) {
  173. [self.controlCenterGrabberView setHidden:YES];
  174. }
  175. else {
  176. [self.controlCenterGrabberView setHidden:NO];
  177. }
  178. return %orig;
  179. }
  180. %end
  181. // HIDE CC GRABBER END //
  182. // HIDE CARPLAY LABELS START //
  183. %hook CARIconView
  184. +(CGSize)maxLabelSizeForIconImageSize:(CGSize)imageSize {
  185. if (enabled && hideCarPlayLabels) {
  186. return CGSizeZero;
  187. }
  188. else {
  189. return %orig;
  190. }
  191. }
  192. %end
  193. // HIDE CARPLAY LABELS END //
  194. %end // end ios13 group
  195. // stuff that only works on iOS 12
  196. %group ios12
  197. // SHOW TIME IN LS STATUSBAR START //
  198. %hook SBLockScreenViewControllerBase
  199. - (bool)shouldShowLockStatusBarTime {
  200. if (enabled && statusBarShowTimeLS) {
  201. return YES;
  202. }
  203. else {
  204. return %orig;
  205. }
  206. }
  207. %end
  208. // SHOW TIME IN LS STATUSBAR END //
  209. // HIDE CC GRABBER START //
  210. %hook SBDashBoardTeachableMomentsContainerView
  211. - (void)layoutSubviews {
  212. if (enabled && hideCCGrabber) {
  213. [self.controlCenterGrabberView setHidden:YES];
  214. }
  215. else {
  216. [self.controlCenterGrabberView setHidden:NO];
  217. }
  218. return %orig;
  219. }
  220. %end
  221. // HIDE CC GRABBER END //
  222. // HIDE CARPLAY LABELS START //
  223. %hook SBStarkIconView
  224. +(CGSize)maxLabelSize {
  225. if (enabled && hideCarPlayLabels) {
  226. return CGSizeZero;
  227. }
  228. else {
  229. return %orig;
  230. }
  231. }
  232. %end
  233. // HIDE CARPLAY LABELS END //
  234. %end // end ios12 group
  235. // LISTENERS
  236. %ctor {
  237. %init(universal);
  238. // check iOS version
  239. if (kSLSystemVersioniOS13) {
  240. %init(ios13);
  241. }
  242. else {
  243. %init(ios12);
  244. }
  245. // prefs changed listener
  246. notificationCallback(NULL, NULL, NULL, NULL, NULL);
  247. CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), NULL, notificationCallback, (CFStringRef)nsNotificationString, NULL, CFNotificationSuspensionBehaviorCoalesce);
  248. // respring listener
  249. CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), NULL, (CFNotificationCallback)RespringDevice, CFSTR("com.yaypixxo.kage/respring"), NULL, CFNotificationSuspensionBehaviorDeliverImmediately);
  250. }