DDBSettingsController.m 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #import "DDBSettingsController.h"
  2. @implementation DDBSettingsController
  3. - (id)loadSettingGroups {
  4. /*
  5. +[<TSKSettingItem: 0x1ad71bc88> toggleItemWithTitle:Automatically Update Apps description:(null) representedObject:<TVSettingsPreferenceFacade: 0x1c0438480> keyPath:AutoUpdatesEnabled onTitle:(null) offTitle:(null)]
  6. */
  7. NSLog(@"DDBSettings: main bundle: %@", [NSBundle bundleForClass:self.class]);
  8. id facade = [[NSClassFromString(@"TVSettingsPreferenceFacade") alloc] initWithDomain:@"com.nito.dalesdeadbug" notifyChanges:TRUE];
  9. [facade setValue:[NSNumber numberWithBool:TRUE] forUndefinedKey:@"Enabled"];
  10. [facade setValue:@"11.1" forUndefinedKey:@"SpoofVersion"];
  11. NSMutableArray *_backingArray = [NSMutableArray new];
  12. TSKSettingItem *toggleItem = [TSKSettingItem toggleItemWithTitle:@"Version spoofing" description:@"Whether or not to spoof a higher OS version to install officially unsupported application versions. " representedObject:facade keyPath:@"Enabled" onTitle:nil offTitle:nil];
  13. //TSKSettingItem *textEntryItem = [TSKSettingItem textInputItemWithTitle:@"Tests text entry" description:@"This is a test" representedObject:facade keyPath:@"textTest"];
  14. TSKSettingItem *multiItem = [TSKSettingItem multiValueItemWithTitle:@"Spoofed Version" description:@"The version you are going to spoof." representedObject:facade keyPath:@"SpoofVersion" availableValues:@[@"11.1", @"11.2", @"11.3", @"11.4"]];
  15. TSKSettingGroup *group = [TSKSettingGroup groupWithTitle:nil settingItems:@[toggleItem, multiItem]];
  16. [_backingArray addObject:group];
  17. [self setValue:_backingArray forKey:@"_settingGroups"];
  18. return _backingArray;
  19. }
  20. -(id)previewForItemAtIndexPath:(NSIndexPath *)indexPath {
  21. NSLog(@"are we ever in ehre?!??!");
  22. TSKPreviewViewController *item = [super previewForItemAtIndexPath:indexPath];
  23. TSKSettingGroup *currentGroup = self.settingGroups[indexPath.section];
  24. NSLog(@"currentGroup: %@", currentGroup);
  25. TSKSettingItem *currentItem = currentGroup.settingItems[indexPath.row];
  26. NSLog(@"current item: %@", currentItem);
  27. NSString *imagePath = [[NSBundle bundleForClass:self.class] pathForResource:@"icon" ofType:@"jpg"];
  28. UIImage *icon = [UIImage imageWithContentsOfFile:imagePath];
  29. NSLog(@"DDBSettings: our icon: %@", imagePath);
  30. if (icon != nil) {
  31. TSKVibrantImageView *imageView = [[TSKVibrantImageView alloc] initWithImage:icon];
  32. NSLog(@"current item: %@", imageView);
  33. [item setContentView:imageView];
  34. }
  35. NSLog(@"previewForItemAtIndexPath: %@", item);
  36. return item;
  37. }
  38. @end