From cd6b83ffe8c0191aa59f48bb9db4018d702a4ee2 Mon Sep 17 00:00:00 2001 From: Maarten Billemont Date: Tue, 7 May 2013 13:25:05 -0400 Subject: [PATCH] iPhone 5 alignment issue in unlock VC. [FIXED] Deselect new user avatar if MOC is unavailable when tapping it. [FIXED] Position of avatars & spinner on iPhone 5. [IMPROVED] Issue button in review dialog. --- External/Pearl | 2 +- .../ObjC/iOS/MPUnlockViewController.m | 25 +++--- .../ObjC/iOS/MainStoryboard_iPhone.storyboard | 86 +++++++++---------- 3 files changed, 59 insertions(+), 54 deletions(-) diff --git a/External/Pearl b/External/Pearl index d6fb1961..2293e3a4 160000 --- a/External/Pearl +++ b/External/Pearl @@ -1 +1 @@ -Subproject commit d6fb1961ac6e218caca34187d0a7066e51983ab0 +Subproject commit 2293e3a48a0e54c09a7ce135c946e4c4ca46bac7 diff --git a/MasterPassword/ObjC/iOS/MPUnlockViewController.m b/MasterPassword/ObjC/iOS/MPUnlockViewController.m index 5803a847..18dde9c6 100644 --- a/MasterPassword/ObjC/iOS/MPUnlockViewController.m +++ b/MasterPassword/ObjC/iOS/MPUnlockViewController.m @@ -14,6 +14,7 @@ #import "MPAppDelegate_Key.h" #import "MPAppDelegate_Store.h" + @interface MPUnlockViewController() @property(strong, nonatomic) NSMutableDictionary *avatarToUserOID; @@ -28,6 +29,7 @@ @property(nonatomic, strong) NSArray *marqueeTipTexts; @end + @implementation MPUnlockViewController { NSManagedObjectID *_selectedUserOID; } @@ -116,8 +118,8 @@ - (void)viewDidLoad { - [self.newsView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString: - PearlString(@"http://www.masterpasswordapp.com/news.html?version=%@", [[PearlInfoPlist get] CFBundleVersion])]]]; + NSString *newsURL = PearlString( @"http://www.masterpasswordapp.com/news.html?version=%@", [[PearlInfoPlist get] CFBundleVersion] ); + [self.newsView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:newsURL]]]; self.avatarToUserOID = [NSMutableDictionary dictionaryWithCapacity:3]; @@ -370,15 +372,17 @@ - (void)didSelectNewUserAvatar:(UIButton *)newUserAvatar { - [MPiOSAppDelegate managedObjectContextPerformBlock:^(NSManagedObjectContext *moc) { - MPUserEntity *newUser = [NSEntityDescription insertNewObjectForEntityForName:NSStringFromClass( [MPUserEntity class] ) - inManagedObjectContext:moc]; + if (![MPiOSAppDelegate managedObjectContextPerformBlock:^(NSManagedObjectContext *moc) { + MPUserEntity + *newUser = [NSEntityDescription insertNewObjectForEntityForName:NSStringFromClass( [MPUserEntity class] ) + inManagedObjectContext:moc]; [self showNewUserNameAlertFor:newUser inContext:moc completion:^(BOOL finished) { newUserAvatar.selected = NO; self.selectedUser = newUser; }]; - }]; + }]) + newUserAvatar.selected = NO; } - (void)showNewUserNameAlertFor:(MPUserEntity *)newUser inContext:(NSManagedObjectContext *)moc @@ -452,7 +456,7 @@ [moc performBlockAndWait:^{ [moc saveToStore]; NSError *error = nil; - if (![moc obtainPermanentIDsForObjects:@[newUser] error:&error]) + if (![moc obtainPermanentIDsForObjects:@[ newUser ] error:&error]) err(@"Failed to obtain permanent object ID for new user: %@", error); }]; completion( YES ); @@ -486,7 +490,7 @@ if (selectedUser && !self.passwordView.alpha) { // User was just selected. self.passwordView.alpha = 1; - self.avatarsView.center = CGPointMake( 160, 180 ); + self.avatarsView.frame = CGRectSetY( self.avatarsView.frame, 16 ); self.avatarsView.scrollEnabled = NO; self.nameLabel.center = CGPointMake( 160, 94 ); self.nameLabel.backgroundColor = [UIColor blackColor]; @@ -497,7 +501,7 @@ // User was just deselected. self.passwordField.text = nil; self.passwordView.alpha = 0; - self.avatarsView.center = CGPointMake( 160, 310 ); + self.avatarsView.frame = CGRectSetY( self.avatarsView.frame, 140 ); self.avatarsView.scrollEnabled = YES; self.nameLabel.center = CGPointMake( 160, 296 ); self.nameLabel.backgroundColor = [UIColor clearColor]; @@ -557,7 +561,8 @@ } recurse:NO]; if (allowScroll) { - CGPoint targetContentOffset = CGPointMake( MAX(0, targetedAvatar.center.x - self.avatarsView.bounds.size.width / 2), + CGPoint targetContentOffset = CGPointMake( + MAX(0, targetedAvatar.center.x - self.avatarsView.bounds.size.width / 2), self.avatarsView.contentOffset.y ); if (!CGPointEqualToPoint( self.avatarsView.contentOffset, targetContentOffset )) [self.avatarsView setContentOffset:targetContentOffset animated:animated]; diff --git a/MasterPassword/ObjC/iOS/MainStoryboard_iPhone.storyboard b/MasterPassword/ObjC/iOS/MainStoryboard_iPhone.storyboard index 589cc276..79f798df 100644 --- a/MasterPassword/ObjC/iOS/MainStoryboard_iPhone.storyboard +++ b/MasterPassword/ObjC/iOS/MainStoryboard_iPhone.storyboard @@ -9,7 +9,7 @@ - + @@ -481,15 +481,15 @@ Your passwords will be AES-encrypted with your master password. - + - + - + 119-20:51:52 MPiOSAppDelegate.m:36 | INFO : Initializing TestFlight @@ -519,7 +519,7 @@ Your passwords will be AES-encrypted with your master password. - + @@ -574,11 +574,11 @@ Your passwords will be AES-encrypted with your master password. - + - + @@ -758,7 +758,7 @@ Your passwords will be AES-encrypted with your master password. - + @@ -921,7 +921,7 @@ Your passwords will be AES-encrypted with your master password.