From cdfafa55cf99f2b23fb4c2f7e68a19fa2ad8a3b3 Mon Sep 17 00:00:00 2001 From: Maarten Billemont Date: Sat, 12 May 2012 00:08:19 +0200 Subject: [PATCH] Fix sign-out. [FIXED] MP-13: Sign Out doesn't work -- when password is saved, signing out signs you right back in. Now, the saved key password is forgotten. --- MasterPassword/iOS/MPAppDelegate.m | 31 ++++++++++++++--------- MasterPassword/iOS/MPMainViewController.m | 1 + 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/MasterPassword/iOS/MPAppDelegate.m b/MasterPassword/iOS/MPAppDelegate.m index 452ca670..3b5d446b 100644 --- a/MasterPassword/iOS/MPAppDelegate.m +++ b/MasterPassword/iOS/MPAppDelegate.m @@ -114,6 +114,25 @@ [self.window.rootViewController presentModalViewController:composer animated:YES]; } +#pragma mark - PearlConfigDelegate + +- (void)didUpdateConfigForKey:(SEL)configKey fromValue:(id)value { + + [self checkConfig]; +} + +- (void)checkConfig { + + if ([[MPConfig get].saveKey boolValue]) { + if (self.key) + [self updateKey:self.key]; + } else + [self loadStoredKey]; + + if ([[MPConfig get].iCloud boolValue] != [self.storeManager iCloudEnabled]) + [self.storeManager useiCloudStore:[[MPConfig get].iCloud boolValue] alertUser:YES]; +} + #pragma mark - UIApplicationDelegate @@ -367,18 +386,6 @@ [TestFlight passCheckpoint:MPTestFlightCheckpointDeactivated]; } -- (void)checkConfig { - - if ([[MPConfig get].saveKey boolValue]) { - if (self.key) - [self updateKey:self.key]; - } else - [self loadStoredKey]; - - if ([[MPConfig get].iCloud boolValue] != [self.storeManager iCloudEnabled]) - [self.storeManager useiCloudStore:[[MPConfig get].iCloud boolValue] alertUser:YES]; -} - #pragma mark - MFMailComposeViewControllerDelegate - (void)mailComposeController:(MFMailComposeViewController *)controller diff --git a/MasterPassword/iOS/MPMainViewController.m b/MasterPassword/iOS/MPMainViewController.m index 60d70c28..1f48043f 100644 --- a/MasterPassword/iOS/MPMainViewController.m +++ b/MasterPassword/iOS/MPMainViewController.m @@ -434,6 +434,7 @@ #endif #endif { + [MPConfig get].saveKey = [NSNumber numberWithBool:NO]; [[MPAppDelegate get] signOut:self]; [[MPAppDelegate get] loadKey:YES]; break;