-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTweak.xm
More file actions
68 lines (47 loc) · 1.38 KB
/
Tweak.xm
File metadata and controls
68 lines (47 loc) · 1.38 KB
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
#import <UIKit/UIKit.h>
#import <objc/runtime.h>
@interface TPLCDTextView : UIView { }
-(void)setText:(id)text;
-(void)setTextColor:(id)color;
-(id)grabPrefColor:(NSInteger)colorNumber;
@end
static NSInteger clockColor;
%hook SBAwayDateView
-(void)updateClock{
NSMutableDictionary *plist = [[NSMutableDictionary alloc] initWithContentsOfFile:@"/var/mobile/Library/Preferences/com.abart997.clockseconds.plist"];
clockColor = [((NSNumber*)[plist valueForKey:@"clockColor"]) integerValue];
%orig;
TPLCDTextView *time = MSHookIvar<TPLCDTextView *>(self, "_timeLabel");
NSDateFormatter *dt = [[NSDateFormatter alloc] init];
[dt setDateStyle:NSDateFormatterNoStyle];
[dt setTimeStyle:NSDateFormatterShortStyle];
[dt setDateFormat:@"HH:mm:ss"];
NSString *currentTime = [dt stringFromDate:[NSDate date]];
[dt release];
[time setText:currentTime];
[time setTextColor: [self grabPrefColor:clockColor]];
}
%new(v@:i)
-(id)grabPrefColor:(NSInteger)colorNumber {
switch (colorNumber) {
case 0:
return [UIColor redColor];
case 1:
return [UIColor blueColor];
case 2:
return [UIColor greenColor];
case 3:
return [UIColor blackColor];
case 4:
return [UIColor brownColor];
case 5:
return [UIColor purpleColor];
case 6:
return [UIColor whiteColor];
case 7:
return [UIColor orangeColor];
default:
return nil;
}
}
%end