-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTweak.xm
21 lines (20 loc) · 1.27 KB
/
Tweak.xm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#import <libShortcutItems/libShortcutItems.h>
%ctor {
NSString *processName = [[NSProcessInfo processInfo] processName];
if ([processName isEqualToString:@"SpringBoard"]) {
if ([LSIManager sharedManager].isRunningInsideSpringBoard) {
LSIApplicationShortcutItem *testItem = [LSIApplicationShortcutItem newShortcutItemType:@"test_icon" title:@"Test" subtitle:@"Testing libShortcutItems" iconType:UIApplicationShortcutIconTypeAdd];
LSIApplicationShortcutItem *test2Item = [LSIApplicationShortcutItem newShortcutItemType:@"test2_icon" title:@"Test2" subtitle:@"Testing again" iconType:UIApplicationShortcutIconTypePlay];
LSICallback *callback = [LSICallback callbackWithBlock:^(LSIApplicationShortcutItem *item) {
NSLog(@"Handled %@ on SpringBoard",item.localizedTitle);
[[LSIManager sharedManager] removeShortcutItemType:@"test2_icon" fromApplicationID:@"com.apple.Preferences"];
}];
[testItem setCallback:callback];
[[LSIManager sharedManager] addShortcutItems:@[testItem,test2Item] toApplicationID:@"com.apple.Preferences"];
}
} else if ([processName isEqualToString:@"Preferences"]) {
[[LSIManager sharedManager] addCallback:[LSICallback callbackWithBlock:^(LSIApplicationShortcutItem *item) {
NSLog(@"Handled %@ in Preferences",item.localizedTitle);
}]];
}
}