Advertisement
Guest User

KBAPPLIST (probably failed) attempt

a guest
Sep 23rd, 2019
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //Attempt to use KBAppList on system wide tweak with  
  2. // UIKit as the main filter plist
  3.  
  4. #import <UIKit/UIKit.h>
  5. #import <Foundation/Foundation.h>
  6. #import <Cephei/HBPreferences.h>
  7. #import <KBAppList/KBAppList.h>
  8.  
  9. static bool kEnabled = YES;
  10. NSArray *appsID; //bundleID
  11. NSArray *kSelectedApps;
  12.  //Array with results of unique key
  13.  
  14.  
  15.  
  16. %hook _UISomething
  17. -(void)method {
  18. NSString *frontMostApp = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleIdentifier"];
  19. //Get bundleID of app in use
  20.  
  21. if([appsID containsObject: frontMostApp] && kEnabled) {
  22. Do Something
  23. }
  24. else { //Do something diffefent
  25. }
  26. }
  27. %end
  28.  
  29. extern NSString *const    
  30. HBPreferencesDidChangeNotification;
  31.  
  32. //(Cephei handles tbe postNotification if you name it  
  33. //   "yourtweaksbundleid/ReloadPrefs")
  34.  
  35.  
  36. %ctor {
  37.  
  38.     preferences = [[HBPreferences alloc] initWithIdentifier:@"com.i0stweak3r.modernbarz"];
  39.  
  40.  
  41.  
  42. [preferences registerBool:&kEnabled default:NO forKey:@"enabled"];
  43.  
  44. [preferences registerObject:&kSelectedApps default:@[@"com.apple.UIKit", NULL] forKey:@"selectedApps"];
  45.  
  46. appsID = [kSelectedApps valueForKey:@"bundleID"];
  47.  
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement