-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTweak.xm
75 lines (64 loc) · 2.75 KB
/
Tweak.xm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
static NSInteger totalCount = 0;
@interface PSSwitchTableCell : UITableViewCell
-(void)setCellEnabled:(BOOL)arg1;
-(id)initWithStyle:(long long)arg1 reuseIdentifier:(id)arg2 specifier:(id)arg3;
-(void)setValue:(id)arg1;
@end
%hook PSUIPrivacyController
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
if(section == 0){
totalCount = %orig;
return totalCount + 3;
} else{
return %orig;
}
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
if(indexPath.section == 0 && indexPath.row >= totalCount){
PSSwitchTableCell *cell = [[%c(PSSwitchTableCell) alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"toggler" specifier:nil];
if (indexPath.row == totalCount){
cell.textLabel.text = @"CIA";
cell.imageView.image = [UIImage imageWithContentsOfFile:@"/Library/PreferenceBundles/buildthatwallimages.bundle/cia.png"];
CGSize itemSize = CGSizeMake(32, 32);
UIGraphicsBeginImageContextWithOptions(itemSize, NO, 0.0);
CGRect imageRect = CGRectMake(0.0, 0.0, itemSize.width, itemSize.height);
[cell.imageView.image drawInRect:imageRect];
cell.imageView.image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
}
else if (indexPath.row == totalCount+1){
cell.textLabel.text = @"FBI";
cell.imageView.image = [UIImage imageWithContentsOfFile:@"/Library/PreferenceBundles/buildthatwallimages.bundle/fbi.png"];
CGSize itemSize = CGSizeMake(32, 32);
UIGraphicsBeginImageContextWithOptions(itemSize, NO, 0.0);
CGRect imageRect = CGRectMake(0.0, 0.0, itemSize.width, itemSize.height);
[cell.imageView.image drawInRect:imageRect];
cell.imageView.image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
}
else if (indexPath.row == totalCount+2){
cell.textLabel.text = @"NSA";
cell.imageView.image = [UIImage imageWithContentsOfFile:@"/Library/PreferenceBundles/buildthatwallimages.bundle/nsa.png"];
CGSize itemSize = CGSizeMake(32, 32);
UIGraphicsBeginImageContextWithOptions(itemSize, NO, 0.0);
CGRect imageRect = CGRectMake(0.0, 0.0, itemSize.width, itemSize.height);
[cell.imageView.image drawInRect:imageRect];
cell.imageView.image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
}
cell.imageView.frame = CGRectMake(0,0,32,32);
[cell setValue:[NSNumber numberWithBool:true]];
cell.accessoryType = UITableViewCellAccessoryNone;
return cell;
} else {
return %orig;
}
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
if(indexPath.section == 0 && indexPath.row >= totalCount){
} else {
%orig;
}
}
%end