diff options
Diffstat (limited to 'Low Battery Yup/AppDelegate.m')
| -rw-r--r-- | Low Battery Yup/AppDelegate.m | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/Low Battery Yup/AppDelegate.m b/Low Battery Yup/AppDelegate.m index 0c9bbdc..8a9005f 100644 --- a/Low Battery Yup/AppDelegate.m +++ b/Low Battery Yup/AppDelegate.m @@ -8,6 +8,9 @@ #import "AppDelegate.h" +static NSString *const kPreferenceGlobalShortcut = @"GlobalShortcut"; +static void *AppObservingContext = &AppObservingContext; + @implementation AppDelegate - (void)dealloc @@ -17,7 +20,35 @@ - (void)applicationDidFinishLaunching:(NSNotification *)aNotification { - // Insert code here to initialize your application + [_shortcut_view setAssociatedUserDefaultsKey:kPreferenceGlobalShortcut]; + +// NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; +// [_shortcut_view bind:@"shortcutValue" toObject:defaults withKeyPath:@"thisisatest" options:nil]; + +// [defaults addObserver:self forKeyPath:@"thisisatest" options:NSKeyValueObservingOptionInitial | NSKeyValueObservingOptionNew context:AppObservingContext]; + +// [[MASShortcutBinder sharedBinder] +// bindShortcutWithDefaultsKey:kPreferenceGlobalShortcut +// toAction:^{NSLog(@"dudebro");}]; + +} + +- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context +{ + NSLog(@"OBSERVED"); + NSLog(@"%@", change); +} + +- (IBAction)logDefaults:(id)sender +{ + NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; + NSLog(@"%@", [defaults objectForKey:[@"values." stringByAppendingString:kPreferenceGlobalShortcut]]); +// NSLog(@"%@", [defaults objectForKey:kPreferenceGlobalShortcut]); +// NSLog(@"%@", [[NSUserDefaults standardUserDefaults] dictionaryRepresentation]); + +// NSLog(@"%@", [_shortcut_view shortcutValue]); +// NSLog(@"%@", [[NSUserDefaults standardUserDefaults] objectForKey:@"thisisatest"]); +// [[NSUserDefaults standardUserDefaults] setObject:@"dude come on" forKey:@"thisisatest"]; } @end |
