-
Notifications
You must be signed in to change notification settings - Fork 0
/
Tweak.xm
88 lines (46 loc) · 1.73 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
#import "Tweak.h"
%hook SBUIAppIconForceTouchControllerDataProvider
-(NSArray *)applicationShortcutItems {
NSString *bundleIdentifier = [self applicationBundleIdentifier];
if (!bundleIdentifier) return %orig;
NSMutableArray *orig = [%orig mutableCopy];
if (!orig) orig = [NSMutableArray new];
SBSApplicationShortcutItem *item = [[%c(SBSApplicationShortcutItem) alloc] init];
item.localizedTitle = @"Rearrange Apps";
item.type = @"com.wh0ba.edit3d";
[orig addObject:item];
return orig;
}
%end
%hook SBUIAction
-(id)initWithTitle:(id)title subtitle:(id)arg2 image:(id)image badgeView:(id)arg4 handler:(id)arg5 {
if ([title isEqualToString:@"Rearrange Apps"]) {
image = [[UIImage imageWithContentsOfFile:@"/Library/Application Support/Edit3D/Edit3D.png"] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
}
return %orig;
}
%end
%hook SBUIAppIconForceTouchController
-(void)appIconForceTouchShortcutViewController:(id)arg1 activateApplicationShortcutItem:(SBSApplicationShortcutItem *)item {
//
if ([[item type] isEqualToString:@"com.wh0ba.edit3d"]) {
[self dismissAnimated:YES withCompletionHandler:^
{
[self _triggerEditingMode];
}];
nil;
}
else{
%orig;
}
}
%new
-(void)_triggerEditingMode{
// go into editing mode
/*if ([[%c(SBIconView) sharedInstance] respondsToSelector:@selector(_handleSecondHalfLongPressTimer:)])
[[%c(SBIconView) sharedInstance] _handleSecondHalfLongPressTimer:nil];
else */if ([[%c(SBIconController) sharedInstance] respondsToSelector:@selector(_cancelAppIconForceTouchGestureAndBeginEditing)])
[[%c(SBIconController) sharedInstance] _cancelAppIconForceTouchGestureAndBeginEditing];
}
%end
//[self dismissAnimated:YES withCompletionHandler:nil];