From d704f451a30ada5364bff2078406fd4e643bcbaa Mon Sep 17 00:00:00 2001 From: Maarten Billemont Date: Mon, 17 Apr 2017 22:27:36 -0400 Subject: [PATCH] Fixed issue causing emergency generator password button to not respond. --- platform-darwin/Source/MPAppDelegate_Key.m | 2 +- .../Source/iOS/MPEmergencyViewController.h | 2 +- .../Source/iOS/MPEmergencyViewController.m | 32 ++++----- .../Source/iOS/Storyboard.storyboard | 72 +++++++++---------- 4 files changed, 51 insertions(+), 57 deletions(-) diff --git a/platform-darwin/Source/MPAppDelegate_Key.m b/platform-darwin/Source/MPAppDelegate_Key.m index 21c84720..d025c63f 100644 --- a/platform-darwin/Source/MPAppDelegate_Key.m +++ b/platform-darwin/Source/MPAppDelegate_Key.m @@ -82,7 +82,7 @@ static NSDictionary *createKeyQuery(MPUserEntity *user, BOOL newItem, MPKeyOrigi if ([key keyIDForAlgorithm:user.algorithm]) inf( @"Found key in keychain for user: %@", user.userID ); - + else { inf( @"No key found in keychain for user: %@", user.userID ); key = nil; diff --git a/platform-darwin/Source/iOS/MPEmergencyViewController.h b/platform-darwin/Source/iOS/MPEmergencyViewController.h index 93a97232..473cf11d 100644 --- a/platform-darwin/Source/iOS/MPEmergencyViewController.h +++ b/platform-darwin/Source/iOS/MPEmergencyViewController.h @@ -28,7 +28,7 @@ @property(weak, nonatomic) IBOutlet UISegmentedControl *typeControl; @property(weak, nonatomic) IBOutlet UILabel *counterLabel; @property(weak, nonatomic) IBOutlet UIActivityIndicatorView *activity; -@property(weak, nonatomic) IBOutlet UILabel *passwordLabel; +@property(weak, nonatomic) IBOutlet UIButton *passwordButton; @property(weak, nonatomic) IBOutlet UIView *tipContainer; - (IBAction)controlChanged:(UIControl *)control; diff --git a/platform-darwin/Source/iOS/MPEmergencyViewController.m b/platform-darwin/Source/iOS/MPEmergencyViewController.m index e406808d..f64ca1ad 100644 --- a/platform-darwin/Source/iOS/MPEmergencyViewController.m +++ b/platform-darwin/Source/iOS/MPEmergencyViewController.m @@ -81,21 +81,19 @@ [self updatePassword]; } -- (IBAction)copyPassword:(UITapGestureRecognizer *)recognizer { +- (IBAction)copyPassword:(id)sender { - if (recognizer.state == UIGestureRecognizerStateEnded) { - NSString *sitePassword = self.passwordLabel.text; - if ([sitePassword length]) { - [UIPasteboard generalPasteboard].string = sitePassword; - [UIView animateWithDuration:0.3f animations:^{ - self.tipContainer.alpha = 1; - } completion:^(BOOL finished) { - if (finished) - PearlMainQueueAfter( 3, ^{ - self.tipContainer.alpha = 0; - } ); - }]; - } + NSString *sitePassword = [self.passwordButton titleForState:UIControlStateNormal]; + if ([sitePassword length]) { + [UIPasteboard generalPasteboard].string = sitePassword; + [UIView animateWithDuration:0.3f animations:^{ + self.tipContainer.alpha = 1; + } completion:^(BOOL finished) { + if (finished) + PearlMainQueueAfter( 3, ^{ + self.tipContainer.alpha = 0; + } ); + }]; } } @@ -106,7 +104,7 @@ NSString *fullName = self.fullNameField.text; NSString *masterPassword = self.masterPasswordField.text; - self.passwordLabel.text = nil; + [self.passwordButton setTitle:nil forState:UIControlStateNormal]; [self.activity startAnimating]; [_emergencyKeyQueue cancelAllOperations]; [_emergencyKeyQueue addOperationWithBlock:^{ @@ -128,7 +126,7 @@ NSUInteger siteCounter = (NSUInteger)self.counterStepper.value; self.counterLabel.text = strf( @"%lu", (unsigned long)siteCounter ); - self.passwordLabel.text = nil; + [self.passwordButton setTitle:nil forState:UIControlStateNormal]; [self.activity startAnimating]; [_emergencyPasswordQueue cancelAllOperations]; [_emergencyPasswordQueue addOperationWithBlock:^{ @@ -138,7 +136,7 @@ PearlMainQueue( ^{ [self.activity stopAnimating]; - self.passwordLabel.text = sitePassword; + [self.passwordButton setTitle:sitePassword forState:UIControlStateNormal]; } ); }]; } diff --git a/platform-darwin/Source/iOS/Storyboard.storyboard b/platform-darwin/Source/iOS/Storyboard.storyboard index 20f06c85..7013bc53 100644 --- a/platform-darwin/Source/iOS/Storyboard.storyboard +++ b/platform-darwin/Source/iOS/Storyboard.storyboard @@ -511,7 +511,7 @@ - + @@ -629,7 +629,7 @@ - + @@ -791,7 +791,7 @@ - @@ -2005,7 +2001,7 @@ eg. apple.com, rmitchell@twitter.com - + @@ -2256,7 +2252,7 @@ Suspendisse potenti. Etiam ut nisi id augue tempor ultrices et sit amet sapien. - + @@ -3517,8 +3513,8 @@ You can then update your site's account with the new and stronger password. + -