Advertisement
Guest User

Untitled

a guest
Jul 4th, 2019
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //NSArray containing all force touch shortcut items
  2. -(NSArray *)applicationShortcutItems {
  3.  
  4.     //If force touch setting is disabled do nothing
  5.     if (!forceTouchOptionEnabled) return %orig;
  6.    
  7.     //Get the app's bundle identifier
  8.     NSString *bundleIdentifier = [self applicationBundleIdentifier];
  9.     if (!bundleIdentifier) return %orig;
  10.    
  11.     //Create a mutable (editable) copy of the original NSArray
  12.     NSMutableArray *orig = [%orig mutableCopy];
  13.    
  14.     //If there were no items to begin with, create a new array
  15.     if (!orig) orig = [NSMutableArray new];
  16.  
  17.     //Create a new item
  18.     SBSApplicationShortcutItem *item = [[%c(SBSApplicationShortcutItem) alloc] init];
  19.    
  20.     //Set title & subtitle
  21.     item.localizedTitle = @"UnSub";
  22.     item.localizedSubtitle = @"Disable tweaks";
  23.  
  24.     //If unsub is enabled already, change subtitle to reflect
  25.     for (NSString *bundleId in disabledApps) {
  26.         if ([bundleIdentifier isEqualToString: bundleId]) {
  27.             item.localizedSubtitle = @"Tweaks already disabled";
  28.             break;
  29.         }
  30.     }
  31.    
  32.     //Set the bundle id for the shortcut to launch and add a type string for identification later
  33.     item.bundleIdentifierToLaunch = bundleIdentifier;
  34.     item.type = @"UnSubItem";
  35.    
  36.     //Add the new item to the array
  37.     [orig addObject:item];
  38.  
  39.     return orig;
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement