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

Dockify.x 4.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  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. }