|
@@ -2,6 +2,46 @@
|
|
|
|
|
|
#import "DDBSettingsController.h"
|
|
|
|
|
|
+@interface TVSPreferences : NSObject
|
|
|
+
|
|
|
++ (id)preferencesWithDomain:(id)arg1;
|
|
|
+- (_Bool)setBool:(_Bool)arg1 forKey:(id)arg2;
|
|
|
+- (_Bool)boolForKey:(id)arg1 defaultValue:(_Bool)arg2;
|
|
|
+- (_Bool)boolForKey:(id)arg1;
|
|
|
+- (_Bool)setDouble:(double)arg1 forKey:(id)arg2;
|
|
|
+- (double)doubleForKey:(id)arg1 defaultValue:(double)arg2;
|
|
|
+- (double)doubleForKey:(id)arg1;
|
|
|
+- (_Bool)setFloat:(float)arg1 forKey:(id)arg2;
|
|
|
+- (float)floatForKey:(id)arg1 defaultValue:(float)arg2;
|
|
|
+- (float)floatForKey:(id)arg1;
|
|
|
+- (_Bool)setInteger:(int)arg1 forKey:(id)arg2;
|
|
|
+- (int)integerForKey:(id)arg1 defaultValue:(int)arg2;
|
|
|
+- (int)integerForKey:(id)arg1;
|
|
|
+- (id)stringForKey:(id)arg1;
|
|
|
+- (_Bool)setObject:(id)arg1 forKey:(id)arg2;
|
|
|
+- (id)objectForKey:(id)arg1;
|
|
|
+- (_Bool)synchronize;
|
|
|
+- (id)initWithDomain:(id)arg1;
|
|
|
+@end
|
|
|
+
|
|
|
+@protocol TSKSettingItemEditingControllerDelegate <NSObject>
|
|
|
+- (void)editingController:(id)arg1 didCancelForSettingItem:(TSKSettingItem *)arg2;
|
|
|
+- (void)editingController:(id)arg1 didProvideValue:(id)arg2 forSettingItem:(TSKSettingItem *)arg3;
|
|
|
+@end
|
|
|
+
|
|
|
+@interface TSKTextInputViewController : UIViewController
|
|
|
+
|
|
|
+@property (assign,nonatomic) BOOL supportsPasswordSharing;
|
|
|
+@property (nonatomic,retain) NSString * networkName;
|
|
|
+@property (assign,nonatomic) BOOL secureTextEntry;
|
|
|
+@property (nonatomic,copy) NSString * headerText;
|
|
|
+@property (nonatomic,copy) NSString * messageText;
|
|
|
+@property (nonatomic,copy) NSString * initialText;
|
|
|
+@property (assign,nonatomic) long long capitalizationType;
|
|
|
+@property (assign,nonatomic) long long keyboardType;
|
|
|
+@property (nonatomic,retain) TSKSettingItem * editingItem;
|
|
|
+@property (assign,nonatomic,weak) id<TSKSettingItemEditingControllerDelegate> editingDelegate;
|
|
|
+@end
|
|
|
|
|
|
@implementation DDBSettingsController
|
|
|
|
|
@@ -14,15 +54,29 @@
|
|
|
NSLog(@"DDBSettings: main bundle: %@", [NSBundle bundleForClass:self.class]);
|
|
|
|
|
|
id facade = [[NSClassFromString(@"TVSettingsPreferenceFacade") alloc] initWithDomain:@"com.nito.dalesdeadbug" notifyChanges:TRUE];
|
|
|
- [facade setValue:[NSNumber numberWithBool:TRUE] forUndefinedKey:@"Enabled"];
|
|
|
- [facade setValue:@"11.1" forUndefinedKey:@"SpoofVersion"];
|
|
|
+ //[facade setValue:[NSNumber numberWithBool:TRUE] forUndefinedKey:@"Enabled"];
|
|
|
+ //[facade setValue:@"11.1" forUndefinedKey:@"SpoofVersion"];
|
|
|
+ //[facade setValue:@"TextTest" forUndefinedKey:@"TextTest"];
|
|
|
|
|
|
NSMutableArray *_backingArray = [NSMutableArray new];
|
|
|
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];
|
|
|
- //TSKSettingItem *textEntryItem = [TSKSettingItem textInputItemWithTitle:@"Tests text entry" description:@"This is a test" representedObject:facade keyPath:@"textTest"];
|
|
|
+
|
|
|
+
|
|
|
+ //TSKTextInputViewController.h
|
|
|
+ //Class TSKTIVC = NSClassFromString(@"TSKTextInputViewController");
|
|
|
+
|
|
|
+
|
|
|
+ //TSKSettingItem *textEntryItem = [TSKSettingItem textInputItemWithTitle:@"Tests text entry" description:@"This is a test" representedObject:testObject keyPath:nil];
|
|
|
+ //+(id)actionItemWithTitle:(id)arg1 description:(id)arg2 representedObject:(id)arg3 keyPath:(id)arg4 target:(id)arg5 action:(SEL)arg6
|
|
|
+ //[testObject setEditingItem:textEntryItem];
|
|
|
+
|
|
|
+ TSKSettingItem *textEntryItem = [TSKSettingItem actionItemWithTitle:@"Tests text entry" description:@"This is a test" representedObject:facade keyPath:@"TextTest" target:self action:@selector(showViewController:)];
|
|
|
+ [textEntryItem setLocalizedValue:@"TEST"];
|
|
|
+ //:+[<TSKSettingItem: 0x1b48d3c88> actionItemWithTitle:Sleep Now description:(null) representedObject:(null) keyPath:(null) target:<TVSettingsMainViewController: 0x15204d600> action:_sleepNow:]
|
|
|
+ //[textEntryItem set]
|
|
|
|
|
|
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"]];
|
|
|
- TSKSettingGroup *group = [TSKSettingGroup groupWithTitle:nil settingItems:@[toggleItem, multiItem]];
|
|
|
+ TSKSettingGroup *group = [TSKSettingGroup groupWithTitle:nil settingItems:@[toggleItem, multiItem, textEntryItem]];
|
|
|
[_backingArray addObject:group];
|
|
|
[self setValue:_backingArray forKey:@"_settingGroups"];
|
|
|
|
|
@@ -30,23 +84,75 @@
|
|
|
|
|
|
}
|
|
|
|
|
|
+- (TVSPreferences *)ourPreferences {
|
|
|
+
|
|
|
+ return [TVSPreferences preferencesWithDomain:@"com.nito.dalesdeadbug"];
|
|
|
+}
|
|
|
+
|
|
|
+- (void)showViewController:(TSKSettingItem *)item {
|
|
|
+
|
|
|
+ NSLog(@"DDBSettings: showViewController: %@", item );
|
|
|
+
|
|
|
+ TSKTextInputViewController *testObject = [[TSKTextInputViewController alloc] init];
|
|
|
+
|
|
|
+ NSLog(@"DDBSettings:test object: %@", testObject);
|
|
|
+
|
|
|
+ TVSPreferences *prefs = [TVSPreferences preferencesWithDomain:@"com.nito.dalesdeadbug"];
|
|
|
+
|
|
|
+ testObject.headerText = @"Dales Dead Bug";
|
|
|
+ testObject.initialText = [[self ourPreferences] stringForKey:item.keyPath];
|
|
|
+
|
|
|
+ if ([testObject respondsToSelector:@selector(setEditingDelegate:)]){
|
|
|
+
|
|
|
+ [testObject setEditingDelegate:self];
|
|
|
+
|
|
|
+ NSLog(@"DDBSettings: after settings delegate: %@", testObject);
|
|
|
+ }
|
|
|
+ [testObject setEditingItem:item];
|
|
|
+ [self.navigationController pushViewController:testObject animated:TRUE];
|
|
|
+}
|
|
|
+
|
|
|
+- (void)editingController:(id)arg1 didCancelForSettingItem:(TSKSettingItem *)arg2 {
|
|
|
+
|
|
|
+ NSLog(@"DDBSettings: editingController %@ didCancelForSettingItem:%@", arg1, arg2);
|
|
|
+ [super editingController:arg1 didCancelForSettingItem:arg2];
|
|
|
+}
|
|
|
+- (void)editingController:(id)arg1 didProvideValue:(id)arg2 forSettingItem:(TSKSettingItem *)arg3 {
|
|
|
+
|
|
|
+ NSLog(@"DDBSettings: editingController %@ didProvideValue: %@ forSettingItem: %@", arg1, arg2, arg3);
|
|
|
+
|
|
|
+ [super editingController:arg1 didProvideValue:arg2 forSettingItem:arg3];
|
|
|
+
|
|
|
+ TVSPreferences *prefs = [TVSPreferences preferencesWithDomain:@"com.nito.dalesdeadbug"];
|
|
|
+
|
|
|
+ NSLog(@"DDBSettings: prefs: %@", prefs);
|
|
|
+ //[arg3 setLocalizedValue:arg2];
|
|
|
+ [prefs setObject:arg2 forKey:arg3.keyPath];
|
|
|
+ NSLog(@"DDBSettings: setObjetct: arg2 forKey: %@", arg3.keyPath);
|
|
|
+ [prefs synchronize];
|
|
|
+ NSLog(@"DDBSettings: after prefs sync");
|
|
|
+ //[self.navigationController popViewControllerAnimated:YES];
|
|
|
+
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
-(id)previewForItemAtIndexPath:(NSIndexPath *)indexPath {
|
|
|
|
|
|
- NSLog(@"are we ever in ehre?!??!");
|
|
|
TSKPreviewViewController *item = [super previewForItemAtIndexPath:indexPath];
|
|
|
TSKSettingGroup *currentGroup = self.settingGroups[indexPath.section];
|
|
|
- NSLog(@"currentGroup: %@", currentGroup);
|
|
|
+ //NSLog(@"currentGroup: %@", currentGroup);
|
|
|
TSKSettingItem *currentItem = currentGroup.settingItems[indexPath.row];
|
|
|
- NSLog(@"current item: %@", currentItem);
|
|
|
+ //NSLog(@"current item: %@", currentItem);
|
|
|
NSString *imagePath = [[NSBundle bundleForClass:self.class] pathForResource:@"icon" ofType:@"jpg"];
|
|
|
UIImage *icon = [UIImage imageWithContentsOfFile:imagePath];
|
|
|
- NSLog(@"DDBSettings: our icon: %@", imagePath);
|
|
|
+ //NSLog(@"DDBSettings: our icon: %@", imagePath);
|
|
|
if (icon != nil) {
|
|
|
TSKVibrantImageView *imageView = [[TSKVibrantImageView alloc] initWithImage:icon];
|
|
|
- NSLog(@"current item: %@", imageView);
|
|
|
+ //NSLog(@"current item: %@", imageView);
|
|
|
[item setContentView:imageView];
|
|
|
}
|
|
|
- NSLog(@"previewForItemAtIndexPath: %@", item);
|
|
|
+ //NSLog(@"previewForItemAtIndexPath: %@", item);
|
|
|
|
|
|
return item;
|
|
|
|