diff --git a/External/Pearl b/External/Pearl index 67321728..b50115c7 160000 --- a/External/Pearl +++ b/External/Pearl @@ -1 +1 @@ -Subproject commit 673217287de2920d21ef84f1d6811d8250f187b4 +Subproject commit b50115c767e7c0d412099ae169891dbb625b8c64 diff --git a/MasterPassword/ObjC/iOS/MPPasswordsViewController.h b/MasterPassword/ObjC/iOS/MPPasswordsViewController.h index b37ee6d0..d6456e1d 100644 --- a/MasterPassword/ObjC/iOS/MPPasswordsViewController.h +++ b/MasterPassword/ObjC/iOS/MPPasswordsViewController.h @@ -29,6 +29,7 @@ @property(assign, nonatomic) BOOL active; +@property(nonatomic, copy) NSString *originalQuery; - (void)setActive:(BOOL)active animated:(BOOL)animated; @end diff --git a/MasterPassword/ObjC/iOS/MPPasswordsViewController.m b/MasterPassword/ObjC/iOS/MPPasswordsViewController.m index 85018248..8f530e46 100644 --- a/MasterPassword/ObjC/iOS/MPPasswordsViewController.m +++ b/MasterPassword/ObjC/iOS/MPPasswordsViewController.m @@ -33,6 +33,7 @@ __weak id _storeObserver; __weak id _mocObserver; NSArray *_notificationObservers; + __weak UITapGestureRecognizer *_passwordsDismissRecognizer; } - (void)viewDidLoad { @@ -133,11 +134,13 @@ - (void)searchBarTextDidBeginEditing:(UISearchBar *)searchBar { if (searchBar == self.passwordsSearchBar) { + self.originalQuery = self.query; self.passwordsSearchBar.showsCancelButton = YES; + _passwordsDismissRecognizer = [self.view dismissKeyboardForField:self.passwordsSearchBar onTouchForced:NO]; - [UIView animateWithDuration:0.3f animations:^{ - self.passwordCollectionView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.3f]; - }]; +// [UIView animateWithDuration:0.3f animations:^{ +// self.passwordCollectionView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.3f]; +// }]; } } @@ -145,6 +148,8 @@ if (searchBar == self.passwordsSearchBar) { self.passwordsSearchBar.showsCancelButton = NO; + if (_passwordsDismissRecognizer) + [self.view removeGestureRecognizer:_passwordsDismissRecognizer]; [UIView animateWithDuration:0.3f animations:^{ self.passwordCollectionView.backgroundColor = [UIColor clearColor]; @@ -152,9 +157,19 @@ } } +- (void)searchBarSearchButtonClicked:(UISearchBar *)searchBar { + + [searchBar resignFirstResponder]; +} + - (void)searchBarCancelButtonClicked:(UISearchBar *)searchBar { [searchBar resignFirstResponder]; + + if (searchBar == self.passwordsSearchBar) { + self.passwordsSearchBar.text = self.originalQuery; + [self updatePasswords]; + } } - (void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText {