Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //NSArray containing all force touch shortcut items
- -(NSArray *)applicationShortcutItems {
- //If force touch setting is disabled do nothing
- if (!forceTouchOptionEnabled) return %orig;
- //Get the app's bundle identifier
- NSString *bundleIdentifier = [self applicationBundleIdentifier];
- if (!bundleIdentifier) return %orig;
- //Create a mutable (editable) copy of the original NSArray
- NSMutableArray *orig = [%orig mutableCopy];
- //If there were no items to begin with, create a new array
- if (!orig) orig = [NSMutableArray new];
- //Create a new item
- SBSApplicationShortcutItem *item = [[%c(SBSApplicationShortcutItem) alloc] init];
- //Set title & subtitle
- item.localizedTitle = @"UnSub";
- item.localizedSubtitle = @"Disable tweaks";
- //If unsub is enabled already, change subtitle to reflect
- for (NSString *bundleId in disabledApps) {
- if ([bundleIdentifier isEqualToString: bundleId]) {
- item.localizedSubtitle = @"Tweaks already disabled";
- break;
- }
- }
- //Set the bundle id for the shortcut to launch and add a type string for identification later
- item.bundleIdentifierToLaunch = bundleIdentifier;
- item.type = @"UnSubItem";
- //Add the new item to the array
- [orig addObject:item];
- return orig;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement