Advertisement
Guest User

Untitled

a guest
Jul 13th, 2018
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. #import <UIKit/UIKit.h>
  3. #import "libcolorpicker.h"
  4. #define PLIST_PATH @"/var/mobile/Library/Preferences/com.rustybalboa.colormycc.plist"
  5. #define PLIST_PATH_COLORS @"/var/mobile/Library/Preferences/com.rustybalboa.colormycccolors.plist"
  6. #define prefsDict [NSDictionary dictionaryWithContentsOfFile:PLIST_PATH]
  7. #define prefsColorsDict [NSDictionary dictionaryWithContentsOfFile:PLIST_PATH_COLORS]
  8.  
  9. static NSString *ModuleColor = @"ModuleColor";
  10. static NSString *BluetoothColor = @"BluetoothColor";
  11. static NSString *AirplaneColor = @"AirplaneColor";
  12. static NSString *CellularColor = @"CellularColor";
  13. static NSString *WifiColor = @"WifiColor";
  14. static NSString *AirdropColor = @"AirdropColor";
  15. static NSString *HotspotColor = @"HotspotColor";
  16.  
  17. @interface CCUIRoundButton : UIView
  18. -(id)_viewControllerForAncestor;
  19. @end
  20. @interface CCUIScrollView : UIView
  21. @end
  22. @interface MTSystemModuleMaterialSettings : NSObject {
  23. }
  24. -(UIColor *)baseOverlayColor;
  25. @end
  26.  
  27. %hook CCUIScrollView
  28.  
  29. -(void)didMoveToWindow
  30. {
  31.     if ([[prefsDict valueForKey:@"bIsEnabled"] boolValue])
  32.     {
  33.         %orig;
  34.         UIColor *color = LCPParseColorString([prefsColorsDict objectForKey:@"backgroundColor"], @"#FF0000");
  35.         self.backgroundColor = color;
  36.     }
  37. }
  38.  
  39. %end
  40.  
  41. %hook MTSystemModuleMaterialSettings
  42. -(UIColor *)baseOverlayColor
  43. {
  44.     if ([[prefsDict valueForKey:@"mIsEnabled"] boolValue])
  45.     {
  46.         return LCPParseColorString([prefsColorsDict objectForKey:ModuleColor], @"#FF00FF");
  47.     }
  48.     return %orig;
  49. }
  50. %end
  51.  
  52.  
  53. %hook CCUIRoundButton
  54. -(void)layoutSubviews
  55. {
  56.     %orig;
  57.     for (UIView* subview in self.subviews)
  58.     {
  59.         if (![subview isMemberOfClass:[UIImageView class]] && ![subview isMemberOfClass:[objc_getClass("MTMaterialView") class]] && ![subview isMemberOfClass:[objc_getClass("CCUICAPackageView") class]])
  60.         {
  61.             if ([[prefsDict valueForKey:@"rIsEnabled"] boolValue])
  62.             {
  63.                 //this is the code for the bluetooth button (replace CCUIConnectivityBluetoothViewController with CCUIConnectivityAirplaneViewController for airplane mode etc.)
  64.                 if ([[self _viewControllerForAncestor] isMemberOfClass:[objc_getClass("CCUIConnectivityBluetoothViewController") class]])
  65.                 {
  66.                     [subview setBackgroundColor:LCPParseColorString([prefsColorsDict objectForKey:BluetoothColor], @"#FF0000")];
  67.                 }
  68.                 else if ([[self _viewControllerForAncestor] isMemberOfClass:[objc_getClass("CCUIConnectivityAirplaneViewController") class]])
  69.                 {
  70.                     [subview setBackgroundColor:LCPParseColorString([prefsColorsDict objectForKey:AirplaneColor], @"#FF0000")];
  71.                 }
  72.                 else if ([[self _viewControllerForAncestor] isMemberOfClass:[objc_getClass("CCUIConnectivityCellularDataViewController") class]])
  73.                 {
  74.                     [subview setBackgroundColor:LCPParseColorString([prefsColorsDict objectForKey:CellularColor], @"#FF0000")];
  75.                 }
  76.                 else if ([[self _viewControllerForAncestor] isMemberOfClass:[objc_getClass("CCUIConnectivityWifiViewController") class]])
  77.                 {
  78.                     [subview setBackgroundColor:LCPParseColorString([prefsColorsDict objectForKey:WifiColor], @"#FF0000")];
  79.                 }
  80.                 else if ([[self _viewControllerForAncestor] isMemberOfClass:[objc_getClass("CCUIConnectivityAirDropViewController") class]])
  81.                 {
  82.                     [subview setBackgroundColor:LCPParseColorString([prefsColorsDict objectForKey:AirdropColor], @"#FF0000")];
  83.                 }
  84.                 else if ([[self _viewControllerForAncestor] isMemberOfClass: [objc_getClass("CCUIConnectivityHotspotViewController") class]])
  85.                 {
  86.                     [subview setBackgroundColor:LCPParseColorString([prefsColorsDict objectForKey:HotspotColor], @"#FF0000")];
  87.                 }
  88.                 break;
  89.             }
  90.         }
  91.     }
  92.  
  93.     for (UIImageView* subview in self.subviews)
  94.     {
  95.         if ([[prefsDict valueForKey:@"gIsEnabled"] boolValue])
  96.         {
  97.             //this is the code for the bluetooth button (replace CCUIConnectivityBluetoothViewController with CCUIConnectivityAirplaneViewController for airplane mode etc.)
  98.             if ([[self _viewControllerForAncestor] isMemberOfClass:[objc_getClass("CCUIConnectivityBluetoothViewController") class]])
  99.             {
  100.                 [subview setTintColor:LCPParseColorString([prefsColorsDict objectForKey:@"BluetoothGlyphColor"], @"#FF0000")];
  101.             }
  102.             else if ([[self _viewControllerForAncestor] isMemberOfClass:[objc_getClass("CCUIConnectivityAirplaneViewController") class]])
  103.             {
  104.                 [subview setTintColor:LCPParseColorString([prefsColorsDict objectForKey:@"AirplaneGlyphColor"], @"#FF0000")];
  105.             }
  106.             else if ([[self _viewControllerForAncestor] isMemberOfClass:[objc_getClass("CCUIConnectivityCellularDataViewController") class]])
  107.             {
  108.                 [subview setTintColor:LCPParseColorString([prefsColorsDict objectForKey:@"CellularGlyphColor"], @"#FF0000")];
  109.             }
  110.             else if ([[self _viewControllerForAncestor] isMemberOfClass:[objc_getClass("CCUIConnectivityWifiViewController") class]])
  111.             {
  112.                 [subview setTintColor:LCPParseColorString([prefsColorsDict objectForKey:@"WifiGlyphColor"], @"#FF0000")];
  113.             }
  114.             else if ([[self _viewControllerForAncestor] isMemberOfClass:[objc_getClass("CCUIConnectivityAirDropViewController") class]])
  115.             {
  116.                 [subview setTintColor:LCPParseColorString([prefsColorsDict objectForKey:@"AirdropGlyphColor"], @"#FF0000")];
  117.             }
  118.             else if ([[self _viewControllerForAncestor] isMemberOfClass: [objc_getClass("CCUIConnectivityHotspotViewController") class]])
  119.             {
  120.                 [subview setTintColor:LCPParseColorString([prefsColorsDict objectForKey:@"HotspotGlyphColor"], @"#FF0000")];
  121.             }
  122.         }
  123.     }
  124. }
  125. %end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement