iCloud availability check.
[UPDATED] Disable iCloud preference when iCloud is unavailable. [FIXED] Username in incorrect-mp error popup.
This commit is contained in:
parent
af1efe7bc6
commit
35a600080b
2
External/UbiquityStoreManager
vendored
2
External/UbiquityStoreManager
vendored
@ -1 +1 @@
|
||||
Subproject commit f2341a290e66796df0e7b555a24e33f5470ff7f5
|
||||
Subproject commit 174f955efa883b58d37bc8b2ee93142e98c64f81
|
@ -224,10 +224,13 @@ static OSStatus MPHotKeyHander(EventHandlerCallRef nextHandler, EventRef theEven
|
||||
__weak id weakSelf = self;
|
||||
[self addObserverBlock:^(NSString *keyPath, id object, NSDictionary *change, void *context) {
|
||||
[weakSelf updateMenuItems];
|
||||
} forKeyPath:@"key" options:NSKeyValueObservingOptionInitial context:nil];
|
||||
} forKeyPath:@"key" options:0 context:nil];
|
||||
[self addObserverBlock:^(NSString *keyPath, id object, NSDictionary *change, void *context) {
|
||||
[weakSelf updateMenuItems];
|
||||
} forKeyPath:@"activeUser" options:NSKeyValueObservingOptionInitial context:nil];
|
||||
} forKeyPath:@"activeUser" options:0 context:nil];
|
||||
[self addObserverBlock:^(NSString *keyPath, id object, NSDictionary *change, void *context) {
|
||||
[weakSelf updateMenuItems];
|
||||
} forKeyPath:@"storeManager.cloudAvailable" options:0 context:nil];
|
||||
|
||||
// Status item.
|
||||
self.statusItem = [[NSStatusBar systemStatusBar] statusItemWithLength:NSSquareStatusItemLength];
|
||||
@ -358,6 +361,15 @@ static OSStatus MPHotKeyHander(EventHandlerCallRef nextHandler, EventRef theEven
|
||||
}
|
||||
|
||||
self.useICloudItem.state = self.storeManager.cloudEnabled? NSOnState: NSOffState;
|
||||
self.useICloudItem.enabled = self.storeManager.cloudAvailable;
|
||||
if (self.storeManager.cloudAvailable) {
|
||||
self.useICloudItem.title = @"Use iCloud";
|
||||
self.useICloudItem.toolTip = nil;
|
||||
}
|
||||
else {
|
||||
self.useICloudItem.title = @"Use iCloud (Unavailable)";
|
||||
self.useICloudItem.toolTip = @"iCloud is not set up for your Mac user.";
|
||||
}
|
||||
}
|
||||
|
||||
- (IBAction)showPasswordWindow:(id)sender {
|
||||
|
@ -60,8 +60,11 @@
|
||||
}];
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
addObserverForName:NSWindowWillCloseNotification object:self.window queue:nil usingBlock:^(NSNotification *note) {
|
||||
[NSApp endSheet:[self.window attachedSheet]];
|
||||
[[NSApplication sharedApplication] hide:nil];
|
||||
NSWindow *sheet = [self.window attachedSheet];
|
||||
if (sheet)
|
||||
[NSApp endSheet:sheet];
|
||||
|
||||
[NSApp hide:nil];
|
||||
}];
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
addObserverForName:MPSignedOutNotification object:nil queue:nil usingBlock:^(NSNotification *note) {
|
||||
@ -201,6 +204,7 @@
|
||||
NSString *password = [(NSSecureTextField *)alert.accessoryView stringValue];
|
||||
[MPMacAppDelegate managedObjectContextPerformBlock:^(NSManagedObjectContext *moc) {
|
||||
MPUserEntity *activeUser = [[MPMacAppDelegate get] activeUserInContext:moc];
|
||||
NSString *userName = activeUser.name;
|
||||
BOOL success = [[MPMacAppDelegate get] signInAsUser:activeUser saveInContext:moc
|
||||
usingMasterPassword:password];
|
||||
self.inProgress = NO;
|
||||
@ -212,7 +216,7 @@
|
||||
self.contentContainer.alphaValue = 1;
|
||||
else {
|
||||
[[NSAlert alertWithError:[NSError errorWithDomain:MPErrorDomain code:0 userInfo:@{
|
||||
NSLocalizedDescriptionKey : PearlString( @"Incorrect master password for user %@", activeUser.name )
|
||||
NSLocalizedDescriptionKey : PearlString( @"Incorrect master password for user %@", userName )
|
||||
}]] beginSheetModalForWindow:self.window modalDelegate:self
|
||||
didEndSelector:@selector(alertDidEnd:returnCode:contextInfo:) contextInfo:MPAlertIncorrectMP];
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user