diff --git a/MacPass.xcodeproj/project.pbxproj b/MacPass.xcodeproj/project.pbxproj index 586b2614..805df7c7 100644 --- a/MacPass.xcodeproj/project.pbxproj +++ b/MacPass.xcodeproj/project.pbxproj @@ -1684,6 +1684,7 @@ 4C5133861FA0C32C00C94C73 /* Accessory */, 4C4B7EF517A46815000234C7 /* Inspector */, 4C47D77718B37911002755E4 /* Preferences */, + 4CD97D242591331B00E9C606 /* OTP */, 4CAAA8241D787B8B00CDE977 /* MPAutotypeBuilderViewController.h */, 4CAAA8251D787B8B00CDE977 /* MPAutotypeBuilderViewController.m */, FA9FD32E1FB5EDD3003CEDD6 /* AutotypeBuilderView.xib */, @@ -1741,9 +1742,6 @@ 4C73B6EE215E64A7009787F7 /* MPWelcomeViewController.h */, 4C73B6EF215E64A7009787F7 /* MPWelcomeViewController.m */, 4C7F8B6A1A10B68400CCB83D /* WelcomeView.xib */, - 4C356642258259AA00CAB95B /* MPTOTPSetupViewController.h */, - 4C356643258259AA00CAB95B /* MPTOTPSetupViewController.m */, - 4C356644258259AA00CAB95B /* MPTOTPSetupViewController.xib */, ); name = "View Controller"; sourceTree = ""; @@ -1774,6 +1772,16 @@ path = Databases; sourceTree = ""; }; + 4CD97D242591331B00E9C606 /* OTP */ = { + isa = PBXGroup; + children = ( + 4C356642258259AA00CAB95B /* MPTOTPSetupViewController.h */, + 4C356643258259AA00CAB95B /* MPTOTPSetupViewController.m */, + 4C356644258259AA00CAB95B /* MPTOTPSetupViewController.xib */, + ); + name = OTP; + sourceTree = ""; + }; 4CDB556616E29A8A00635918 /* Controls */ = { isa = PBXGroup; children = ( diff --git a/MacPass/EntryView.xib b/MacPass/EntryView.xib index d6fcbc59..792b0846 100644 --- a/MacPass/EntryView.xib +++ b/MacPass/EntryView.xib @@ -1,39 +1,37 @@ - + - + - - + + - - - - + + + - + - + - - + + - @@ -49,7 +47,7 @@ - + @@ -70,7 +68,6 @@ - @@ -119,7 +116,6 @@ - @@ -135,7 +131,7 @@ - + @@ -156,7 +152,6 @@ - @@ -172,7 +167,7 @@ - + @@ -191,9 +186,8 @@ - + - @@ -205,11 +199,11 @@ - + - + @@ -241,19 +235,21 @@ - + - - - - - - - - + + + + + + + + + + diff --git a/MacPass/MPEntryViewController.m b/MacPass/MPEntryViewController.m index 261cbf6a..0cec65ac 100644 --- a/MacPass/MPEntryViewController.m +++ b/MacPass/MPEntryViewController.m @@ -70,21 +70,16 @@ NSString *const _MPTableStringCellView = @"StringCell"; NSString *const _MPTableSecurCellView = @"PasswordCell"; @interface MPEntryViewController () { - BOOL _isDisplayingContextBar; BOOL _didUnlock; } @property (strong) MPContextBarViewController *contextBarViewController; @property (strong) NSArray *filteredEntries; +@property (strong) IBOutlet NSStackView *stackView; @property (weak) IBOutlet NSTableView *entryTable; @property (assign) MPDisplayMode displayMode; - -/* Constraints */ -@property (strong) IBOutlet NSLayoutConstraint *tableToTopConstraint; -@property (strong) NSLayoutConstraint *contextBarTopConstraint; - @property (nonatomic, strong) MPEntryTableDataSource *dataSource; @end @@ -98,7 +93,6 @@ NSString *const _MPTableSecurCellView = @"PasswordCell"; - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; if(self) { - _isDisplayingContextBar = NO; _displayMode = MPDisplayModeEntries; _entryArrayController = [[NSArrayController alloc] init]; _dataSource = [[MPEntryTableDataSource alloc] init]; @@ -543,56 +537,14 @@ NSString *const _MPTableSecurCellView = @"PasswordCell"; } - (void)_showContextBar { - if(_isDisplayingContextBar) { - return; + if(self.stackView.views.count == 1) { + [self.stackView insertArrangedSubview:self.contextBarViewController.view atIndex:0]; } - _isDisplayingContextBar = YES; - if(!self.contextBarViewController.view.superview) { - [self.view addSubview:self.contextBarViewController.view]; - NSView *contextBar = self.contextBarViewController.view; - NSView *scrollView = self.entryTable.enclosingScrollView; - NSDictionary *views = NSDictionaryOfVariableBindings(scrollView, contextBar); - - /* Pin to the left */ - [self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[contextBar]|" options:0 metrics:nil views:views]]; - /* Pin height and to top of entry table */ - [self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:[contextBar(==30)]-0-[scrollView]" options:0 metrics:nil views:views]]; - /* Create the top constraint for the filter bar where we can change the constant instead of removing/adding constraints all the time */ - self.contextBarTopConstraint = [NSLayoutConstraint constraintWithItem:contextBar - attribute:NSLayoutAttributeTop - relatedBy:NSLayoutRelationEqual - toItem:self.view - attribute:NSLayoutAttributeTop - multiplier:1 - constant:-31]; - } - /* Add the view for the first time */ - [self.view removeConstraint:self.tableToTopConstraint]; - [self.view addConstraint:self.contextBarTopConstraint]; - [self.view layout]; - self.contextBarTopConstraint.constant = 0; - - [NSAnimationContext runAnimationGroup:^(NSAnimationContext* context) { - context.duration = STATUS_BAR_ANIMATION_TIME; - context.allowsImplicitAnimation = YES; - [self.view layoutSubtreeIfNeeded]; - } completionHandler:nil]; + self.contextBarViewController.view.hidden = NO; } - (void)_hideContextBar { - if(!_isDisplayingContextBar) { - return; // nothing to do; - } - self.contextBarTopConstraint.constant = -31; - [self.view addConstraint:self.tableToTopConstraint]; - - [NSAnimationContext runAnimationGroup:^(NSAnimationContext* context) { - context.duration = STATUS_BAR_ANIMATION_TIME; - context.allowsImplicitAnimation = YES; - [self.view layoutSubtreeIfNeeded]; - } completionHandler:^{ - self->_isDisplayingContextBar = NO; - }]; + self.contextBarViewController.view.hidden = YES; } #pragma mark Validation diff --git a/MacPass/MPTOTPSetupViewController.xib b/MacPass/MPTOTPSetupViewController.xib index fc896846..a59a8aed 100644 --- a/MacPass/MPTOTPSetupViewController.xib +++ b/MacPass/MPTOTPSetupViewController.xib @@ -14,9 +14,176 @@ - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +