-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathTweak.xm
136 lines (98 loc) · 2.95 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
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
#import "Tweak.h"
#import "CBDManager.h"
%hook SBRootFolderController
-(void)setEditingStatusBarAssertion:(id)arg1 {}
%end
%hook SBEditingDoneButton
-(void)layoutSubviews {
%orig;
self.hidden = 1;
}
%end
%hook SBIconLegibilityLabelView
-(void)setHidden:(BOOL)arg1 {
if ([[CBDManager sharedInstance] hideIconLabels]) %orig(YES);
else %orig;
}
%end
%hook SBIconView
-(void)layoutSubviews {
%orig;
if ([[CBDManager sharedInstance] hideIconLabels] || [[CBDManager sharedInstance] hideIconDots]) {
[self setLabelAccessoryViewHidden:YES];
}
}
%end
%hook SBRootIconListView
+(NSUInteger)iconColumnsForInterfaceOrientation:(NSInteger)arg1{
if ([[CBDManager sharedInstance] homescreenColumns] > 0) return [[CBDManager sharedInstance] homescreenColumns];
return %orig;
}
+(NSUInteger)iconRowsForInterfaceOrientation:(NSInteger)arg1{
if ([[CBDManager sharedInstance] homescreenRows] > 0) return [[CBDManager sharedInstance] homescreenRows];
return %orig;
}
-(CGFloat)topIconInset {
if ([[CBDManager sharedInstance] verticalOffset] != 0) return [[CBDManager sharedInstance] verticalOffset];
return %orig;
}
-(CGFloat)bottomIconInset {
if ([[CBDManager sharedInstance] verticalOffset] != 0) return [[CBDManager sharedInstance] verticalOffset] * -1;
return %orig;
}
-(CGFloat)sideIconInset {
if ([[CBDManager sharedInstance] horizontalOffset] != 0) return [[CBDManager sharedInstance] horizontalOffset];
return %orig;
}
-(CGFloat)verticalIconPadding {
if ([[CBDManager sharedInstance] verticalPadding] != 0) return [[CBDManager sharedInstance] verticalPadding];
return %orig;
}
-(CGFloat)horizontalIconPadding {
if ([[CBDManager sharedInstance] horizontalPadding] != 0) return [[CBDManager sharedInstance] horizontalPadding];
return %orig;
}
%end
%hook UIStatusBarWindow
-(instancetype)initWithFrame:(CGRect)frame {
self = %orig;
[self addGestureRecognizer:[[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(cbdShowView)]];
return self;
}
%new
-(void)cbdShowView {
if ([[%c(SBIconController) sharedInstance] isEditing]) {
[[[%c(SBIconController) sharedInstance] editingEndTimer] invalidate];
[[CBDManager sharedInstance].view setPresented:YES];
}
}
%end
%hook SBIconController
%property (nonatomic, strong) CBDView *cbdView;
-(void)viewDidLoad {
%orig;
self.cbdView = [[CBDView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 0)];
[self.view addSubview:self.cbdView];
[CBDManager sharedInstance].view = self.cbdView;
}
-(void)viewDidLayoutSubviews {
%orig;
self.cbdView.frame = CGRectMake(0, 0, self.view.frame.size.width, self.cbdView.frame.size.height);
}
-(void)setIsEditing:(BOOL)isEditing {
%orig;
if (!isEditing) [[CBDManager sharedInstance].view setPresented:NO];
}
%end
/* Disable home screen rotation on + devices. */
%hook SpringBoard
- (long long)homeScreenRotationStyle {
return 0;
}
-(BOOL)homeScreenRotationStyleWantsUIKitRotation {
return NO;
}
-(BOOL)homeScreenSupportsRotation {
return NO;
}
%end