-
Notifications
You must be signed in to change notification settings - Fork 12
/
Tweak.xm
60 lines (49 loc) · 1.61 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
@interface _UIStatusBarStringView : UIView
@property (copy) NSString *text;
@property NSInteger numberOfLines;
@property (copy) UIFont *font;
@property NSInteger textAlignment;
@end
%hook _UIStatusBarStringView
- (void)setText:(NSString *)text {
if([text containsString:@":"]) {
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
dateFormatter.locale = [[NSLocale alloc] initWithLocaleIdentifier:@"en_US"];
dateFormatter.dateStyle = NSDateFormatterShortStyle;
NSDate *now = [NSDate date];
NSString *shortDate = [dateFormatter stringFromDate:now];
shortDate = [shortDate substringToIndex:[shortDate length]-3];
NSString *newString = [NSString stringWithFormat:@"%@\n%@", text, shortDate];
self.numberOfLines = 2;
self.textAlignment = 1;
[self setFont: [self.font fontWithSize:12]];
%orig(newString);
}
else {
%orig(text);
}
}
%end
@interface _UIStatusBarTimeItem
@property (copy) _UIStatusBarStringView *shortTimeView;
@property (copy) _UIStatusBarStringView *pillTimeView;
@end
%hook _UIStatusBarTimeItem
- (id)applyUpdate:(id)arg1 toDisplayItem:(id)arg2 {
id returnThis = %orig;
[self.shortTimeView setFont: [self.shortTimeView.font fontWithSize:12]];
[self.pillTimeView setFont: [self.pillTimeView.font fontWithSize:12]];
return returnThis;
}
%end
@interface _UIStatusBarBackgroundActivityView : UIView
@property (copy) CALayer *pulseLayer;
@end
%hook _UIStatusBarBackgroundActivityView
- (void)setCenter:(CGPoint)point {
point.y = 11;
self.frame = CGRectMake(0, 0, self.frame.size.width, 31);
self.pulseLayer.frame = CGRectMake(0, 0, self.frame.size.width, 31);
%orig(point);
}
%end