|
| 1 | +@interface CydiaLoadingViewController : UIViewController |
| 2 | +@end |
| 3 | + |
| 4 | +%hook CydiaLoadingViewController |
| 5 | +-(void)loadView { |
| 6 | +%orig; |
| 7 | +UIView *xiView = [[UIView alloc]initWithFrame:[UIScreen mainScreen].bounds]; |
| 8 | +xiView.backgroundColor = [UIColor colorWithRed:0.25 green:0.25 blue:0.25 alpha:1.0]; |
| 9 | +UIImageView *logo =[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"Logo.png"]]; |
| 10 | +logo.frame = CGRectMake([UIScreen mainScreen].bounds.size.width / 2 - 60, [UIScreen mainScreen].bounds.size.height / 2 - 90, 120, 120); |
| 11 | +logo.layer.masksToBounds = YES; |
| 12 | +logo.layer.cornerRadius = 10; |
| 13 | +UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, [UIScreen mainScreen].bounds.size.height / 2 + 60, [UIScreen mainScreen].bounds.size.width, 40)]; |
| 14 | +label.text = @"Cydia"; |
| 15 | +label.textAlignment = NSTextAlignmentCenter; |
| 16 | +label.textColor = [UIColor whiteColor]; |
| 17 | +[label setFont:[UIFont boldSystemFontOfSize:30]];\ |
| 18 | +[xiView addSubview:logo]; |
| 19 | +[xiView addSubview:label]; |
| 20 | +[[self view] addSubview:xiView]; |
| 21 | +} |
| 22 | +%end |
| 23 | + |
| 24 | + |
| 25 | +@interface HomeController : UIViewController |
| 26 | +-(void)setURL:(id)URL; |
| 27 | +-(void)reloadData; |
| 28 | +@end |
| 29 | + |
| 30 | +%hook HomeController |
| 31 | +#define cyHomeKitURLiPad @"/Applications/Cydia.app/CydiaXIdark.html" |
| 32 | +#define cyHomeKitURLiPhone @"/Applications/Cydia.app/CydiaXIdark.html" |
| 33 | + |
| 34 | +-(id)init { |
| 35 | + self.view.backgroundColor = [UIColor colorWithRed:0.25 green:0.25 blue:0.25 alpha:1.0]; |
| 36 | + NSString* htmlString = [NSString stringWithContentsOfFile:cyHomeKitURLiPhone encoding:NSUTF8StringEncoding error:nil]; |
| 37 | + [(UIWebView *)self.view loadHTMLString:htmlString baseURL:[NSURL URLWithString:cyHomeKitURLiPhone]]; |
| 38 | + return self; |
| 39 | +} |
| 40 | + |
| 41 | +-(UIStatusBarStyle)preferredStatusBarStyle { |
| 42 | + return UIStatusBarStyleLightContent; |
| 43 | +} |
| 44 | +%end |
| 45 | + |
| 46 | +@interface PackageCell : UITableViewCell |
| 47 | +@end |
| 48 | + |
| 49 | +@interface UITableViewCellContentView : UIView |
| 50 | +@end |
| 51 | + |
| 52 | +@interface CyteTableViewCellContentView : UIView |
| 53 | +@end |
| 54 | + |
| 55 | +extern "C" void UISetColor(CGColorRef color); |
| 56 | +%hook PackageCell |
| 57 | +- (void) setPackage:(id)package asSummary:(bool)summary { |
| 58 | + %orig; |
| 59 | + for (UITableViewCellContentView *uicell in self.subviews) { |
| 60 | + for (CyteTableViewCellContentView *cytecell in uicell.subviews) { |
| 61 | + |
| 62 | + if (NSString *mode = (NSString *)[package mode]) { |
| 63 | + if ([mode isEqualToString:@"REMOVE"] || [mode isEqualToString:@"PURGE"]) { |
| 64 | + [cytecell setBackgroundColor:[UIColor colorWithRed:0.6 green:0.30 blue:0.30 alpha:0.4]]; |
| 65 | + } else { |
| 66 | + [cytecell setBackgroundColor:[UIColor colorWithRed:0.30 green:0.6 blue:0.30 alpha:0.4]]; |
| 67 | + } |
| 68 | + } else { |
| 69 | + [cytecell setBackgroundColor:[UIColor colorWithRed:0.25 green:0.25 blue:0.25 alpha:1.0]]; |
| 70 | + } |
| 71 | + |
| 72 | + } |
| 73 | + } |
| 74 | + bool commercial_ = (bool)object_getIvar(self, class_getInstanceVariable([self class], "commercial_")); |
| 75 | + NSString* name_ = (NSString *)object_getIvar(self, class_getInstanceVariable([self class], "name_")); |
| 76 | + NSString* source_ = (NSString *)object_getIvar(self, class_getInstanceVariable([self class], "source_")); |
| 77 | + NSString* description_ = (NSString *)object_getIvar(self, class_getInstanceVariable([self class], "description_")); |
| 78 | + float width([self bounds].size.width); |
| 79 | + |
| 80 | + if (!commercial_) { |
| 81 | + UISetColor([UIColor colorWithRed:0.8 green:0.8 blue:0.8 alpha:1].CGColor); |
| 82 | + } else { |
| 83 | + UISetColor([UIColor colorWithRed:0.4 green:0.5 blue:0.9 alpha:1].CGColor); |
| 84 | + } |
| 85 | + [name_ drawAtPoint:CGPointMake(48, 8) forWidth:(width - 80) withFont:[UIFont boldSystemFontOfSize:18] lineBreakMode:NSLineBreakByTruncatingTail]; |
| 86 | + if (!commercial_) { |
| 87 | + UISetColor([UIColor grayColor].CGColor); |
| 88 | + } |
| 89 | + [source_ drawAtPoint:CGPointMake(58, 29) forWidth:(width - 29) withFont:[UIFont systemFontOfSize:12] lineBreakMode:NSLineBreakByTruncatingTail]; |
| 90 | + [description_ drawAtPoint:CGPointMake(12, 46) forWidth:(width - 46) withFont:[UIFont systemFontOfSize:14] lineBreakMode:NSLineBreakByTruncatingTail]; |
| 91 | +} |
| 92 | +%end |
| 93 | + |
| 94 | +@interface CyteTableViewCell : UIView |
| 95 | +@end |
| 96 | + |
| 97 | +%hook CyteTableViewCell |
| 98 | +- (void)layoutSubviews { |
| 99 | + %orig; |
| 100 | + self.backgroundColor = [UIColor colorWithRed:0.25 green:0.25 blue:0.25 alpha:1.0]; |
| 101 | +} |
| 102 | +%end |
| 103 | + |
| 104 | +%hook CyteTableViewCellContentView |
| 105 | +- (void)layoutSubviews { |
| 106 | + %orig; |
| 107 | + self.backgroundColor = [UIColor colorWithRed:0.25 green:0.25 blue:0.25 alpha:1.0]; |
| 108 | +} |
| 109 | +%end |
| 110 | + |
| 111 | +%hook UITableView |
| 112 | +- (void)layoutSubviews { |
| 113 | + %orig; |
| 114 | + self.separatorColor = [UIColor colorWithRed:0.15 green:0.15 blue:0.15 alpha:1.0]; |
| 115 | +} |
| 116 | +%end |
| 117 | + |
| 118 | +%hook UITabBar |
| 119 | +-(void)didMoveToWindow { |
| 120 | + %orig; |
| 121 | + self.backgroundColor = [UIColor colorWithRed:0.20 green:0.20 blue:0.20 alpha:1.0]; |
| 122 | +} |
| 123 | +%end |
| 124 | + |
| 125 | +%hook UINavigationBar |
| 126 | +-(void)didMoveToWindow { |
| 127 | + %orig; |
| 128 | + self.backgroundColor = [UIColor colorWithRed:0.20 green:0.20 blue:0.20 alpha:1.0]; |
| 129 | +} |
| 130 | +%end |
| 131 | + |
| 132 | +@interface UISearchBarTextField : UIView |
| 133 | +@end |
| 134 | + |
| 135 | +%hook UISearchBarTextField |
| 136 | +-(void)didMoveToWindow { |
| 137 | + %orig; |
| 138 | + self.backgroundColor = [UIColor colorWithRed:0.25 green:0.25 blue:0.25 alpha:1.0]; |
| 139 | +} |
| 140 | +%end |
| 141 | + |
| 142 | +@interface UIStatusBarForegroundView : UIView |
| 143 | +@end |
| 144 | + |
| 145 | +%hook UIStatusBarForegroundView |
| 146 | +-(void)didMoveToWindow { |
| 147 | + %orig; |
| 148 | + self.backgroundColor = [UIColor colorWithRed:0.20 green:0.20 blue:0.20 alpha:1.0]; |
| 149 | +} |
| 150 | +%end |
| 151 | + |
| 152 | +%hook UITableView |
| 153 | +-(void)didMoveToWindow { |
| 154 | + %orig; |
| 155 | + self.backgroundColor = [UIColor colorWithRed:0.25 green:0.25 blue:0.25 alpha:1.0]; |
| 156 | +} |
| 157 | +%end |
| 158 | + |
| 159 | +%hook UITableViewCell |
| 160 | +-(void)didMoveToWindow { |
| 161 | + %orig; |
| 162 | + self.backgroundColor = [UIColor colorWithRed:0.25 green:0.25 blue:0.25 alpha:1.0]; |
| 163 | +} |
| 164 | +%end |
| 165 | + |
| 166 | +@interface UITableViewIndex : UIView |
| 167 | +@property (nonatomic, strong) UIColor *indexBackgroundColor; |
| 168 | +@end |
| 169 | + |
| 170 | +%hook UITableViewIndex |
| 171 | +-(void)didMoveToWindow { |
| 172 | + %orig; |
| 173 | + self.indexBackgroundColor = [UIColor colorWithRed:0.19 green:0.19 blue:0.19 alpha:1.0]; |
| 174 | +} |
| 175 | +%end |
| 176 | + |
| 177 | +%hook UILabel |
| 178 | +-(UIColor *)textColor { |
| 179 | +return [UIColor whiteColor]; |
| 180 | +} |
| 181 | +%end |
| 182 | + |
| 183 | +@interface _UITableViewHeaderFooterContentView : UIView |
| 184 | +@end |
| 185 | + |
| 186 | +%hook _UITableViewHeaderFooterContentView |
| 187 | +-(void)didMoveToWindow { |
| 188 | + %orig; |
| 189 | + self.backgroundColor = [UIColor colorWithRed:0.19 green:0.19 blue:0.19 alpha:1.0]; |
| 190 | +} |
| 191 | +%end |
| 192 | + |
| 193 | +%hook UILabel |
| 194 | +-(void)didMoveToWindow { |
| 195 | + self.textColor = [UIColor whiteColor]; |
| 196 | +} |
| 197 | +%end |
| 198 | + |
| 199 | +@interface _UITableViewCellSeparatorView : UIView |
| 200 | +@end |
| 201 | + |
| 202 | +%hook _UITableViewCellSeparatorView |
| 203 | +-(void)didMoveToSuperview { |
| 204 | + %orig; |
| 205 | + self.backgroundColor = [UIColor colorWithRed:0.15 green:0.15 blue:0.15 alpha:1.0]; |
| 206 | +} |
| 207 | +%end |
| 208 | + |
| 209 | +@interface _UIBarBackground : UIView |
| 210 | +@end |
| 211 | + |
| 212 | +%hook _UIBarBackground |
| 213 | +-(void)layoutSubviews { |
| 214 | + %orig; |
| 215 | + self.hidden = YES; |
| 216 | +} |
| 217 | +%end |
0 commit comments