Fix infinite loop when enabling iCloud.
[FIXED] When enabling iCloud and setting the local user defaults, we re-started enabling iCloud and updating local user defaults.
This commit is contained in:
parent
db55634ab2
commit
789aa26066
@ -290,21 +290,21 @@ static OSStatus MPHotKeyHander(EventHandlerCallRef nextHandler, EventRef theEven
|
|||||||
[[NSNotificationCenter defaultCenter] addObserverForName:MPCheckConfigNotification object:nil
|
[[NSNotificationCenter defaultCenter] addObserverForName:MPCheckConfigNotification object:nil
|
||||||
queue:[NSOperationQueue mainQueue] usingBlock:
|
queue:[NSOperationQueue mainQueue] usingBlock:
|
||||||
^(NSNotification *note) {
|
^(NSNotification *note) {
|
||||||
self.rememberPasswordItem.state = [[MPConfig get].rememberLogin boolValue]? NSOnState: NSOffState;
|
NSString *key = note.object;
|
||||||
self.savePasswordItem.state = [[MPMacAppDelegate get] activeUserForMainThread].saveKey? NSOnState: NSOffState;
|
if (!key || [key isEqualToString:NSStringFromSelector( @selector( rememberLogin ) )])
|
||||||
self.dialogStyleRegular.state = ![[MPMacConfig get].dialogStyleHUD boolValue]? NSOnState: NSOffState;
|
self.rememberPasswordItem.state = [[MPConfig get].rememberLogin boolValue]? NSOnState: NSOffState;
|
||||||
self.dialogStyleHUD.state = [[MPMacConfig get].dialogStyleHUD boolValue]? NSOnState: NSOffState;
|
if (!key || [key isEqualToString:NSStringFromSelector( @selector( dialogStyleHUD ) )]) {
|
||||||
|
self.dialogStyleRegular.state = ![[MPMacConfig get].dialogStyleHUD boolValue]? NSOnState: NSOffState;
|
||||||
if ([note.object isEqual:NSStringFromSelector( @selector(dialogStyleHUD) )]) {
|
self.dialogStyleHUD.state = [[MPMacConfig get].dialogStyleHUD boolValue]? NSOnState: NSOffState;
|
||||||
if (![self.passwordWindow.window isVisible])
|
if (![self.passwordWindow.window isVisible])
|
||||||
self.passwordWindow = nil;
|
self.passwordWindow = nil;
|
||||||
else {
|
else {
|
||||||
[self.passwordWindow close];
|
[self.passwordWindow close];
|
||||||
self.passwordWindow = nil;
|
self.passwordWindow = nil;
|
||||||
[self showPasswordWindow:nil];
|
[self showPasswordWindow:nil];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}];
|
}];
|
||||||
[self updateUsers];
|
[self updateUsers];
|
||||||
|
|
||||||
// Global hotkey.
|
// Global hotkey.
|
||||||
|
@ -64,7 +64,7 @@
|
|||||||
|
|
||||||
[self registerObservers];
|
[self registerObservers];
|
||||||
[self observeStore];
|
[self observeStore];
|
||||||
[self updateFromConfig];
|
[self updateConfigKey:nil];
|
||||||
[self updatePasswords];
|
[self updatePasswords];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -175,7 +175,8 @@ referenceSizeForHeaderInSection:(NSInteger)section {
|
|||||||
|
|
||||||
if (controller == _fetchedResultsController) {
|
if (controller == _fetchedResultsController) {
|
||||||
[self.passwordCollectionView reloadSections:[NSIndexSet indexSetWithIndex:indexPath.section]];
|
[self.passwordCollectionView reloadSections:[NSIndexSet indexSetWithIndex:indexPath.section]];
|
||||||
[self.passwordCollectionView reloadSections:[NSIndexSet indexSetWithIndex:newIndexPath.section]];
|
if (![newIndexPath isEqual:indexPath])
|
||||||
|
[self.passwordCollectionView reloadSections:[NSIndexSet indexSetWithIndex:newIndexPath.section]];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -267,9 +268,9 @@ referenceSizeForHeaderInSection:(NSInteger)section {
|
|||||||
}];
|
}];
|
||||||
}],
|
}],
|
||||||
[[NSNotificationCenter defaultCenter]
|
[[NSNotificationCenter defaultCenter]
|
||||||
addObserverForName:MPCheckConfigNotification object:nil
|
addObserverForName:MPCheckConfigNotification object:nil queue:[NSOperationQueue mainQueue]
|
||||||
queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *note) {
|
usingBlock:^(NSNotification *note) {
|
||||||
[self updateFromConfig];
|
[self updateConfigKey:note.object];
|
||||||
}],
|
}],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@ -311,9 +312,10 @@ referenceSizeForHeaderInSection:(NSInteger)section {
|
|||||||
[[NSNotificationCenter defaultCenter] removeObserver:_storeObserver];
|
[[NSNotificationCenter defaultCenter] removeObserver:_storeObserver];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)updateFromConfig {
|
- (void)updateConfigKey:(NSString *)key {
|
||||||
|
|
||||||
self.passwordsSearchBar.keyboardType = [[MPiOSConfig get].dictationSearch boolValue]? UIKeyboardTypeDefault: UIKeyboardTypeURL;
|
if (!key || [key isEqualToString:NSStringFromSelector( @selector(dictationSearch) )])
|
||||||
|
self.passwordsSearchBar.keyboardType = [[MPiOSConfig get].dictationSearch boolValue]? UIKeyboardTypeDefault: UIKeyboardTypeURL;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)updatePasswords {
|
- (void)updatePasswords {
|
||||||
|
@ -757,34 +757,34 @@ typedef NS_ENUM(NSUInteger, MPActiveUserState) {
|
|||||||
case MPActiveUserStateLogin: {
|
case MPActiveUserStateLogin: {
|
||||||
dbg(@"activeUserState -> login");
|
dbg(@"activeUserState -> login");
|
||||||
self.entryLabel.text = strl( @"Enter your master password:" );
|
self.entryLabel.text = strl( @"Enter your master password:" );
|
||||||
self.entryField.text = nil;
|
|
||||||
self.entryField.secureTextEntry = YES;
|
self.entryField.secureTextEntry = YES;
|
||||||
self.entryField.autocapitalizationType = UITextAutocapitalizationTypeNone;
|
self.entryField.autocapitalizationType = UITextAutocapitalizationTypeNone;
|
||||||
|
self.entryField.text = nil;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case MPActiveUserStateUserName: {
|
case MPActiveUserStateUserName: {
|
||||||
dbg(@"activeUserState -> userName");
|
dbg(@"activeUserState -> userName");
|
||||||
self.entryLabel.text = strl( @"Enter your full name:" );
|
self.entryLabel.text = strl( @"Enter your full name:" );
|
||||||
self.entryField.text = nil;
|
|
||||||
self.entryField.secureTextEntry = NO;
|
self.entryField.secureTextEntry = NO;
|
||||||
self.entryField.autocapitalizationType = UITextAutocapitalizationTypeWords;
|
self.entryField.autocapitalizationType = UITextAutocapitalizationTypeWords;
|
||||||
|
self.entryField.text = nil;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case MPActiveUserStateMasterPasswordChoice: {
|
case MPActiveUserStateMasterPasswordChoice: {
|
||||||
dbg(@"activeUserState -> masterPasswordChoice");
|
dbg(@"activeUserState -> masterPasswordChoice");
|
||||||
self.entryLabel.text = strl( @"Choose your master password:" );
|
self.entryLabel.text = strl( @"Choose your master password:" );
|
||||||
self.entryField.text = nil;
|
|
||||||
self.entryField.secureTextEntry = YES;
|
self.entryField.secureTextEntry = YES;
|
||||||
self.entryField.autocapitalizationType = UITextAutocapitalizationTypeNone;
|
self.entryField.autocapitalizationType = UITextAutocapitalizationTypeNone;
|
||||||
|
self.entryField.text = nil;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case MPActiveUserStateMasterPasswordConfirmation: {
|
case MPActiveUserStateMasterPasswordConfirmation: {
|
||||||
dbg(@"activeUserState -> masterPasswordConfirmation");
|
dbg(@"activeUserState -> masterPasswordConfirmation");
|
||||||
_masterPasswordChoice = self.entryField.text;
|
_masterPasswordChoice = self.entryField.text;
|
||||||
self.entryLabel.text = strl( @"Confirm your master password:" );
|
self.entryLabel.text = strl( @"Confirm your master password:" );
|
||||||
self.entryField.text = nil;
|
|
||||||
self.entryField.secureTextEntry = YES;
|
self.entryField.secureTextEntry = YES;
|
||||||
self.entryField.autocapitalizationType = UITextAutocapitalizationTypeNone;
|
self.entryField.autocapitalizationType = UITextAutocapitalizationTypeNone;
|
||||||
|
self.entryField.text = nil;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case MPActiveUserStateMinimized:
|
case MPActiveUserStateMinimized:
|
||||||
|
@ -93,17 +93,17 @@
|
|||||||
err( @"During Analytics Setup: %@", exception );
|
err( @"During Analytics Setup: %@", exception );
|
||||||
}
|
}
|
||||||
@try {
|
@try {
|
||||||
[[NSNotificationCenter defaultCenter] addObserverForName:MPCheckConfigNotification object:nil queue:nil usingBlock:
|
[[NSNotificationCenter defaultCenter] addObserverForName:MPCheckConfigNotification object:nil queue:[NSOperationQueue mainQueue]
|
||||||
^(NSNotification *note) {
|
usingBlock:^(NSNotification *note) {
|
||||||
[self updateFromConfig];
|
[self updateConfigKey:note.object];
|
||||||
}];
|
}];
|
||||||
[[NSNotificationCenter defaultCenter] addObserverForName:kIASKAppSettingChanged object:nil queue:nil usingBlock:
|
[[NSNotificationCenter defaultCenter] addObserverForName:kIASKAppSettingChanged object:nil queue:nil usingBlock:
|
||||||
^(NSNotification *note) {
|
^(NSNotification *note) {
|
||||||
[[NSNotificationCenter defaultCenter] postNotificationName:MPCheckConfigNotification object:note userInfo:nil];
|
[[NSNotificationCenter defaultCenter] postNotificationName:MPCheckConfigNotification object:note.object];
|
||||||
}];
|
}];
|
||||||
[[NSNotificationCenter defaultCenter] addObserverForName:NSUserDefaultsDidChangeNotification object:nil queue:nil usingBlock:
|
[[NSNotificationCenter defaultCenter] addObserverForName:NSUserDefaultsDidChangeNotification object:nil queue:nil usingBlock:
|
||||||
^(NSNotification *note) {
|
^(NSNotification *note) {
|
||||||
[[NSNotificationCenter defaultCenter] postNotificationName:MPCheckConfigNotification object:note userInfo:nil];
|
[[NSNotificationCenter defaultCenter] postNotificationName:MPCheckConfigNotification object:nil];
|
||||||
}];
|
}];
|
||||||
|
|
||||||
#ifdef ADHOC
|
#ifdef ADHOC
|
||||||
@ -292,7 +292,7 @@
|
|||||||
- (void)applicationDidBecomeActive:(UIApplication *)application {
|
- (void)applicationDidBecomeActive:(UIApplication *)application {
|
||||||
|
|
||||||
inf( @"Re-activated" );
|
inf( @"Re-activated" );
|
||||||
[[NSNotificationCenter defaultCenter] postNotificationName:MPCheckConfigNotification object:application];
|
[[NSNotificationCenter defaultCenter] postNotificationName:MPCheckConfigNotification object:nil];
|
||||||
|
|
||||||
[super applicationDidBecomeActive:application];
|
[super applicationDidBecomeActive:application];
|
||||||
}
|
}
|
||||||
@ -475,7 +475,7 @@
|
|||||||
[[NSNotificationCenter defaultCenter] postNotificationName:MPCheckConfigNotification object:NSStringFromSelector( configKey )];
|
[[NSNotificationCenter defaultCenter] postNotificationName:MPCheckConfigNotification object:NSStringFromSelector( configKey )];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)updateFromConfig {
|
- (void)updateConfigKey:(NSString *)key {
|
||||||
|
|
||||||
// iCloud enabled / disabled
|
// iCloud enabled / disabled
|
||||||
BOOL iCloudEnabled = [[MPiOSConfig get].iCloudEnabled boolValue];
|
BOOL iCloudEnabled = [[MPiOSConfig get].iCloudEnabled boolValue];
|
||||||
|
Loading…
Reference in New Issue
Block a user