Bug Fix - Champagne search bubbles appears over the rooms list while searching a room member.

https://github.com/vector-im/vector-ios/issues/64
This commit is contained in:
giomfo 2016-05-30 16:11:24 +02:00
parent d7f9011a0b
commit 6ee3d2204e
4 changed files with 34 additions and 11 deletions

View file

@ -39,6 +39,8 @@
*/
@property (nonatomic, readonly) UIImageView *backgroundImageView;
@property (nonatomic, readonly) NSLayoutConstraint *backgroundImageViewBottomConstraint;
/**
Show/Hide the search bar.

View file

@ -71,6 +71,11 @@
return self.searchInternals.backgroundImageView;
}
- (NSLayoutConstraint *)backgroundImageViewBottomConstraint
{
return self.searchInternals.backgroundImageViewBottomConstraint;
}
- (void)showSearch:(BOOL)animated
{
// Backup screen header before displaying the search bar in it

View file

@ -45,7 +45,7 @@ double const kPublicRoomsDirectoryDataExpiration = 10;
NSString *searchPatternsListString = [_searchPatternsList componentsJoinedByString:@""];
NSString *newSearchPatternsListString = [newSearchPatternsList componentsJoinedByString:@""];
if (![newSearchPatternsListString isEqualToString:searchPatternsListString])
if ((searchPatternsListString || newSearchPatternsListString) && ![newSearchPatternsListString isEqualToString:searchPatternsListString])
{
_searchPatternsList = newSearchPatternsList;
[self refreshPublicRooms];

View file

@ -420,6 +420,8 @@
[self setKeyboardHeightForBackgroundImage:keyboardHeight];
[super setKeyboardHeight:keyboardHeight];
[self checkAndShowBackgroundImage];
}
- (void)startActivityIndicator
@ -451,21 +453,34 @@
}
}
// Check if there is enough room for displaying the background
// before displaying it
// Check conditions before displaying the background
- (void)checkAndShowBackgroundImage
{
// In landscape with the iPhone 5 & 6 screen size, the backgroundImageView overlaps the tabs header,
// So, hide backgroundImageView
if (self.backgroundImageView.superview.frame.size.height > 375 && (self.searchBar.text.length == 0))
// Note: This background is hidden when keyboard is dismissed.
// The other conditions depend on the current selected view controller.
if (self.selectedViewController == recentsViewController)
{
self.backgroundImageView.hidden = NO;
self.backgroundImageView.hidden = (!recentsDataSource.hideRecents || !recentsDataSource.hidepublicRoomsDirectory || (self.keyboardHeight == 0));
}
else if (self.selectedViewController == searchViewController)
{
self.backgroundImageView.hidden = (((searchDataSource.serverCount != 0) && !searchViewController.noResultsLabel.isHidden) || (self.keyboardHeight == 0));
}
else
{
self.backgroundImageView.hidden = (self.keyboardHeight == 0);
}
if (!self.backgroundImageView.hidden)
{
// Check whether there is enough space to display this background
// For example, in landscape with the iPhone 5 & 6 screen size, the backgroundImageView must be hidden.
if ((self.selectedViewController.view.frame.size.height - self.backgroundImageViewBottomConstraint.constant) < self.backgroundImageView.frame.size.height)
{
self.backgroundImageView.hidden = YES;
}
}
}
#pragma mark - Override SegmentedViewController
@ -678,15 +693,16 @@
recentsDataSource.hideRecents = YES;
recentsDataSource.hidepublicRoomsDirectory = NO;
// Reset message search if any
// Reset search result (if any)
[recentsDataSource searchWithPatterns:nil];
if (searchDataSource.searchText.length)
{
[searchDataSource searchMessageText:nil];
}
}
[self checkAndShowBackgroundImage];
}
}
#pragma mark - UISearchBarDelegate