-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathblurskiller.xm
More file actions
298 lines (264 loc) · 8.76 KB
/
blurskiller.xm
File metadata and controls
298 lines (264 loc) · 8.76 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
#import "substrate.h"
@interface PSUIAppleAccountCell : UITableViewCell
@end
static BOOL globalTransparent = NO;
static BOOL globalSelfTrans = NO;
static BOOL folderTrans = NO;
static BOOL KBSettings = NO;
static BOOL KBMobilePhone = NO;
static float maskAlpha = 0;
static BOOL KBDarkText = NO;
static NSString * kWallpaperPath = @"/var/mobile/wallpaper.png";
static void loadPrefs() {
NSMutableDictionary *prefs = [[NSMutableDictionary alloc] initWithContentsOfFile:@"/var/mobile/Library/Preferences/com.nactro.blurskillersettings.plist"];
if (prefs) {
globalTransparent = ([[prefs objectForKey:@"globalTransparent"] boolValue] ? [[prefs objectForKey:@"globalTransparent"] boolValue] : globalTransparent);
globalSelfTrans = ([[prefs objectForKey:@"globalSelfTrans"] boolValue] ? [[prefs objectForKey:@"globalSelfTrans"] boolValue] : globalSelfTrans);
folderTrans = ([[prefs objectForKey:@"folderTrans"] boolValue]?:folderTrans);
KBSettings = ([[prefs objectForKey:@"KBSettings"] boolValue]?:KBSettings);
KBMobilePhone = ([[prefs objectForKey:@"KBMobilePhone"] boolValue]?:KBMobilePhone);
maskAlpha = ([[prefs objectForKey:@"maskAlpha"] floatValue] ?: maskAlpha);
KBDarkText = ([[prefs objectForKey:@"KBDarkText"] boolValue] ?: KBDarkText);
}
[prefs release];
}
#pragma mark -全局微透
%hook SBFWallpaperSettings
-(BOOL) replaceBlurs {
if(globalSelfTrans) {
return YES;
} else {
return %orig;
}
}
%end
%hook UIDevice
- (long long)_graphicsQuality {
if (globalSelfTrans)
return 10;
return %orig;
}
%end
@interface _UIBackdropViewSettings : UIView
-(double) grayscaleTintAlpha;
-(id) initWithDefaultValuesForGraphicsQuality:(long long)arg1;
-(double) blurRadius;
-(void) setZoomsBack:(bool)arg1;
@end
#pragma mark -全透
%hook _UIBackdropViewSettings
- (id)initWithDefaultValuesForGraphicsQuality:(long long)qualityBlur {
if (globalTransparent)
return NULL;
return %orig;
}
%end
%hook SBSwitcherWallpaperPageContentView
-(id) wallpaperEffectView {
if(globalTransparent) {
return NULL;
} else {
return %orig;
}
}
%end
#pragma mark -文件夹透明
%hook SBFolderBackgroundView
-(bool) _hasLowQualityBackground {
if(folderTrans) {
return YES;
} else {
return %orig;
}
}
-(id) initWithFrame:(CGRect)arg {
if(folderTrans) {
return NULL;
} else {
return %orig;
}
}
%end
%hook _SBIconWallpaperBackgroundProvider
-(void) _updateBackgrounds {
if(folderTrans) {
return ;
} else {
return %orig;
}
}
%end
#pragma mark - 获取壁纸
@interface SBFWallpaperView : UIView{}
@end
%hook SBFWallpaperView
- (void)didMoveToWindow {
%orig;
if (KBSettings || KBMobilePhone) {
if (![[NSFileManager defaultManager] fileExistsAtPath:kWallpaperPath]) {
UIView *view = self;
CGFloat scale = [UIScreen mainScreen].scale;
UIGraphicsBeginImageContextWithOptions(view.frame.size,NO,scale);
[view.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *wallpaperImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
[UIImagePNGRepresentation(wallpaperImage) writeToFile:kWallpaperPath atomically:YES];
}
}
}
%end
#pragma mark -设置界面
@interface PSSearchController : NSObject
@end
/*--------------------背景透明-------------------*/
%hook PSListController
- (void)viewWillAppear:(BOOL)arg1 {
%orig(arg1);
if (KBSettings) {
UITableView *tableView = MSHookIvar<UITableView *>(self,"_table");
tableView.backgroundColor = [UIColor clearColor];
tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
UIImageView *wallpaperView = [[UIImageView alloc] initWithImage:[UIImage imageWithContentsOfFile:kWallpaperPath]];
CGRect screenFrame = [[UIScreen mainScreen] bounds];
wallpaperView.frame = screenFrame;
wallpaperView.contentMode = UIViewContentModeScaleAspectFit;
UIView *darkMaskView = [[UIView alloc] initWithFrame:screenFrame];
//darkMaskView.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:alpha];
darkMaskView.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:maskAlpha];
[wallpaperView addSubview:darkMaskView];
tableView.backgroundView = wallpaperView;
[darkMaskView release];
[wallpaperView release];
}
}
- (id)tableView:(UITableView *)arg1 cellForRowAtIndexPath:(id)arg2 {
if (KBSettings) {
UITableViewCell *cell = %orig(arg1,arg2);
cell.backgroundColor = [UIColor clearColor];
if (KBDarkText) {
cell.textLabel.textColor = [UIColor blackColor];
}else{
cell.textLabel.textColor = [UIColor whiteColor];
}
return cell;
}
else{ return %orig(arg1,arg2); }
}
%end
/*--------------设置界面WI-FI透明-------------*/
// %hook WFAirportViewController
//
// - (void)viewWillAppear:(BOOL)arg1 {
// %orig(arg1);
// if (KBSettings) {
// UITableView *tableView = MSHookIvar<UITableView *>(self,"_tableView");
// tableView.backgroundColor = [UIColor clearColor];
// tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
// UIImageView *wallpaperView = [[UIImageView alloc] initWithImage:[UIImage imageWithContentsOfFile:kWallpaperPath]];
// CGRect screenFrame = [[UIScreen mainScreen] bounds];
// wallpaperView.frame = screenFrame;
// wallpaperView.contentMode = UIViewContentModeScaleAspectFit;
// UIView *darkMaskView = [[UIView alloc] initWithFrame:screenFrame];
// //darkMaskView.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:alpha];
// darkMaskView.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:maskAlpha];
// [wallpaperView addSubview:darkMaskView];
// tableView.backgroundView = wallpaperView;
// [darkMaskView release];
// [wallpaperView release];
// }
// }
// -(BOOL)_isChinaDevice{
// return YES;
// }
// -(BOOL)userAutoJoinEnabled{
// return YES;
// }
// -(BOOL)_askToJoinEnabled{
// return YES;
// }
//
// -(id)tableView:(id)arg1 cellForRowAtIndexPath:(id)arg2{
// if (KBSettings) {
// UITableViewCell *cell = %orig(arg1,arg2);
// cell.backgroundColor = [UIColor clearColor];
// if (KBDarkText) {
// cell.textLabel.textColor = [UIColor blackColor];
// }else{
// cell.textLabel.textColor = [UIColor whiteColor];
// }
// return cell;
// }
// else{ return %orig(arg1,arg2); }
// }
// %end
/*--------------搜索框透明--------------*/
%hook PSSearchController
- (UISearchBar *)searchBar {
if (KBSettings) {
UISearchBar *searchBar = %orig;
for (UIView *subview in searchBar.subviews) {
for(UIView* grandSonView in subview.subviews){
if ([grandSonView isKindOfClass:NSClassFromString(@"UISearchBarBackground")]) {
grandSonView.alpha = 0.0f;
}else if([grandSonView isKindOfClass:NSClassFromString(@"UISearchBarTextField")] ){
}else{
grandSonView.alpha = 0.0f;
}
}
}
return searchBar;
}
else { return %orig; }
}
%end
/**********导航栏透明************/
%hook UINavigationController
-(void)viewDidAppear:(BOOL)arg1 {
if (KBSettings) {
[self.navigationBar setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault];
[self.navigationBar setShadowImage:[UIImage new]];
if (KBDarkText) {
[self.navigationBar setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor blackColor]}];
// 增加大标题颜色修改
self.navigationBar.largeTitleTextAttributes = @{NSForegroundColorAttributeName:[UIColor blackColor]};
self.navigationBar.tintColor = [UIColor blackColor];
}else{
[self.navigationBar setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor whiteColor]}];
// 增加大标题颜色修改
self.navigationBar.largeTitleTextAttributes = @{NSForegroundColorAttributeName:[UIColor whiteColor]};
self.navigationBar.tintColor = [UIColor whiteColor];
}
}
%orig(arg1);
}
%end
/********** APPLE账户CELL 描述文字变成白色 ************/
%hook PSUIAppleAccountCell
- (void)layoutSubviews{
if (KBSettings) {
UILabel *accountLable = MSHookIvar<UILabel *>(self,"_detailTextLabel");
if (KBDarkText) {
accountLable.textColor = [UIColor blackColor];
}else{
accountLable.textColor = [UIColor whiteColor];
}
}
%orig;
}
%end
#pragma mark - 电话界面
/*----------拨号界面透明----------*/
%hook DialerController
- (void)viewWillAppear:(_Bool)arg1{
if (KBMobilePhone) {
UIView *dialerView = MSHookIvar<UIView *>(self,"_dialerView");
dialerView.backgroundColor = [UIColor whiteColor];
}else{
%orig(arg1);
}
}
%end
%ctor {
loadPrefs();
CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), NULL, (CFNotificationCallback)loadPrefs, CFSTR("com.nactro.killblurs.settings/changed"), NULL, CFNotificationSuspensionBehaviorCoalesce);
}