The source code, duh.
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.

153 lines
4.9KB

  1. #import <Cephei/HBPreferences.h>
  2. @interface SBCoverSheetPrimarySlidingViewController : UIViewController
  3. - (void)viewDidDisappear:(BOOL)arg1;
  4. - (void)viewDidAppear:(BOOL)arg1;
  5. @end
  6. //Set up variables for use with Cephei
  7. static BOOL transparent;
  8. static BOOL hidden;
  9. static double setHeight;
  10. static double customOpacity;
  11. static NSInteger setIconNumber;
  12. //nepeta like drm
  13. BOOL dpkgInvalid = NO;
  14. //static NSInteger setDockRowNumber;
  15. //static CGFloat setRowSpacing;
  16. HBPreferences *preferences;
  17. %hook SBCoverSheetPrimarySlidingViewController
  18. - (void)viewDidDisappear:(BOOL)arg1 {
  19. %orig; // Thanks to Nepeta for the DRM
  20. if (!dpkgInvalid) return;
  21. UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"Pirate Detected!"
  22. message:@"Seriously? Pirating a free Tweak is awful!\nPiracy repo's Tweaks could contain Malware if you didn't know that, so go ahead and get Dockify from the official Source https://Burrit0z.github.io/repo/.\nIf you're seeing this but you got it from the official source then make sure to add https://Burrit0z.github.io/repo to Cydia or Sileo."
  23. preferredStyle:UIAlertControllerStyleAlert];
  24. UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"Aww man" style:UIAlertActionStyleDestructive handler:^(UIAlertAction * action) {
  25. UIApplication *application = [UIApplication sharedApplication];
  26. [application openURL:[NSURL URLWithString:@"https://Burrit0z.github.io/repo"] options:@{} completionHandler:nil];
  27. }];
  28. [alertController addAction:cancelAction];
  29. [self presentViewController:alertController animated:YES completion:nil];
  30. }
  31. %end
  32. //hook the dock
  33. %hook SBDockView
  34. //this deals with everything adjusting opacity/transparency
  35. //ios 12 and 13
  36. -(void)setBackgroundAlpha:(double)arg1 {
  37. if (transparent == NO && hidden == NO) { //if not transparent and not hidden
  38. %orig(customOpacity);
  39. }else if (transparent || hidden) { // Note: || means or in objc
  40. %orig(0.0); //hides background of the dock (transparent)
  41. } else {
  42. NSLog(@"Dock not Transparent/hidden, no custom opacity\n");
  43. }
  44. }
  45. //ios 13
  46. -(double)defaultHeight {
  47. if (hidden) {
  48. return (0);
  49. } else {
  50. return (%orig*setHeight); //sets custom height if dock is not set to hidden
  51. }
  52. }
  53. //ios 12
  54. -(double)dockHeight {
  55. if (hidden) {
  56. return (0);
  57. } else {
  58. return (%orig*setHeight); //sets custom height if dock is not set to hidden
  59. }
  60. }
  61. %end
  62. //NEW HOOK FOR ICON STATE
  63. %hook SBDockIconListView
  64. //ios 12 required piece
  65. +(NSInteger)maxIcons {
  66. if (hidden) {
  67. return (0);
  68. } else {
  69. return (setIconNumber);
  70. }
  71. }
  72. - (NSUInteger)iconColumnsForCurrentOrientation {
  73. if (hidden) {
  74. return (0);
  75. } else {
  76. NSInteger reg = %orig;
  77. return reg; //basically just returns the original value
  78. }
  79. }
  80. %end
  81. //ios 13
  82. %hook SBIconListGridLayoutConfiguration
  83. -(void)setNumberOfPortraitColumns:(unsigned long long)arg1 {
  84. if (setIconNumber == 4) {
  85. NSIntegr reg = %orig;
  86. %orig(reg);
  87. } else {
  88. %orig(setIconNumber);
  89. }
  90. }
  91. %end
  92. %hook SBIconListView
  93. //fix so it doesnt set all pages to 5 columns ios 13
  94. -(unsigned long long)iconColumnsForCurrentOrientation {
  95. return (4);
  96. }
  97. -(BOOL)automaticallyAdjustsLayoutMetricsToFit {
  98. return YES;
  99. }
  100. %end
  101. //fix for icons being off the page ios 13 and maybe 12
  102. %hook SBIconListFlowLayout
  103. - (NSUInteger)numberOfColumnsForOrientation:(NSInteger)arg1 {
  104. return (4);
  105. }
  106. %end
  107. //another fix for the folders ios12
  108. %hook SBFolderIconListView
  109. +(unsigned long long)iconColumnsForInterfaceOrientation:(long long)arg1 {
  110. return (4);
  111. }
  112. %end
  113. // Thanks to Nepeta for the DRM, and thanks to Sh0rtflow as well
  114. %ctor {
  115. dpkgInvalid = ![[NSFileManager defaultManager] fileExistsAtPath:@"/var/lib/dpkg/info/com.burritoz.dockify.list"];
  116. if (!dpkgInvalid) dpkgInvalid = ![[NSFileManager defaultManager] fileExistsAtPath:@"/var/lib/dpkg/info/com.burritoz.dockify.md5sums"];
  117. preferences = [[HBPreferences alloc] initWithIdentifier:@"com.burritoz.dockifyprefs"];
  118. [preferences registerDefaults:@ { //defaults for prefernces
  119. @"setHeight": @1,
  120. @"customOpacity": @1,
  121. @"hidden": @NO,
  122. @"setIconNumber": @4,
  123. // @"setRowSpacing": @0,
  124. }];
  125. [preferences registerBool:&transparent default:YES forKey:@"transparent"]; //registering transparent as a Boolean
  126. [preferences registerBool:&hidden default:NO forKey:@"hidden"]; //registering hidden as a Boolean
  127. [preferences registerDouble:(double *)&setHeight default:1 forKey:@"setHeight"]; //registering setHeigt as a double (number)
  128. [preferences registerDouble:(double *)&customOpacity default:1 forKey:@"customOpacity"]; //registering customOpacity as a double (number)
  129. [preferences registerInteger:(NSInteger *)&setIconNumber default:4 forKey:@"setIconNumber"]; //Integer of how many icons to allow
  130. // [preferences registerInteger:(NSInteger *)&setDockRowNumber default:1 forKey:@"setDockRowNumber"]; //Integer of how many dock rows to allow
  131. // [preferences registerFloat:(CGFloat *)&setRowSpacing default:0 forKey:@"setRowSpacing"]; //custom dock row spacing?
  132. }