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.

4 jaren geleden
4 jaren geleden
4 jaren geleden
4 jaren geleden
4 jaren geleden
4 jaren geleden
4 jaren geleden
4 jaren geleden
4 jaren geleden
4 jaren geleden
4 jaren geleden
4 jaren geleden
4 jaren geleden
4 jaren geleden
4 jaren geleden
4 jaren geleden
4 jaren geleden
4 jaren geleden
4 jaren geleden
4 jaren geleden
4 jaren geleden
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432
  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 hideFolderTitle;
  26. static BOOL hideFolderBG;
  27. static BOOL hideFolderBGSB;
  28. static BOOL hideFolderDots;
  29. static BOOL hideNoOlderNotifs;
  30. //static BOOL hideStatusBarLS;
  31. static BOOL hideCCGrabber;
  32. static void notificationCallback(CFNotificationCenterRef center, void *observer, CFStringRef name, const void *object, CFDictionaryRef userInfo) {
  33. NSNumber *eEnabled = (NSNumber *)[[NSUserDefaults standardUserDefaults] objectForKey:@"enabled" inDomain:nsDomainString];
  34. NSNumber *eHideQuickActionsBG = (NSNumber *)[[NSUserDefaults standardUserDefaults] objectForKey:@"hideQuickActionsBG" inDomain:nsDomainString];
  35. NSNumber *eGridSwitcher = (NSNumber *)[[NSUserDefaults standardUserDefaults] objectForKey:@"gridSwitcher" inDomain:nsDomainString];
  36. NSNumber *eHideLSBatt = (NSNumber *)[[NSUserDefaults standardUserDefaults] objectForKey:@"hideLSBatt" inDomain:nsDomainString];
  37. NSNumber *eStatusBarShowTimeLS = (NSNumber *)[[NSUserDefaults standardUserDefaults] objectForKey:@"statusBarShowTimeLS" inDomain:nsDomainString];
  38. NSNumber *eHideLabels = (NSNumber *)[[NSUserDefaults standardUserDefaults] objectForKey:@"hideLabels" inDomain:nsDomainString];
  39. NSNumber *eHideCarPlayLabels = (NSNumber *)[[NSUserDefaults standardUserDefaults] objectForKey:@"hideCarPlayLabels" inDomain:nsDomainString];
  40. NSNumber *eHideFolderBadges = (NSNumber *)[[NSUserDefaults standardUserDefaults] objectForKey:@"hideFolderBadges" inDomain:nsDomainString];
  41. NSNumber *eHideFolderTitle = (NSNumber *)[[NSUserDefaults standardUserDefaults] objectForKey:@"hideFolderTitle" inDomain:nsDomainString];
  42. NSNumber *eHideFolderBG = (NSNumber *)[[NSUserDefaults standardUserDefaults] objectForKey:@"hideFolderBG" inDomain:nsDomainString];
  43. NSNumber *eHideFolderBGSB = (NSNumber *)[[NSUserDefaults standardUserDefaults] objectForKey:@"hideFolderBGSB" inDomain:nsDomainString];
  44. NSNumber *eHideFolderDots = (NSNumber *)[[NSUserDefaults standardUserDefaults] objectForKey:@"hideFolderDots" inDomain:nsDomainString];
  45. NSNumber *eHideNoOlderNotifs = (NSNumber *)[[NSUserDefaults standardUserDefaults] objectForKey:@"hideNoOlderNotifs" inDomain:nsDomainString];
  46. //NSNumber *eHideStatusBarLS = (NSNumber *)[[NSUserDefaults standardUserDefaults] objectForKey:@"hideStatusBarLS" inDomain:nsDomainString];
  47. NSNumber *eHideCCGrabber = (NSNumber *)[[NSUserDefaults standardUserDefaults] objectForKey:@"hideCCGrabber" inDomain:nsDomainString];
  48. enabled = (eEnabled) ? [eEnabled boolValue]:NO;
  49. hideQuickActionsBG = (eHideQuickActionsBG) ? [eHideQuickActionsBG boolValue]:NO;
  50. gridSwitcher = (eGridSwitcher) ? [eGridSwitcher boolValue]:NO;
  51. hideLSBatt = (eHideLSBatt) ? [eHideLSBatt boolValue]:NO;
  52. statusBarShowTimeLS = (eStatusBarShowTimeLS) ? [eStatusBarShowTimeLS boolValue]:NO;
  53. hideLabels = (eHideLabels) ? [eHideLabels boolValue]:NO;
  54. hideCarPlayLabels = (eHideCarPlayLabels) ? [eHideCarPlayLabels boolValue]:NO;
  55. hideFolderBadges = (eHideFolderBadges) ? [eHideFolderBadges boolValue]:NO;
  56. hideFolderTitle = (eHideFolderTitle) ? [eHideFolderTitle boolValue]:NO;
  57. hideFolderBG = (eHideFolderBG) ? [eHideFolderBG boolValue]:NO;
  58. hideFolderBGSB = (eHideFolderBGSB) ? [eHideFolderBGSB boolValue]:NO;
  59. hideFolderDots = (eHideFolderDots) ? [eHideFolderDots boolValue]:NO;
  60. hideNoOlderNotifs = (eHideNoOlderNotifs) ? [eHideNoOlderNotifs boolValue]:NO;
  61. //hideStatusBarLS = (eHideStatusBarLS) ? [eHideStatusBarLS boolValue]:NO;
  62. hideCCGrabber = (eHideCCGrabber) ? [eHideCCGrabber boolValue]:NO;
  63. }
  64. // headers and hooks
  65. #import <UIKit/UIKit.h>
  66. /*@interface SBFolderView : UIView
  67. @end*/
  68. @interface SBIconView : UIView
  69. -(void)setLabelHidden:(BOOL)hidden;
  70. @end
  71. @interface SBIcon : NSObject
  72. -(id)badgeNumberOrString;
  73. @end
  74. @interface CSTeachableMomentsContainerView
  75. @property (nonatomic,retain) UIView * controlCenterGrabberView;
  76. @end
  77. @interface SBDashBoardTeachableMomentsContainerView
  78. @property (nonatomic,retain) UIView * controlCenterGrabberView;
  79. @end
  80. @interface SBFolderIconImageView : UIView
  81. @property (nonatomic, retain) UIView *backgroundView;
  82. @end
  83. @interface SBIconListPageControl
  84. @property (nonatomic, assign, readwrite, getter=isHidden) BOOL hidden;
  85. @end
  86. @interface SBIconController : NSObject
  87. +(id)sharedInstance;
  88. -(void)_closeFolderController:(id)arg1 animated:(BOOL)arg2 withCompletion:(id)arg3;
  89. @end
  90. @interface SBUILegibilityLabel : UIView
  91. @property (nonatomic,copy) NSString *string;
  92. @end
  93. @interface NCNotificationListSectionRevealHintView : UIView
  94. @property (nonatomic,retain)SBUILegibilityLabel *revealHintTitle;
  95. @end
  96. /*@interface SBFloatyFolderView : SBFolderView
  97. -(void)_handleOutsideTap:(id)arg1 ;
  98. @end
  99. @interface SBFolderController : UIViewController
  100. @property (nonatomic,readonly) UIView * containerView;
  101. @end
  102. @interface SBFloatyFolderScrollView : UIScrollView
  103. -(void)closeFolder:(id)selector;
  104. -(id)_viewControllerForAncestor;
  105. @end*/
  106. #ifndef kCFCoreFoundationVersionNumber_iOS_13_0
  107. #define kCFCoreFoundationVersionNumber_iOS_13_0 1665.15
  108. #endif
  109. #define kSLSystemVersioniOS13 kCFCoreFoundationVersionNumber >= kCFCoreFoundationVersionNumber_iOS_13_0
  110. %group universal
  111. // HIDE NO OLDER NOTIFICATIONS START //
  112. %hook NCNotificationListSectionRevealHintView
  113. -(void)didMoveToWindow {
  114. %orig;
  115. if (enabled && hideNoOlderNotifs) {
  116. self.revealHintTitle.string = @"";
  117. }
  118. }
  119. %end
  120. // HIDE NO OLDER NOTIFICATIONS END //
  121. // QUICK ACTIONS BG START //
  122. %hook UICoverSheetButton
  123. -(id)_backgroundEffectsWithBrightness:(double)arg1 {
  124. if (enabled && hideQuickActionsBG) {
  125. return 0;
  126. }
  127. else {
  128. return %orig;
  129. }
  130. }
  131. %end
  132. // QUICK ACTIONS BG END //
  133. // HIDE FOLDER BADGE TEXT START //
  134. %hook SBIcon
  135. -(id)badgeNumberOrString {
  136. if (enabled && hideFolderBadges) {
  137. return @"";
  138. }
  139. else {
  140. return %orig;
  141. }
  142. }
  143. %end
  144. // HIDE FOLDER BADGE TEXT END //
  145. // HIDE LABELS START //
  146. %hook SBIconView
  147. -(void)setLabelHidden:(BOOL)hidden {
  148. if (enabled && hideLabels) {
  149. hidden = YES;
  150. }
  151. %orig;
  152. }
  153. %end
  154. // HIDE LABELS END //
  155. // GRID SWITCHER START //
  156. %hook SBAppSwitcherSettings
  157. - (void)setGridSwitcherPageScale:(double)arg1 {
  158. if (enabled && gridSwitcher) {
  159. arg1 = 0.4;
  160. }
  161. %orig;
  162. }
  163. - (void)setGridSwitcherHorizontalInterpageSpacingPortrait:(double)arg1 {
  164. if (enabled && gridSwitcher) {
  165. arg1 = 25.5;
  166. }
  167. %orig;
  168. }
  169. - (void)setGridSwitcherHorizontalInterpageSpacingLandscape:(double)arg1 {
  170. if (enabled && gridSwitcher) {
  171. arg1 = 11.6;
  172. }
  173. %orig;
  174. }
  175. - (void)setGridSwitcherVerticalNaturalSpacingPortrait:(double)arg1 {
  176. if (enabled && gridSwitcher) {
  177. arg1 = 42;
  178. }
  179. %orig;
  180. }
  181. - (void)setGridSwitcherVerticalNaturalSpacingLandscape:(double)arg1 {
  182. if (enabled && gridSwitcher) {
  183. arg1 = 38;
  184. }
  185. %orig;
  186. }
  187. - (void)setSwitcherStyle:(long long)arg1 {
  188. if (enabled && gridSwitcher) {
  189. arg1 = 2;
  190. }
  191. %orig;
  192. }
  193. %end
  194. // GRID SWITCHER END //
  195. // NO LS BATTERY START //
  196. %hook CSCoverSheetViewController
  197. - (void)_transitionChargingViewToVisible:(bool)arg1 showBattery:(bool)arg2 animated:(bool)arg3 {
  198. if (enabled && hideLSBatt) {
  199. arg1 = 0;
  200. }
  201. %orig;
  202. }
  203. %end
  204. // NO LS BATTERY END //
  205. // SHOW FOLDER TITLE START //
  206. %hook SBFloatyFolderView
  207. -(BOOL)_showsTitle {
  208. if (enabled && hideFolderTitle) {
  209. return NO;
  210. }
  211. else {
  212. return %orig;
  213. }
  214. }
  215. %end
  216. // SHOW FOLDER TITLE END //
  217. // HIDE FOLDER BACKGROUND START //
  218. %hook SBFloatyFolderView
  219. -(void)setBackgroundAlpha:(CGFloat)arg1 {
  220. if (enabled && hideFolderBG) {
  221. %orig(0.0);
  222. }
  223. else {
  224. %orig;
  225. }
  226. }
  227. %end
  228. %hook SBFolderIconImageView
  229. -(void)layoutSubviews {
  230. %orig;
  231. if (enabled && hideFolderBGSB) {
  232. self.backgroundView.alpha = 0;
  233. self.backgroundView.hidden = 1;
  234. }
  235. }
  236. %end
  237. // Close folder when tapped inside
  238. /*%hook SBFloatyFolderScrollView
  239. -(SBFloatyFolderScrollView *)initWithFrame:(CGRect)frame {
  240. if (enabled && hideFolderBG) {
  241. SBFloatyFolderScrollView *yeet = %orig;
  242. UITapGestureRecognizer *closeGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(closeFolder)];
  243. [yeet addGestureRecognizer:closeGesture];
  244. return yeet;
  245. }
  246. else {
  247. return %orig;
  248. }
  249. }
  250. %new
  251. -(void)closeFolder:(id)sender {
  252. UIViewController *parentController = [self _viewControllerForAncestor];
  253. if ([parentController isKindOfClass:[objc_getClass("SBFolderController") class]]) {
  254. SBFolderController *sbfc = (SBFolderController *)parentController;
  255. if (sbfc && [sbfc.containerView isKindOfClass:[objc_getClass("SBFloatyFolderView") class]]) {
  256. [(SBFloatyFolderView *)sbfc.containerView _handleOutsideTap:nil];
  257. }
  258. }
  259. }
  260. %end*/
  261. // HIDE FOLDER BACKGROUND END //
  262. // HIDE FOLDER DOTS START //
  263. %hook SBIconListPageControl
  264. -(void)layoutSubviews {
  265. if (enabled && hideFolderDots) {
  266. self.hidden = YES;
  267. }
  268. else {
  269. %orig;
  270. }
  271. }
  272. %end
  273. // HIDE FOLDER DOTS END //
  274. %end // end universal group
  275. // stuff that only works on iOS 13
  276. %group ios13
  277. // SHOW TIME IN LS STATUSBAR START //
  278. %hook CSCoverSheetViewController
  279. - (bool)shouldShowLockStatusBarTime {
  280. if (enabled && statusBarShowTimeLS) {
  281. return YES;
  282. }
  283. else {
  284. return %orig;
  285. }
  286. }
  287. %end
  288. // SHOW TIME IN LS STATUSBAR END //
  289. // HIDE CC GRABBER START //
  290. %hook CSTeachableMomentsContainerView
  291. - (void)layoutSubviews {
  292. if (enabled && hideCCGrabber) {
  293. [self.controlCenterGrabberView setHidden:YES];
  294. }
  295. else {
  296. [self.controlCenterGrabberView setHidden:NO];
  297. }
  298. return %orig;
  299. }
  300. %end
  301. // HIDE CC GRABBER END //
  302. // HIDE CARPLAY LABELS START //
  303. %hook CARIconView
  304. +(CGSize)maxLabelSizeForIconImageSize:(CGSize)imageSize {
  305. if (enabled && hideCarPlayLabels) {
  306. return CGSizeZero;
  307. }
  308. else {
  309. return %orig;
  310. }
  311. }
  312. %end
  313. // HIDE CARPLAY LABELS END //
  314. %end // end ios13 group
  315. // stuff that only works on iOS 12
  316. %group ios12
  317. // SHOW TIME IN LS STATUSBAR START //
  318. %hook SBLockScreenViewControllerBase
  319. - (bool)shouldShowLockStatusBarTime {
  320. if (enabled && statusBarShowTimeLS) {
  321. return YES;
  322. }
  323. else {
  324. return %orig;
  325. }
  326. }
  327. %end
  328. // SHOW TIME IN LS STATUSBAR END //
  329. // HIDE CC GRABBER START //
  330. %hook SBDashBoardTeachableMomentsContainerView
  331. - (void)layoutSubviews {
  332. if (enabled && hideCCGrabber) {
  333. [self.controlCenterGrabberView setHidden:YES];
  334. }
  335. else {
  336. [self.controlCenterGrabberView setHidden:NO];
  337. }
  338. return %orig;
  339. }
  340. %end
  341. // HIDE CC GRABBER END //
  342. // HIDE CARPLAY LABELS START //
  343. %hook SBStarkIconView
  344. +(CGSize)maxLabelSize {
  345. if (enabled && hideCarPlayLabels) {
  346. return CGSizeZero;
  347. }
  348. else {
  349. return %orig;
  350. }
  351. }
  352. %end
  353. // HIDE CARPLAY LABELS END //
  354. %end // end ios12 group
  355. // LISTENERS
  356. %ctor {
  357. %init(universal);
  358. // check iOS version
  359. if (kSLSystemVersioniOS13) {
  360. %init(ios13);
  361. }
  362. else {
  363. %init(ios12);
  364. }
  365. // prefs changed listener
  366. notificationCallback(NULL, NULL, NULL, NULL, NULL);
  367. CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), NULL, notificationCallback, (CFStringRef)nsNotificationString, NULL, CFNotificationSuspensionBehaviorCoalesce);
  368. // respring listener
  369. CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), NULL, (CFNotificationCallback)RespringDevice, CFSTR("com.yaypixxo.kage/respring"), NULL, CFNotificationSuspensionBehaviorDeliverImmediately);
  370. }