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.

Tweak.x 11KB

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