From b38e8d9ea69c261cfcdde8edf4a04bcfe2e60635 Mon Sep 17 00:00:00 2001 From: Maarten Billemont Date: Sun, 5 Aug 2012 11:18:58 +0200 Subject: [PATCH] Fix appearance of the Guide on start-up. [FIXED] When the unlock VC shows, the guide's appearance is aborted. --- MasterPassword/iOS/MPAppDelegate.m | 3 - MasterPassword/iOS/MPMainViewController.m | 60 ++++++++++--------- MasterPassword/iOS/MPUnlockViewController.m | 2 + .../iOS/MainStoryboard_iPhone.storyboard | 10 ++-- 4 files changed, 40 insertions(+), 35 deletions(-) diff --git a/MasterPassword/iOS/MPAppDelegate.m b/MasterPassword/iOS/MPAppDelegate.m index 8298de6d..57bf674f 100644 --- a/MasterPassword/iOS/MPAppDelegate.m +++ b/MasterPassword/iOS/MPAppDelegate.m @@ -297,9 +297,6 @@ inf(@"Re-activated"); [[MPAppDelegate get] checkConfig]; - if ([[MPiOSConfig get].showQuickStart boolValue]) - [self showGuide]; - [TestFlight passCheckpoint:MPCheckpointActivated]; [super applicationDidBecomeActive:application]; diff --git a/MasterPassword/iOS/MPMainViewController.m b/MasterPassword/iOS/MPMainViewController.m index 0f47c258..2de8f9f1 100644 --- a/MasterPassword/iOS/MPMainViewController.m +++ b/MasterPassword/iOS/MPMainViewController.m @@ -120,9 +120,9 @@ inf(@"Main will appear."); [[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:animated? UIStatusBarAnimationSlide: UIStatusBarAnimationNone]; - if (![MPAppDelegate get].activeUser) - [self.navigationController presentViewController:[self.storyboard instantiateViewControllerWithIdentifier:@"MPUnlockViewController"] - animated:animated completion:nil]; + if ([[MPiOSConfig get].showQuickStart boolValue]) + [[MPAppDelegate get] showGuide]; + if (self.activeElement.user != [MPAppDelegate get].activeUser) self.activeElement = nil; self.searchDisplayController.searchBar.text = nil; @@ -136,6 +136,35 @@ [self updateAnimated:animated]; + [super viewWillAppear:animated]; +} + +- (void)viewDidAppear:(BOOL)animated { + + if (![MPAppDelegate get].activeUser) + [self.navigationController presentViewController:[self.storyboard instantiateViewControllerWithIdentifier:@"MPUnlockViewController"] + animated:animated completion:nil]; + + if (![[MPiOSConfig get].actionsTipShown boolValue]) + [UIView animateWithDuration:animated? 0.3f: 0 animations:^{ + self.actionsTipContainer.alpha = 1; + } completion:^(BOOL finished) { + if (finished) { + [MPiOSConfig get].actionsTipShown = PearlBool(YES); + + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(5.0f * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + [UIView animateWithDuration:0.2f animations:^{ + self.actionsTipContainer.alpha = 0; + } completion:^(BOOL finished_) { + if (![self.activeElement.name length]) + [UIView animateWithDuration:animated? 0.3f: 0 animations:^{ + self.searchTipContainer.alpha = 1; + }]; + }]; + }); + } + }]; + if ([MPAppDelegate get].activeUser) [[MPAppDelegate get].managedObjectContextIfReady performBlock:^void() { NSError *error = nil; @@ -163,31 +192,6 @@ }]; - [super viewWillAppear:animated]; -} - -- (void)viewDidAppear:(BOOL)animated { - - if (![[MPiOSConfig get].actionsTipShown boolValue]) - [UIView animateWithDuration:animated? 0.3f: 0 animations:^{ - self.actionsTipContainer.alpha = 1; - } completion:^(BOOL finished) { - if (finished) { - [MPiOSConfig get].actionsTipShown = PearlBool(YES); - - dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(5.0f * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ - [UIView animateWithDuration:0.2f animations:^{ - self.actionsTipContainer.alpha = 0; - } completion:^(BOOL finished_) { - if (![self.activeElement.name length]) - [UIView animateWithDuration:animated? 0.3f: 0 animations:^{ - self.searchTipContainer.alpha = 1; - }]; - }]; - }); - } - }]; - [super viewDidAppear:animated]; } diff --git a/MasterPassword/iOS/MPUnlockViewController.m b/MasterPassword/iOS/MPUnlockViewController.m index 715ecc9a..0b836c41 100644 --- a/MasterPassword/iOS/MPUnlockViewController.m +++ b/MasterPassword/iOS/MPUnlockViewController.m @@ -194,6 +194,8 @@ if (!animated) [[self findTargetedAvatar] setSelected:YES]; + else + [self updateLayoutAnimated:YES allowScroll:YES completion:nil]; [super viewDidAppear:animated]; } diff --git a/MasterPassword/iOS/MainStoryboard_iPhone.storyboard b/MasterPassword/iOS/MainStoryboard_iPhone.storyboard index 9c69f411..8d14e069 100644 --- a/MasterPassword/iOS/MainStoryboard_iPhone.storyboard +++ b/MasterPassword/iOS/MainStoryboard_iPhone.storyboard @@ -1,6 +1,7 @@ + @@ -875,6 +876,7 @@ You should upgrade these sites and update their account's passwords as soon as i + @@ -1426,7 +1428,6 @@ You could use the word wall for inspiration in finding a memorable master passw - @@ -1437,6 +1438,7 @@ You could use the word wall for inspiration in finding a memorable master passw + @@ -1928,7 +1930,6 @@ You could use the word wall for inspiration in finding a memorable master passw - @@ -1939,6 +1940,7 @@ You could use the word wall for inspiration in finding a memorable master passw + @@ -1949,6 +1951,6 @@ You could use the word wall for inspiration in finding a memorable master passw - + - + \ No newline at end of file