diff --git a/External/UbiquityStoreManager b/External/UbiquityStoreManager index c08909ae..84473020 160000 --- a/External/UbiquityStoreManager +++ b/External/UbiquityStoreManager @@ -1 +1 @@ -Subproject commit c08909aee0633e904b00d2374c1e63872ca3c343 +Subproject commit 844730201c5dd6fba266e229146ec28e4d50c2c2 diff --git a/MasterPassword/ObjC/MPAppDelegate_Store.m b/MasterPassword/ObjC/MPAppDelegate_Store.m index c634deb7..567a5502 100644 --- a/MasterPassword/ObjC/MPAppDelegate_Store.m +++ b/MasterPassword/ObjC/MPAppDelegate_Store.m @@ -30,6 +30,8 @@ PearlAssociatedObjectProperty(NSManagedObjectContext*, MainManagedObjectContext, + (NSManagedObjectContext *)managedObjectContextForThreadIfReady { NSManagedObjectContext *mainManagedObjectContext = [[self get] mainManagedObjectContextIfReady]; + if (!mainManagedObjectContext) + return nil; if ([[NSThread currentThread] isMainThread]) return mainManagedObjectContext; diff --git a/MasterPassword/ObjC/Mac/MPAppDelegate.m b/MasterPassword/ObjC/Mac/MPAppDelegate.m index 14b682fd..10034dde 100644 --- a/MasterPassword/ObjC/Mac/MPAppDelegate.m +++ b/MasterPassword/ObjC/Mac/MPAppDelegate.m @@ -11,6 +11,12 @@ #import "MPAppDelegate_Store.h" #import +@interface MPAppDelegate () + +@property(nonatomic) BOOL wasRunning; + +@end + @implementation MPAppDelegate @synthesize statusItem; @@ -110,7 +116,12 @@ static OSStatus MPHotKeyHander(EventHandlerCallRef nextHandler, EventRef theEven - (void)selectUser:(NSMenuItem *)item { - self.activeUser = (MPUserEntity *)[[MPAppDelegate managedObjectContextForThreadIfReady] objectRegisteredForID:[item representedObject]]; + NSError *error = nil; + NSManagedObjectContext *moc = [MPAppDelegate managedObjectContextForThreadIfReady]; + self.activeUser = (MPUserEntity *)[moc existingObjectWithID:[item representedObject] error:&error]; + + if (error) + err(@"While looking up selected user: %@", error); } - (void)showMenu { @@ -170,7 +181,7 @@ static OSStatus MPHotKeyHander(EventHandlerCallRef nextHandler, EventRef theEven #pragma mark - NSApplicationDelegate - (void)applicationDidFinishLaunching:(NSNotification *)aNotification { - + // Setup delegates and listeners. [MPConfig get].delegate = self; __weak id weakSelf = self; @@ -188,18 +199,6 @@ static OSStatus MPHotKeyHander(EventHandlerCallRef nextHandler, EventRef theEven self.statusItem.target = self; self.statusItem.action = @selector(showMenu); - __weak MPAppDelegate *wSelf = self; - [self addObserverBlock:^(NSString *keyPath, id object, NSDictionary *change, void *context) { - MPUserEntity *activeUser = [wSelf activeUserForThread]; - [[[wSelf.usersItem submenu] itemArray] enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { - if ([[obj representedObject] isEqual:[activeUser objectID]]) - [obj setState:NSOnState]; - else - [obj setState:NSOffState]; - }]; - - [MPMacConfig get].usedUserName = activeUser.name; - } forKeyPath:@"activeUserObjectID" options:0 context:nil]; [[NSNotificationCenter defaultCenter] addObserverForName:UbiquityManagedStoreDidChangeNotification object:nil queue:nil usingBlock: ^(NSNotification *note) { [self updateUsers]; @@ -232,6 +231,20 @@ static OSStatus MPHotKeyHander(EventHandlerCallRef nextHandler, EventRef theEven err(@"Error registering 'lock' hotkey: %d", status); } +- (void)setActiveUser:(MPUserEntity *)activeUser { + + [super setActiveUser:activeUser]; + + [[[self.usersItem submenu] itemArray] enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { + if ([[obj representedObject] isEqual:[activeUser objectID]]) + [obj setState:NSOnState]; + else + [obj setState:NSOffState]; + }]; + + [MPMacConfig get].usedUserName = activeUser.name; +} + - (void)updateMenuItems { MPUserEntity *activeUser = [self activeUserForThread]; @@ -298,7 +311,15 @@ static OSStatus MPHotKeyHander(EventHandlerCallRef nextHandler, EventRef theEven - (void)applicationDidBecomeActive:(NSNotification *)notification { - [self.passwordWindow showWindow:self]; + // Don't show window if we weren't already running (ie. if we haven't been activated before). + if (!self.wasRunning) { + dbg(@"Wasn't running yet, not activating."); + self.wasRunning = YES; + } + else { + dbg(@"Was running already, activating."); + [self.passwordWindow showWindow:self]; + } } - (void)applicationWillResignActive:(NSNotification *)notification { diff --git a/MasterPassword/ObjC/Mac/MPPasswordWindowController.m b/MasterPassword/ObjC/Mac/MPPasswordWindowController.m index 2ff92e59..6a2250c4 100644 --- a/MasterPassword/ObjC/Mac/MPPasswordWindowController.m +++ b/MasterPassword/ObjC/Mac/MPPasswordWindowController.m @@ -32,21 +32,16 @@ [[MPAppDelegate get] addObserverBlock:^(NSString *keyPath, id object, NSDictionary *change, void *context) { [self.userLabel setStringValue:PearlString( @"%@'s password for:", [[MPAppDelegate get] activeUserForThread].name )]; } forKeyPath:@"activeUser" options:NSKeyValueObservingOptionInitial context:nil]; - [[MPAppDelegate get] addObserverBlock:^(NSString *keyPath, id object, NSDictionary *change, void *context) { - if (![MPAppDelegate get].key) { - [self unlock]; - return; - } - - [MPAppDelegate managedObjectContextPerformBlock:^(NSManagedObjectContext *moc) { - if (![MPAlgorithmDefault migrateUser:[[MPAppDelegate get] activeUserForThread]]) - [NSAlert alertWithMessageText:@"Migration Needed" defaultButton:@"OK" alternateButton:nil otherButton:nil - informativeTextWithFormat:@"Certain sites require explicit migration to get updated to the latest version of the " - @"Master Password algorithm. For these sites, a migration button will appear. Migrating these sites will cause " - @"their passwords to change. You'll need to update your profile for that site with the new password."]; - [moc saveToStore]; - }]; - } forKeyPath:@"key" options:NSKeyValueObservingOptionInitial context:nil]; +// [[MPAppDelegate get] addObserverBlock:^(NSString *keyPath, id object, NSDictionary *change, void *context) { +// [MPAppDelegate managedObjectContextPerformBlock:^(NSManagedObjectContext *moc) { +// if (![MPAlgorithmDefault migrateUser:[[MPAppDelegate get] activeUserInContext:moc]]) +// [NSAlert alertWithMessageText:@"Migration Needed" defaultButton:@"OK" alternateButton:nil otherButton:nil +// informativeTextWithFormat:@"Certain sites require explicit migration to get updated to the latest version of the " +// @"Master Password algorithm. For these sites, a migration button will appear. Migrating these sites will cause " +// @"their passwords to change. You'll need to update your profile for that site with the new password."]; +// [moc saveToStore]; +// }]; +// } forKeyPath:@"key" options:NSKeyValueObservingOptionInitial context:nil]; [[NSNotificationCenter defaultCenter] addObserverForName:NSWindowDidBecomeKeyNotification object:self.window queue:nil usingBlock:^(NSNotification *note) { if (!self.inProgress) diff --git a/MasterPassword/ObjC/Mac/MPPasswordWindowController.xib b/MasterPassword/ObjC/Mac/MPPasswordWindowController.xib index 20bbb96a..93ff4af4 100644 --- a/MasterPassword/ObjC/Mac/MPPasswordWindowController.xib +++ b/MasterPassword/ObjC/Mac/MPPasswordWindowController.xib @@ -2,13 +2,13 @@ 1080 - 12C60 - 2840 - 1187.34 - 625.00 + 12D78 + 3084 + 1187.37 + 626.00 com.apple.InterfaceBuilder.CocoaPlugin - 2840 + 3084 IBNSLayoutConstraint @@ -61,6 +61,7 @@ 268 {{131, 163}, {219, 17}} + _NS:1535 YES @@ -101,6 +102,7 @@ 268 {{17, 20}, {446, 17}} + _NS:1505 YES @@ -129,6 +131,7 @@ 268 {{140, 133}, {200, 22}} + _NS:9 YES @@ -159,8 +162,9 @@ 268 - {{17, 61}, {446, 64}} + {{17, 45}, {446, 80}} + 1 @@ -179,7 +183,7 @@ 138412032 S3cretP4s$w0rD - Exo-Black + SourceCodePro-Black 48 16 @@ -197,6 +201,7 @@ {480, 200} + _NS:9 NSView @@ -206,7 +211,7 @@ 268 {{224, 84}, {32, 32}} - + _NS:945 28682 100 @@ -214,11 +219,12 @@ {480, 200} + YES _NS:21 - {{0, 0}, {1680, 1028}} + {{0, 0}, {1920, 1058}} {480, 150} {480, 336} YES @@ -496,38 +502,6 @@ 29 3 - - - 9 - 0 - - 9 - 1 - - 0.0 - - 1000 - - 6 - 24 - 2 - - - - 3 - 0 - - 3 - 1 - - 20 - - 1000 - - 8 - 29 - 3 - 3 @@ -560,6 +534,38 @@ 24 2 + + + 9 + 0 + + 9 + 1 + + 0.0 + + 1000 + + 6 + 24 + 2 + + + + 3 + 0 + + 3 + 1 + + 20 + + 1000 + + 8 + 29 + 3 + 3 @@ -640,6 +646,22 @@ + + + 8 + 0 + + 0 + 1 + + 80 + + 1000 + + 3 + 9 + 1 + @@ -768,20 +790,25 @@ + + 231 + + + com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - + - - + + @@ -792,6 +819,9 @@ com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin + + + com.apple.InterfaceBuilder.CocoaPlugin @@ -841,6 +871,7 @@ com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -848,9 +879,62 @@ - 230 + 231 + + + + + MPPasswordWindowController + NSWindowController + + NSView + NSTextField + NSProgressIndicator + NSTextField + NSTextField + NSTextField + + + + contentContainer + NSView + + + contentField + NSTextField + + + progressView + NSProgressIndicator + + + siteField + NSTextField + + + tipField + NSTextField + + + userLabel + NSTextField + + + + IBProjectSource + ./Classes/MPPasswordWindowController.h + + + + NSLayoutConstraint + NSObject + + IBProjectSource + ./Classes/NSLayoutConstraint.h + + + - 0 IBCocoaFramework YES diff --git a/MasterPassword/ObjC/iOS/MasterPassword-iOS.xcodeproj/xcshareddata/xcschemes/MasterPassword iOS (Development).xcscheme b/MasterPassword/ObjC/iOS/MasterPassword-iOS.xcodeproj/xcshareddata/xcschemes/MasterPassword iOS (Development).xcscheme index ce9bfe3a..bcd6e81a 100644 --- a/MasterPassword/ObjC/iOS/MasterPassword-iOS.xcodeproj/xcshareddata/xcschemes/MasterPassword iOS (Development).xcscheme +++ b/MasterPassword/ObjC/iOS/MasterPassword-iOS.xcodeproj/xcshareddata/xcschemes/MasterPassword iOS (Development).xcscheme @@ -57,6 +57,12 @@ ReferencedContainer = "container:MasterPassword-iOS.xcodeproj"> + + + + diff --git a/todo b/todo index 5b71d095..e026a05e 100644 --- a/todo +++ b/todo @@ -1,2 +1,4 @@ -sometimes after login, when searching there are no results. +sometimes after login, when searching there are no results. (verify - is this still the case?) try yaSSL vs OpenSSL +sometimes after deleting the app and installing it again, the cloud store opens but is empty (import doesn't happen on open). On next open, cloud store is populated before opened (and open operation blocks on importing of logs). +icloud popup appears an addition to setup screen.