2
0

Weird layout problems now when building from Xcode 6..

This commit is contained in:
Maarten Billemont 2014-09-11 00:26:01 -04:00
parent fecbd2ea1c
commit 6e14554f95
7 changed files with 191 additions and 194 deletions

2
External/Pearl vendored

@ -1 +1 @@
Subproject commit 6f399eccdc5cc016cdc898778845675bbe624cd3 Subproject commit 047cab4e60a35090eb901e61d9fd76e55afff0ac

View File

@ -1,12 +1,12 @@
/** /**
* Copyright Maarten Billemont (http://www.lhunath.com, lhunath@lyndir.com) * Copyright Maarten Billemont (http://www.lhunath.com, lhunath@lyndir.com)
* *
* See the enclosed file LICENSE for license information (LGPLv3). If you did * See the enclosed file LICENSE for license information (LGPLv3). If you did
* not receive this file, see http://www.gnu.org/licenses/lgpl-3.0.txt * not receive this file, see http://www.gnu.org/licenses/lgpl-3.0.txt
* *
* @author Maarten Billemont <lhunath@lyndir.com> * @author Maarten Billemont <lhunath@lyndir.com>
* @license http://www.gnu.org/licenses/lgpl-3.0.txt * @license http://www.gnu.org/licenses/lgpl-3.0.txt
*/ */
// //
// MPAvatarCell.h // MPAvatarCell.h
@ -88,9 +88,9 @@ const long MPAvatarAdd = 10000;
[super prepareForReuse]; [super prepareForReuse];
_newUser = NO; _newUser = NO;
[self setVisibility:0 animated:NO]; _visibility = 0;
[self setMode:MPAvatarModeLowered animated:NO]; _mode = MPAvatarModeLowered;
[self setSpinnerActive:NO animated:NO]; _spinnerActive = NO;
} }
- (void)dealloc { - (void)dealloc {
@ -130,6 +130,8 @@ const long MPAvatarAdd = 10000;
- (void)setVisibility:(CGFloat)visibility animated:(BOOL)animated { - (void)setVisibility:(CGFloat)visibility animated:(BOOL)animated {
if (visibility == _visibility)
return;
_visibility = visibility; _visibility = visibility;
[self updateAnimated:animated]; [self updateAnimated:animated];
@ -149,6 +151,8 @@ const long MPAvatarAdd = 10000;
- (void)setMode:(MPAvatarMode)mode animated:(BOOL)animated { - (void)setMode:(MPAvatarMode)mode animated:(BOOL)animated {
if (mode == _mode)
return;
_mode = mode; _mode = mode;
[self updateAnimated:animated]; [self updateAnimated:animated];
@ -189,10 +193,13 @@ const long MPAvatarAdd = 10000;
- (void)updateAnimated:(BOOL)animated { - (void)updateAnimated:(BOOL)animated {
[self.contentView layoutIfNeeded];
[UIView animateWithDuration:animated? 0.2f: 0 animations:^{ [UIView animateWithDuration:animated? 0.2f: 0 animations:^{
self.avatarImageView.transform = CGAffineTransformIdentity; self.avatarImageView.transform = CGAffineTransformIdentity;
}]; }];
[UIView animateWithDuration:animated? 0.3f: 0 delay:0 options:UIViewAnimationOptionOverrideInheritedDuration animations:^{ [UIView animateWithDuration:animated? 0.7f: 0 delay:0
options:UIViewAnimationOptionOverrideInheritedDuration | UIViewAnimationOptionBeginFromCurrentState
animations:^{
self.alpha = 1; self.alpha = 1;
if (self.newUser) { if (self.newUser) {
@ -261,7 +268,7 @@ const long MPAvatarAdd = 10000;
// Avatar minimized. // Avatar minimized.
if (self.mode == MPAvatarModeRaisedAndMinimized) if (self.mode == MPAvatarModeRaisedAndMinimized)
[self.avatarImageView.layer removeAllAnimations]; [self.avatarImageView.layer removeAnimationForKey:@"targetedShadow"];
else if (![self.avatarImageView.layer animationForKey:@"targetedShadow"]) else if (![self.avatarImageView.layer animationForKey:@"targetedShadow"])
[self.avatarImageView.layer addAnimation:_targetedShadowAnimation forKey:@"targetedShadow"]; [self.avatarImageView.layer addAnimation:_targetedShadowAnimation forKey:@"targetedShadow"];
@ -273,7 +280,7 @@ const long MPAvatarAdd = 10000;
self.avatarImageView.layer.cornerRadius = self.avatarImageView.bounds.size.height / 2; self.avatarImageView.layer.cornerRadius = self.avatarImageView.bounds.size.height / 2;
self.spinner.alpha = self.spinnerActive? 1: 0; self.spinner.alpha = self.spinnerActive? 1: 0;
[self layoutSubviews]; [self.contentView layoutIfNeeded];
} completion:nil]; } completion:nil];
} }

View File

@ -215,6 +215,7 @@ referenceSizeForHeaderInSection:(NSInteger)section {
if (_passwordsDismissRecognizer) if (_passwordsDismissRecognizer)
[self.view removeGestureRecognizer:_passwordsDismissRecognizer]; [self.view removeGestureRecognizer:_passwordsDismissRecognizer];
[self updatePasswords];
[UIView animateWithDuration:0.3f animations:^{ [UIView animateWithDuration:0.3f animations:^{
self.passwordCollectionView.backgroundColor = _backgroundColor; self.passwordCollectionView.backgroundColor = _backgroundColor;
}]; }];
@ -223,6 +224,7 @@ referenceSizeForHeaderInSection:(NSInteger)section {
- (void)searchBarCancelButtonClicked:(UISearchBar *)searchBar { - (void)searchBarCancelButtonClicked:(UISearchBar *)searchBar {
searchBar.text = nil;
[searchBar resignFirstResponder]; [searchBar resignFirstResponder];
} }

View File

@ -19,7 +19,6 @@
@interface MPUsersViewController : UIViewController <UICollectionViewDataSource, UICollectionViewDelegateFlowLayout, UITextFieldDelegate> @interface MPUsersViewController : UIViewController <UICollectionViewDataSource, UICollectionViewDelegateFlowLayout, UITextFieldDelegate>
@property (strong, nonatomic) IBOutlet UINavigationBar *navigationBar;
@property(weak, nonatomic) IBOutlet UIView *userSelectionContainer; @property(weak, nonatomic) IBOutlet UIView *userSelectionContainer;
@property(weak, nonatomic) IBOutlet UIButton *marqueeButton; @property(weak, nonatomic) IBOutlet UIButton *marqueeButton;
@property(weak, nonatomic) IBOutlet UIView *gitTipTip; @property(weak, nonatomic) IBOutlet UIView *gitTipTip;
@ -32,7 +31,6 @@
@property(weak, nonatomic) IBOutlet UIView *footerContainer; @property(weak, nonatomic) IBOutlet UIView *footerContainer;
@property(weak, nonatomic) IBOutlet UIActivityIndicatorView *storeLoadingActivity; @property(weak, nonatomic) IBOutlet UIActivityIndicatorView *storeLoadingActivity;
@property(weak, nonatomic) IBOutlet UICollectionView *avatarCollectionView; @property(weak, nonatomic) IBOutlet UICollectionView *avatarCollectionView;
@property (strong, nonatomic) IBOutlet NSLayoutConstraint *navigationBarToTopConstraint;
@property (strong, nonatomic) IBOutlet UIButton *nextAvatarButton; @property (strong, nonatomic) IBOutlet UIButton *nextAvatarButton;
@property (strong, nonatomic) IBOutlet UIButton *previousAvatarButton; @property (strong, nonatomic) IBOutlet UIButton *previousAvatarButton;

View File

@ -1,12 +1,12 @@
/** /**
* Copyright Maarten Billemont (http://www.lhunath.com, lhunath@lyndir.com) * Copyright Maarten Billemont (http://www.lhunath.com, lhunath@lyndir.com)
* *
* See the enclosed file LICENSE for license information (LGPLv3). If you did * See the enclosed file LICENSE for license information (LGPLv3). If you did
* not receive this file, see http://www.gnu.org/licenses/lgpl-3.0.txt * not receive this file, see http://www.gnu.org/licenses/lgpl-3.0.txt
* *
* @author Maarten Billemont <lhunath@lyndir.com> * @author Maarten Billemont <lhunath@lyndir.com>
* @license http://www.gnu.org/licenses/lgpl-3.0.txt * @license http://www.gnu.org/licenses/lgpl-3.0.txt
*/ */
// //
// MPCombinedViewController.h // MPCombinedViewController.h
@ -26,7 +26,7 @@
#import "MPWebViewController.h" #import "MPWebViewController.h"
#import "UIView+FontScale.h" #import "UIView+FontScale.h"
typedef NS_ENUM(NSUInteger, MPActiveUserState) { typedef NS_ENUM( NSUInteger, MPActiveUserState ) {
/** The users are all inactive */ /** The users are all inactive */
MPActiveUserStateNone, MPActiveUserStateNone,
/** The selected user is activated and being logged in with */ /** The selected user is activated and being logged in with */
@ -73,7 +73,7 @@ typedef NS_ENUM(NSUInteger, MPActiveUserState) {
self.view.backgroundColor = [UIColor clearColor]; self.view.backgroundColor = [UIColor clearColor];
self.avatarCollectionView.allowsMultipleSelection = YES; self.avatarCollectionView.allowsMultipleSelection = YES;
[self.entryField addTarget:self action:@selector(textFieldEditingChanged:) forControlEvents:UIControlEventEditingChanged]; [self.entryField addTarget:self action:@selector( textFieldEditingChanged: ) forControlEvents:UIControlEventEditingChanged];
[self setActive:YES animated:NO]; [self setActive:YES animated:NO];
} }
@ -89,7 +89,7 @@ typedef NS_ENUM(NSUInteger, MPActiveUserState) {
[self reloadUsers]; [self reloadUsers];
[self.marqueeTipTimer invalidate]; [self.marqueeTipTimer invalidate];
self.marqueeTipTimer = [NSTimer scheduledTimerWithTimeInterval:5 target:self selector:@selector(firedMarqueeTimer:) self.marqueeTipTimer = [NSTimer scheduledTimerWithTimeInterval:5 target:self selector:@selector( firedMarqueeTimer: )
userInfo:nil repeats:YES]; userInfo:nil repeats:YES];
[self firedMarqueeTimer:nil]; [self firedMarqueeTimer:nil];
} }
@ -266,7 +266,7 @@ typedef NS_ENUM(NSUInteger, MPActiveUserState) {
return CGSizeMake( parentSize.width / 2, parentSize.height ); return CGSizeMake( parentSize.width / 2, parentSize.height );
} }
Throw(@"unexpected collection view: %@", collectionView); Throw( @"unexpected collection view: %@", collectionView );
} }
#pragma mark - UICollectionViewDataSource #pragma mark - UICollectionViewDataSource
@ -276,14 +276,14 @@ typedef NS_ENUM(NSUInteger, MPActiveUserState) {
if (collectionView == self.avatarCollectionView) if (collectionView == self.avatarCollectionView)
return [self.userIDs count] + 1; return [self.userIDs count] + 1;
Throw(@"unexpected collection view: %@", collectionView); Throw( @"unexpected collection view: %@", collectionView );
} }
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
if (collectionView == self.avatarCollectionView) { if (collectionView == self.avatarCollectionView) {
MPAvatarCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:[MPAvatarCell reuseIdentifier] forIndexPath:indexPath]; MPAvatarCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:[MPAvatarCell reuseIdentifier] forIndexPath:indexPath];
[cell addGestureRecognizer:[[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(didLongPress:)]]; [cell addGestureRecognizer:[[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector( didLongPress: )]];
[self updateModeForAvatar:cell atIndexPath:indexPath animated:NO]; [self updateModeForAvatar:cell atIndexPath:indexPath animated:NO];
[self updateVisibilityForAvatar:cell atIndexPath:indexPath animated:NO]; [self updateVisibilityForAvatar:cell atIndexPath:indexPath animated:NO];
@ -302,7 +302,7 @@ typedef NS_ENUM(NSUInteger, MPActiveUserState) {
return cell; return cell;
} }
Throw(@"unexpected collection view: %@", collectionView); Throw( @"unexpected collection view: %@", collectionView );
} }
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath { - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
@ -421,7 +421,7 @@ typedef NS_ENUM(NSUInteger, MPActiveUserState) {
CGPointPlusCGPoint( *targetContentOffset, offsetToCenter )]; CGPointPlusCGPoint( *targetContentOffset, offsetToCenter )];
CGPoint targetCenter = [self.avatarCollectionView layoutAttributesForItemAtIndexPath:avatarIndexPath].center; CGPoint targetCenter = [self.avatarCollectionView layoutAttributesForItemAtIndexPath:avatarIndexPath].center;
*targetContentOffset = CGPointMinusCGPoint( targetCenter, offsetToCenter ); *targetContentOffset = CGPointMinusCGPoint( targetCenter, offsetToCenter );
NSAssert([self.avatarCollectionView indexPathForItemAtPoint:targetCenter].item == avatarIndexPath.item, @"should be same item"); NSAssert( [self.avatarCollectionView indexPathForItemAtPoint:targetCenter].item == avatarIndexPath.item, @"should be same item" );
} }
} }
@ -502,19 +502,14 @@ typedef NS_ENUM(NSUInteger, MPActiveUserState) {
return [MPUserEntity existingObjectWithID:self.userIDs[indexPath.item] inContext:context]; return [MPUserEntity existingObjectWithID:self.userIDs[indexPath.item] inContext:context];
} }
- (void)updateAvatars { - (void)updateAvatarVisibility {
self.previousAvatarButton.alpha = 0; self.previousAvatarButton.alpha = 0;
self.nextAvatarButton.alpha = 0; self.nextAvatarButton.alpha = 0;
for (NSIndexPath *indexPath in self.avatarCollectionView.indexPathsForVisibleItems) for (NSIndexPath *indexPath in self.avatarCollectionView.indexPathsForVisibleItems) {
[self updateAvatarAtIndexPath:indexPath];
}
- (void)updateAvatarAtIndexPath:(NSIndexPath *)indexPath {
MPAvatarCell *cell = (MPAvatarCell *)[self.avatarCollectionView cellForItemAtIndexPath:indexPath]; MPAvatarCell *cell = (MPAvatarCell *)[self.avatarCollectionView cellForItemAtIndexPath:indexPath];
[self updateModeForAvatar:cell atIndexPath:indexPath animated:NO];
[self updateVisibilityForAvatar:cell atIndexPath:indexPath animated:NO]; [self updateVisibilityForAvatar:cell atIndexPath:indexPath animated:NO];
}
} }
- (void)updateModeForAvatar:(MPAvatarCell *)avatarCell atIndexPath:(NSIndexPath *)indexPath animated:(BOOL)animated { - (void)updateModeForAvatar:(MPAvatarCell *)avatarCell atIndexPath:(NSIndexPath *)indexPath animated:(BOOL)animated {
@ -551,7 +546,7 @@ typedef NS_ENUM(NSUInteger, MPActiveUserState) {
self.avatarCollectionView.contentOffset.x; self.avatarCollectionView.contentOffset.x;
CGFloat max = self.avatarCollectionView.bounds.size.width; CGFloat max = self.avatarCollectionView.bounds.size.width;
CGFloat visibility = MAX(0, MIN( 1, 1 - ABS( current / (max / 2) - 1 ) )); CGFloat visibility = MAX( 0, MIN( 1, 1 - ABS( current / (max / 2) - 1 ) ) );
[cell setVisibility:visibility animated:animated]; [cell setVisibility:visibility animated:animated];
if (cell.newUser) { if (cell.newUser) {
@ -560,7 +555,7 @@ typedef NS_ENUM(NSUInteger, MPActiveUserState) {
} }
} }
- (void)afterUpdatesMainQueue:(void (^)(void))block { - (void)afterUpdatesMainQueue:(void ( ^ )(void))block {
[_afterUpdates addOperationWithBlock:^{ [_afterUpdates addOperationWithBlock:^{
PearlMainQueue( block ); PearlMainQueue( block );
@ -572,12 +567,12 @@ typedef NS_ENUM(NSUInteger, MPActiveUserState) {
if ([_notificationObservers count]) if ([_notificationObservers count])
return; return;
Weakify(self); Weakify( self );
_notificationObservers = @[ _notificationObservers = @[
[[NSNotificationCenter defaultCenter] [[NSNotificationCenter defaultCenter]
addObserverForName:UIApplicationWillResignActiveNotification object:nil addObserverForName:UIApplicationWillResignActiveNotification object:nil
queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *note) { queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *note) {
Strongify(self); Strongify( self );
// [self emergencyCloseAnimated:NO]; // [self emergencyCloseAnimated:NO];
self.userSelectionContainer.alpha = 0; self.userSelectionContainer.alpha = 0;
@ -585,7 +580,7 @@ typedef NS_ENUM(NSUInteger, MPActiveUserState) {
[[NSNotificationCenter defaultCenter] [[NSNotificationCenter defaultCenter]
addObserverForName:UIApplicationDidBecomeActiveNotification object:nil addObserverForName:UIApplicationDidBecomeActiveNotification object:nil
queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *note) { queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *note) {
Strongify(self); Strongify( self );
[self reloadUsers]; [self reloadUsers];
@ -597,7 +592,7 @@ typedef NS_ENUM(NSUInteger, MPActiveUserState) {
[self observeKeyPath:@"avatarCollectionView.contentOffset" withBlock: [self observeKeyPath:@"avatarCollectionView.contentOffset" withBlock:
^(id from, id to, NSKeyValueChange cause, MPUsersViewController *_self) { ^(id from, id to, NSKeyValueChange cause, MPUsersViewController *_self) {
[_self updateAvatars]; [_self updateAvatarVisibility];
}]; }];
} }
@ -612,7 +607,7 @@ typedef NS_ENUM(NSUInteger, MPActiveUserState) {
- (void)observeStore { - (void)observeStore {
Weakify(self); Weakify( self );
NSManagedObjectContext *mainContext = [MPiOSAppDelegate managedObjectContextForMainThreadIfReady]; NSManagedObjectContext *mainContext = [MPiOSAppDelegate managedObjectContextForMainThreadIfReady];
[UIView animateWithDuration:0.3f animations:^{ [UIView animateWithDuration:0.3f animations:^{
@ -627,10 +622,10 @@ typedef NS_ENUM(NSUInteger, MPActiveUserState) {
_mocObserver = [[NSNotificationCenter defaultCenter] _mocObserver = [[NSNotificationCenter defaultCenter]
addObserverForName:NSManagedObjectContextObjectsDidChangeNotification object:mainContext addObserverForName:NSManagedObjectContextObjectsDidChangeNotification object:mainContext
queue:nil usingBlock:^(NSNotification *note) { queue:nil usingBlock:^(NSNotification *note) {
Strongify(self); Strongify( self );
NSSet *insertedObjects = note.userInfo[NSInsertedObjectsKey]; NSSet *insertedObjects = note.userInfo[NSInsertedObjectsKey];
NSSet *deletedObjects = note.userInfo[NSDeletedObjectsKey]; NSSet *deletedObjects = note.userInfo[NSDeletedObjectsKey];
if ([[NSSetUnion(insertedObjects, deletedObjects) if ([[NSSetUnion( insertedObjects, deletedObjects )
filteredSetUsingPredicate:[NSPredicate predicateWithBlock:^BOOL(id evaluatedObject, NSDictionary *bindings) { filteredSetUsingPredicate:[NSPredicate predicateWithBlock:^BOOL(id evaluatedObject, NSDictionary *bindings) {
return [evaluatedObject isKindOfClass:[MPUserEntity class]]; return [evaluatedObject isKindOfClass:[MPUserEntity class]];
}]] count]) }]] count])
@ -640,7 +635,7 @@ typedef NS_ENUM(NSUInteger, MPActiveUserState) {
_storeChangingObserver = [[NSNotificationCenter defaultCenter] _storeChangingObserver = [[NSNotificationCenter defaultCenter]
addObserverForName:USMStoreWillChangeNotification object:nil addObserverForName:USMStoreWillChangeNotification object:nil
queue:nil usingBlock:^(NSNotification *note) { queue:nil usingBlock:^(NSNotification *note) {
Strongify(self); Strongify( self );
if (self->_mocObserver) if (self->_mocObserver)
[[NSNotificationCenter defaultCenter] removeObserver:self->_mocObserver]; [[NSNotificationCenter defaultCenter] removeObserver:self->_mocObserver];
}]; }];
@ -648,7 +643,7 @@ typedef NS_ENUM(NSUInteger, MPActiveUserState) {
_storeChangedObserver = [[NSNotificationCenter defaultCenter] _storeChangedObserver = [[NSNotificationCenter defaultCenter]
addObserverForName:USMStoreDidChangeNotification object:nil addObserverForName:USMStoreDidChangeNotification object:nil
queue:nil usingBlock:^(NSNotification *note) { queue:nil usingBlock:^(NSNotification *note) {
Strongify(self); Strongify( self );
[self reloadUsers]; [self reloadUsers];
}]; }];
} }
@ -671,11 +666,11 @@ typedef NS_ENUM(NSUInteger, MPActiveUserState) {
NSError *error = nil; NSError *error = nil;
NSFetchRequest *fetchRequest = [NSFetchRequest fetchRequestWithEntityName:NSStringFromClass( [MPUserEntity class] )]; NSFetchRequest *fetchRequest = [NSFetchRequest fetchRequestWithEntityName:NSStringFromClass( [MPUserEntity class] )];
fetchRequest.sortDescriptors = @[ fetchRequest.sortDescriptors = @[
[NSSortDescriptor sortDescriptorWithKey:NSStringFromSelector( @selector(lastUsed) ) ascending:NO] [NSSortDescriptor sortDescriptorWithKey:NSStringFromSelector( @selector( lastUsed ) ) ascending:NO]
]; ];
NSArray *users = [mainContext executeFetchRequest:fetchRequest error:&error]; NSArray *users = [mainContext executeFetchRequest:fetchRequest error:&error];
if (!users) { if (!users) {
err(@"Failed to load users: %@", error); err( @"Failed to load users: %@", error );
self.userIDs = nil; self.userIDs = nil;
} }
@ -742,24 +737,11 @@ typedef NS_ENUM(NSUInteger, MPActiveUserState) {
return; return;
} }
// Set the entry container's contents.
[_afterUpdates setSuspended:YES]; [_afterUpdates setSuspended:YES];
__block BOOL requestFirstResponder = NO; __block BOOL requestFirstResponder = NO;
[self.view layoutIfNeeded];
[UIView animateWithDuration:animated? 0.4f: 0 animations:^{ [UIView animateWithDuration:animated? 0.4f: 0 animations:^{
MPAvatarCell *selectedAvatar = [self selectedAvatar];
// Set avatar modes.
for (NSUInteger item = 0; item < [self.avatarCollectionView numberOfItemsInSection:0]; ++item) {
NSIndexPath *indexPath = [NSIndexPath indexPathForItem:item inSection:0];
MPAvatarCell *avatarCell = (MPAvatarCell *)[self.avatarCollectionView cellForItemAtIndexPath:indexPath];
[self updateModeForAvatar:avatarCell atIndexPath:indexPath animated:animated];
[self updateVisibilityForAvatar:avatarCell atIndexPath:indexPath animated:animated];
if (selectedAvatar && avatarCell == selectedAvatar)
[self.avatarCollectionView scrollToItemAtIndexPath:indexPath
atScrollPosition:UICollectionViewScrollPositionCenteredHorizontally animated:NO];
}
// Set the entry container's contents.
switch (activeUserState) { switch (activeUserState) {
case MPActiveUserStateNone: case MPActiveUserStateNone:
break; break;
@ -799,7 +781,6 @@ typedef NS_ENUM(NSUInteger, MPActiveUserState) {
// Manage the entry container depending on whether a user is activate or not. // Manage the entry container depending on whether a user is activate or not.
switch (activeUserState) { switch (activeUserState) {
case MPActiveUserStateNone: { case MPActiveUserStateNone: {
[self.navigationBarToTopConstraint updatePriority:UILayoutPriorityDefaultHigh];
self.avatarCollectionView.scrollEnabled = YES; self.avatarCollectionView.scrollEnabled = YES;
self.entryContainer.alpha = 0; self.entryContainer.alpha = 0;
self.footerContainer.alpha = 1; self.footerContainer.alpha = 1;
@ -809,7 +790,6 @@ typedef NS_ENUM(NSUInteger, MPActiveUserState) {
case MPActiveUserStateUserName: case MPActiveUserStateUserName:
case MPActiveUserStateMasterPasswordChoice: case MPActiveUserStateMasterPasswordChoice:
case MPActiveUserStateMasterPasswordConfirmation: { case MPActiveUserStateMasterPasswordConfirmation: {
[self.navigationBarToTopConstraint updatePriority:UILayoutPriorityDefaultHigh];
self.avatarCollectionView.scrollEnabled = NO; self.avatarCollectionView.scrollEnabled = NO;
self.entryContainer.alpha = 1; self.entryContainer.alpha = 1;
self.footerContainer.alpha = 1; self.footerContainer.alpha = 1;
@ -817,7 +797,6 @@ typedef NS_ENUM(NSUInteger, MPActiveUserState) {
break; break;
} }
case MPActiveUserStateMinimized: { case MPActiveUserStateMinimized: {
[self.navigationBarToTopConstraint updatePriority:1];
self.avatarCollectionView.scrollEnabled = NO; self.avatarCollectionView.scrollEnabled = NO;
self.entryContainer.alpha = 0; self.entryContainer.alpha = 0;
self.footerContainer.alpha = 0; self.footerContainer.alpha = 0;
@ -833,6 +812,18 @@ typedef NS_ENUM(NSUInteger, MPActiveUserState) {
[self.entryField resignFirstResponder]; [self.entryField resignFirstResponder];
if (requestFirstResponder) if (requestFirstResponder)
[self.entryField becomeFirstResponder]; [self.entryField becomeFirstResponder];
// Set avatar modes.
MPAvatarCell *selectedAvatar = [self selectedAvatar];
for (NSIndexPath *indexPath in [self.avatarCollectionView indexPathsForVisibleItems]) {
MPAvatarCell *avatarCell = (MPAvatarCell *)[self.avatarCollectionView cellForItemAtIndexPath:indexPath];
[self updateModeForAvatar:avatarCell atIndexPath:indexPath animated:animated];
[self updateVisibilityForAvatar:avatarCell atIndexPath:indexPath animated:animated];
if (selectedAvatar && avatarCell == selectedAvatar)
[self.avatarCollectionView scrollToItemAtIndexPath:indexPath
atScrollPosition:UICollectionViewScrollPositionCenteredHorizontally animated:YES];
}
} }
#pragma mark - Actions #pragma mark - Actions

View File

@ -142,6 +142,7 @@
DA69540717D975D900BF294E /* icon_gears@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = DABD37851711E29500CF925C /* icon_gears@2x.png */; }; DA69540717D975D900BF294E /* icon_gears@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = DABD37851711E29500CF925C /* icon_gears@2x.png */; };
DA72BD7519C133BF00E6ACFE /* libscryptenc-ios-dev.a in Frameworks */ = {isa = PBXBuildFile; fileRef = DA72BD7419C133BF00E6ACFE /* libscryptenc-ios-dev.a */; }; DA72BD7519C133BF00E6ACFE /* libscryptenc-ios-dev.a in Frameworks */ = {isa = PBXBuildFile; fileRef = DA72BD7419C133BF00E6ACFE /* libscryptenc-ios-dev.a */; };
DA72BD7919C137DE00E6ACFE /* libopensslcrypto-ios-dev.a in Frameworks */ = {isa = PBXBuildFile; fileRef = DA72BD7719C137D500E6ACFE /* libopensslcrypto-ios-dev.a */; }; DA72BD7919C137DE00E6ACFE /* libopensslcrypto-ios-dev.a in Frameworks */ = {isa = PBXBuildFile; fileRef = DA72BD7719C137D500E6ACFE /* libopensslcrypto-ios-dev.a */; };
DA72BD7B19C1510C00E6ACFE /* UIView+FontScale.m in Sources */ = {isa = PBXBuildFile; fileRef = DACE2F6719BA6A2A0010F92E /* UIView+FontScale.m */; };
DA73049D194E022700E72520 /* ui_spinner.png in Resources */ = {isa = PBXBuildFile; fileRef = DABD36511711E29400CF925C /* ui_spinner.png */; }; DA73049D194E022700E72520 /* ui_spinner.png in Resources */ = {isa = PBXBuildFile; fileRef = DABD36511711E29400CF925C /* ui_spinner.png */; };
DA73049E194E022700E72520 /* ui_spinner@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = DABD36521711E29400CF925C /* ui_spinner@2x.png */; }; DA73049E194E022700E72520 /* ui_spinner@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = DABD36521711E29400CF925C /* ui_spinner@2x.png */; };
DA73049F194E022B00E72520 /* ui_textfield.png in Resources */ = {isa = PBXBuildFile; fileRef = DABD365B1711E29400CF925C /* ui_textfield.png */; }; DA73049F194E022B00E72520 /* ui_textfield.png in Resources */ = {isa = PBXBuildFile; fileRef = DABD365B1711E29400CF925C /* ui_textfield.png */; };
@ -274,7 +275,6 @@
DACA29BF1705E2DE002C6C22 /* UIColor+HSV.m in Sources */ = {isa = PBXBuildFile; fileRef = DACA29BB1705E2DE002C6C22 /* UIColor+HSV.m */; }; DACA29BF1705E2DE002C6C22 /* UIColor+HSV.m in Sources */ = {isa = PBXBuildFile; fileRef = DACA29BB1705E2DE002C6C22 /* UIColor+HSV.m */; };
DACE2F6519BA6A0A0010F92E /* PearlProfiler.m in Sources */ = {isa = PBXBuildFile; fileRef = DACE2F6319BA6A0A0010F92E /* PearlProfiler.m */; }; DACE2F6519BA6A0A0010F92E /* PearlProfiler.m in Sources */ = {isa = PBXBuildFile; fileRef = DACE2F6319BA6A0A0010F92E /* PearlProfiler.m */; };
DACE2F6619BA6A0A0010F92E /* PearlProfiler.h in Headers */ = {isa = PBXBuildFile; fileRef = DACE2F6419BA6A0A0010F92E /* PearlProfiler.h */; }; DACE2F6619BA6A0A0010F92E /* PearlProfiler.h in Headers */ = {isa = PBXBuildFile; fileRef = DACE2F6419BA6A0A0010F92E /* PearlProfiler.h */; };
DACE2F6B19BA6A2A0010F92E /* UIView+FontScale.m in Sources */ = {isa = PBXBuildFile; fileRef = DACE2F6719BA6A2A0010F92E /* UIView+FontScale.m */; };
DACE2F6C19BA6A2A0010F92E /* PearlMutableStaticTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = DACE2F6819BA6A2A0010F92E /* PearlMutableStaticTableViewController.m */; }; DACE2F6C19BA6A2A0010F92E /* PearlMutableStaticTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = DACE2F6819BA6A2A0010F92E /* PearlMutableStaticTableViewController.m */; };
DACE2F6D19BA6A2A0010F92E /* PearlMutableStaticTableViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = DACE2F6919BA6A2A0010F92E /* PearlMutableStaticTableViewController.h */; }; DACE2F6D19BA6A2A0010F92E /* PearlMutableStaticTableViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = DACE2F6919BA6A2A0010F92E /* PearlMutableStaticTableViewController.h */; };
DACE2F6E19BA6A2A0010F92E /* UIView+FontScale.h in Headers */ = {isa = PBXBuildFile; fileRef = DACE2F6A19BA6A2A0010F92E /* UIView+FontScale.h */; }; DACE2F6E19BA6A2A0010F92E /* UIView+FontScale.h in Headers */ = {isa = PBXBuildFile; fileRef = DACE2F6A19BA6A2A0010F92E /* UIView+FontScale.h */; };
@ -3296,6 +3296,7 @@
DAFE4A3015039824003ABA7C /* PearlStringUtils.m in Sources */, DAFE4A3015039824003ABA7C /* PearlStringUtils.m in Sources */,
DAFE4A3515039824003ABA7C /* PearlCryptUtils.m in Sources */, DAFE4A3515039824003ABA7C /* PearlCryptUtils.m in Sources */,
DAFE4A3715039824003ABA7C /* PearlKeyChain.m in Sources */, DAFE4A3715039824003ABA7C /* PearlKeyChain.m in Sources */,
DA72BD7B19C1510C00E6ACFE /* UIView+FontScale.m in Sources */,
DA250A17195665A100AC23F1 /* UITableView+PearlReloadFromArray.m in Sources */, DA250A17195665A100AC23F1 /* UITableView+PearlReloadFromArray.m in Sources */,
DAFE4A3915039824003ABA7C /* PearlRSAKey.m in Sources */, DAFE4A3915039824003ABA7C /* PearlRSAKey.m in Sources */,
DAFE4A3B15039824003ABA7C /* PearlSCrypt.m in Sources */, DAFE4A3B15039824003ABA7C /* PearlSCrypt.m in Sources */,
@ -3328,7 +3329,6 @@
DAEC85B518E3DD9A007FC0DF /* UIView+Touches.m in Sources */, DAEC85B518E3DD9A007FC0DF /* UIView+Touches.m in Sources */,
DA2CA4DD18D28859007798F8 /* NSArray+Pearl.m in Sources */, DA2CA4DD18D28859007798F8 /* NSArray+Pearl.m in Sources */,
DAFE4A63150399FF003ABA8A /* UIControl+PearlSelect.m in Sources */, DAFE4A63150399FF003ABA8A /* UIControl+PearlSelect.m in Sources */,
DACE2F6B19BA6A2A0010F92E /* UIView+FontScale.m in Sources */,
DAFE4A63150399FF003ABA8E /* UIScrollView+PearlFlashingIndicators.m in Sources */, DAFE4A63150399FF003ABA8E /* UIScrollView+PearlFlashingIndicators.m in Sources */,
DAFE4A63150399FF003ABA92 /* NSDateFormatter+RFC3339.m in Sources */, DAFE4A63150399FF003ABA92 /* NSDateFormatter+RFC3339.m in Sources */,
DA2CA4E618D2AC10007798F8 /* NSLayoutConstraint+PearlUIKit.m in Sources */, DA2CA4E618D2AC10007798F8 /* NSLayoutConstraint+PearlUIKit.m in Sources */,

View File

@ -46,7 +46,6 @@
<string>Exo2.0-Regular</string> <string>Exo2.0-Regular</string>
<string>Exo2.0-Regular</string> <string>Exo2.0-Regular</string>
<string>Exo2.0-Regular</string> <string>Exo2.0-Regular</string>
<string>Exo2.0-Regular</string>
</mutableArray> </mutableArray>
<mutableArray key="Exo2.0-Thin.otf"> <mutableArray key="Exo2.0-Thin.otf">
<string>Exo2.0-Thin</string> <string>Exo2.0-Thin</string>
@ -126,10 +125,10 @@
</constraints> </constraints>
</imageView> </imageView>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="0Sa-Vg-EEI" userLabel="Name Backdrop"> <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="0Sa-Vg-EEI" userLabel="Name Backdrop">
<rect key="frame" x="16" y="117" width="129" height="16"/> <rect key="frame" x="16" y="117" width="128.5" height="16"/>
<subviews> <subviews>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="Maarten Billemont" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="10" adjustsLetterSpacingToFitWidth="YES" translatesAutoresizingMaskIntoConstraints="NO" id="cLT-s0-4SQ" userLabel="Name Field"> <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalCompressionResistancePriority="1000" text="Maarten Billemont" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="10" adjustsLetterSpacingToFitWidth="YES" translatesAutoresizingMaskIntoConstraints="NO" id="cLT-s0-4SQ" userLabel="Name Field">
<rect key="frame" x="5" y="0.0" width="119" height="16"/> <rect key="frame" x="5" y="0.0" width="118.5" height="16"/>
<fontDescription key="fontDescription" name="Exo2.0-ExtraBold" family="Exo 2.0" pointSize="13"/> <fontDescription key="fontDescription" name="Exo2.0-ExtraBold" family="Exo 2.0" pointSize="13"/>
<color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/> <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/> <nil key="highlightedColor"/>
@ -226,7 +225,7 @@
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" text="MyMasterPassword" textAlignment="center" clearsOnBeginEditing="YES" minimumFontSize="14" translatesAutoresizingMaskIntoConstraints="NO" id="z3Z-AB-fG2" userLabel="Entry Field"> <textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" text="MyMasterPassword" textAlignment="center" clearsOnBeginEditing="YES" minimumFontSize="14" translatesAutoresizingMaskIntoConstraints="NO" id="z3Z-AB-fG2" userLabel="Entry Field">
<rect key="frame" x="10" y="32" width="315" height="34"/> <rect key="frame" x="10" y="32" width="315" height="34"/>
<color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/> <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<fontDescription key="fontDescription" name="Exo2.0-Regular" family="Exo 2.0" pointSize="28"/> <fontDescription key="fontDescription" type="system" pointSize="28"/>
<textInputTraits key="textInputTraits" autocorrectionType="no" keyboardAppearance="alert" enablesReturnKeyAutomatically="YES" secureTextEntry="YES"/> <textInputTraits key="textInputTraits" autocorrectionType="no" keyboardAppearance="alert" enablesReturnKeyAutomatically="YES" secureTextEntry="YES"/>
<connections> <connections>
<outlet property="delegate" destination="S8q-YF-Kt9" id="5u3-XN-LOe"/> <outlet property="delegate" destination="S8q-YF-Kt9" id="5u3-XN-LOe"/>