-
Notifications
You must be signed in to change notification settings - Fork 0
/
Tweak.m
175 lines (156 loc) · 3.68 KB
/
Tweak.m
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
#import <UIKit/UIKit.h>
static bool kEnabled = NO;
%hook SBHomeGestureSettings
- (bool)isHomeGestureEnabled {
if(kEnabled) {
return 1;
}
return %orig;
}
%end
%hook CCSControlCenterDefaults
- (unsigned long long)_defaultPresentationGesture {
if(kEnabled) {
return 1;
}
return %orig;
}
%end
%hook SBControlCenterController
- (unsigned long long)presentingEdge {
if(kEnabled) {
return 1;
}
return %orig;
}
%end
%hook CCUIModularControlCenterOverlayViewController
- (void)dismissAnimated:(bool)arg1 withCompletionHandler:(id)arg2 {
if(kEnabled) {
arg1 = 0;
%orig;
}
return %orig(arg1,arg2);
}
%end
%hook CCUIOverlayStatusBarPresentationProvider
- (void)_addHeaderContentTransformAnimationToBatch:(id)arg1 transitionState:(id)arg2 {
if(kEnabled) {
return;
}
return %orig(arg1,arg2);
}
%end
%hook SBFHomeGrabberSettings
- (bool)isEnabled {
if(kEnabled) {
return 1;
}
return %orig;
}
%end
/*******
This is ios 13 era codd fof nested folders minus the interfaces, was going to see in gf
%hook SBFolderController
-(BOOL)shouldOpenFolderIcon:(SBIcon *)icon {
if(kEnabled && kWantsNestedFolders) {
return YES;
}
return %orig;
}
-(BOOL)canAcceptFolderIconDrags {
if(kEnabled && kWantsNestedFolders) {
return YES;
}
return %orig;
}
%end
%hook SBIconView
-(BOOL)canRecieveGrabbedIcon:(id)icon {
if(kEnabled && kWantsNestedFolders) {
return YES;
%orig;
}
return %orig;
}
%end
%hook SBHIconManager
-(BOOL)allowsNestedFolders {
if(kEnabled && kWantsNestedFolders) {
return YES;
}
return %orig;
}
-(BOOL)icon:(SBIconView *)receiver canReceiveGrabbedIcon:(SBIconView *)received {
if(kEnabled && kWantsNestedFolders) {
return YES;
%orig;
}
return %orig;
}
%end
%hook SBHFolderSettings
-(void)setAllowNestedFolders:(BOOL)arg1 {
if(kEnabled && kWantsNestedFolders) {
arg1 = YES;
return %orig(arg1);
}
return %orig;
}
-(BOOL)allowNestedFolders {
if(kEnabeled && kWantsNestedFolders) {
return YES;
}
return %orig;
}
%end
static BOOL isCheckingModelConsistency = NO;
%hook SBHIconModel
-(void)checkModelConsistencyInRootFolder:(id)rootFolder {
isCheckingModelConsistency = YES;
return %orig(rootFolder);
isCheckingModelConsistency = NO;
}
%end
%hook SBRootFolderWithDock
-(id)folderIcons {
if(kEnabled && kWantsNestedFolders && isCheckingModelConsistency) {
return [NSSet set];
}
return %orig;
}
%end
%hook SBFolderControllerBackgroundView
-(void)layoutSubviews {
if(kEnabled && kWantsNestedFolders) {
%orig;
id delegate = self.delegate;
if(delegate && [delegate isKindOfClass:%c(SBFolderController)]) {
SBFolderController *folderController = (SBFolderController *)delegate;
if(![folderController isKindOfClass:%c(SBRootFolderController)]) {
[self setEffectActive:0];
[folderController _removeFakeStatusBar];
}
}
return;
}
else { return %orig; }
}
%end
//End of unrelated experimental code.
***********/
//handle prefs with user defaults
static void
loadPrefs() {
static NSUserDefaults *prefs = [[NSUserDefaults alloc]
initWithSuiteName:@"com.i0stweak3r.homegesture1315"];
kEnabled = [prefs boolForKey:@"enabled"];
}
%ctor {
CFNotificationCenterAddObserver(
CFNotificationCenterGetDarwinNotifyCenter(), NULL,
(CFNotificationCallback)loadPrefs,
CFSTR("com.i0stweak3r.homegesture1315/saved"), NULL,
CFNotificationSuspensionBehaviorDeliverImmediately);
loadPrefs();
}