-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTweak.xm
More file actions
42 lines (35 loc) · 1.04 KB
/
Tweak.xm
File metadata and controls
42 lines (35 loc) · 1.04 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
#include <notify.h>
@interface NSObject (SBIcon)
@property (nonatomic) NSString *applicationBundleID;
@end
%hook SBIconView
-(void)layoutSubviews{
%orig;
UIView *_closeBox = MSHookIvar<UIView *>(self, "_closeBox");
UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTapGesture:)];
tapGesture.numberOfTapsRequired = 2;
[_closeBox addGestureRecognizer:tapGesture];
[tapGesture release];
}
%new
- (void)handleTapGesture:(UITapGestureRecognizer *)sender {
if (sender.state == UIGestureRecognizerStateRecognized) {
BOOL changed = NO;
void* libHide = dlopen("/usr/lib/hide.dylib", RTLD_LAZY);
UIView *&_icon(MSHookIvar<UIView *>(self, "_icon"));
if (libHide != NULL) {
BOOL (*Hider)(NSString*) = (BOOL (*)(NSString*)) dlsym(libHide, "HideIconViaDisplayId");
if (Hider != NULL) {
changed = Hider(_icon.applicationBundleID);
}
dlclose(libHide);
}
if(changed == YES) {
notify_post("com.libhide.hiddeniconschanged");
}
}
}
%end
%ctor {
%init
}