aboutsummaryrefslogtreecommitdiffstats
path: root/Low Battery Yup/AppDelegate.m
blob: 8a9005f23b5c7dc355bad592ae3b1c45c4f7ec9d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
//
//  AppDelegate.m
//  Low Battery Yup
//
//  Created by TW on 11/16/16.
//  Copyright (c) 2016 TW. All rights reserved.
//

#import "AppDelegate.h"

static NSString *const kPreferenceGlobalShortcut = @"GlobalShortcut";
static void *AppObservingContext = &AppObservingContext;

@implementation AppDelegate

- (void)dealloc
{
    [super dealloc];
}

- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
	[_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