-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTweak.xm
54 lines (39 loc) · 1.58 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
#import "SCPreferencesManager.h"
@interface CALayer (seconds)
@property struct CGColor*contentsMultiplyColor;
@end
@interface PUIProgressWindow : NSObject {
CALayer * _layer;
CALayer * _progressLayer;
}
@property (nonatomic, readonly) CALayer *layer;
@end
@interface UIImage (twofers)
-(UIImage *)_flatImageWithColor:(UIColor *)color;
@end
%hook PUIProgressWindow
- (id)initWithProgressBarVisibility:(BOOL)arg1 createContext:(BOOL)arg2 contextLevel:(float)arg3 appearance:(int)arg4 {
return %orig(arg1, arg2, arg3, 0);
}
- (void)_createLayer {
%orig;
UIImage *image = [[SCPreferencesManager sharedInstance]imageForShowing];
if (image != nil && [[SCPreferencesManager sharedInstance] isImageEnabled]){
self.layer.contentsGravity = kCAGravityResizeAspectFill;
self.layer.contents = (id)image.CGImage;
[image release];
} else {
self.layer.backgroundColor = [[SCPreferencesManager sharedInstance] colorForPreference:@"backgroundColor" fallback:@"#000000"].CGColor;
}
CALayer *myProgressLayer = MSHookIvar<CALayer *>(self, "_progressLayer");
if(myProgressLayer != nil){
myProgressLayer.contentsMultiplyColor = [[SCPreferencesManager sharedInstance] colorForPreference:@"progressColor" fallback:@"#FFFFFF"].CGColor;
}
}
- (CGImage*)_createImageWithName:(const char *)arg1 scale:(int)arg2 displayHeight:(int)arg3{
if ([[SCPreferencesManager sharedInstance] isTintEnabled])
return CGImageRetain([[UIImage imageWithCGImage:%orig] _flatImageWithColor:[[SCPreferencesManager sharedInstance] colorForPreference:@"appleColor" fallback:@"#FFFFFF"]].CGImage);
else
return %orig;
}
%end