2
0

Prepare key handling logic for sharing with OS X.

[MOVED]     Key logic now in a common class extension on MPAppDelegate
            so it can be shared between iOS and OS X apps.
[MOVED]     MPConfig for sharing between iOS and OS X apps.
[CHANGED]   keyphrase -> key.
This commit is contained in:
Maarten Billemont
2012-03-05 22:19:05 +01:00
parent 6bda70920b
commit 02ffa9611a
23 changed files with 420 additions and 251 deletions

View File

@@ -8,12 +8,18 @@
#import "MPAppDelegate.h"
@implementation MPAppDelegate
@interface MPAppDelegate ()
@property (readwrite, strong, nonatomic) MPPasswordWindowController *passwordWindow;
@end
@implementation MPAppDelegate
@synthesize window = _window;
@synthesize persistentStoreCoordinator = __persistentStoreCoordinator;
@synthesize managedObjectModel = __managedObjectModel;
@synthesize managedObjectContext = __managedObjectContext;
@synthesize passwordWindow;
@synthesize keyPhrase;
+ (MPAppDelegate *)get {
@@ -21,9 +27,25 @@
return (MPAppDelegate *)[NSApplication sharedApplication].delegate;
}
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
// Insert code here to initialize your application
+ (NSManagedObjectContext *)managedObjectContext {
return [[self get] managedObjectContext];
}
+ (NSManagedObjectModel *)managedObjectModel {
return [[self get] managedObjectModel];
}
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
}
- (void)applicationDidBecomeActive:(NSNotification *)notification {
if (!self.passwordWindow)
self.passwordWindow = [[MPPasswordWindowController alloc] initWithWindowNibName:@"MPPasswordWindowController"];
[self.passwordWindow showWindow:self];
}
- (NSURL *)applicationFilesDirectory {