mirror of
https://github.com/vector-im/element-ios.git
synced 2024-09-29 15:52:40 +00:00
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:
parent
d7f9011a0b
commit
6ee3d2204e
4 changed files with 34 additions and 11 deletions
|
@ -39,6 +39,8 @@
|
||||||
*/
|
*/
|
||||||
@property (nonatomic, readonly) UIImageView *backgroundImageView;
|
@property (nonatomic, readonly) UIImageView *backgroundImageView;
|
||||||
|
|
||||||
|
@property (nonatomic, readonly) NSLayoutConstraint *backgroundImageViewBottomConstraint;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Show/Hide the search bar.
|
Show/Hide the search bar.
|
||||||
|
|
||||||
|
|
|
@ -71,6 +71,11 @@
|
||||||
return self.searchInternals.backgroundImageView;
|
return self.searchInternals.backgroundImageView;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (NSLayoutConstraint *)backgroundImageViewBottomConstraint
|
||||||
|
{
|
||||||
|
return self.searchInternals.backgroundImageViewBottomConstraint;
|
||||||
|
}
|
||||||
|
|
||||||
- (void)showSearch:(BOOL)animated
|
- (void)showSearch:(BOOL)animated
|
||||||
{
|
{
|
||||||
// Backup screen header before displaying the search bar in it
|
// Backup screen header before displaying the search bar in it
|
||||||
|
|
|
@ -45,7 +45,7 @@ double const kPublicRoomsDirectoryDataExpiration = 10;
|
||||||
NSString *searchPatternsListString = [_searchPatternsList componentsJoinedByString:@""];
|
NSString *searchPatternsListString = [_searchPatternsList componentsJoinedByString:@""];
|
||||||
NSString *newSearchPatternsListString = [newSearchPatternsList componentsJoinedByString:@""];
|
NSString *newSearchPatternsListString = [newSearchPatternsList componentsJoinedByString:@""];
|
||||||
|
|
||||||
if (![newSearchPatternsListString isEqualToString:searchPatternsListString])
|
if ((searchPatternsListString || newSearchPatternsListString) && ![newSearchPatternsListString isEqualToString:searchPatternsListString])
|
||||||
{
|
{
|
||||||
_searchPatternsList = newSearchPatternsList;
|
_searchPatternsList = newSearchPatternsList;
|
||||||
[self refreshPublicRooms];
|
[self refreshPublicRooms];
|
||||||
|
|
|
@ -420,6 +420,8 @@
|
||||||
[self setKeyboardHeightForBackgroundImage:keyboardHeight];
|
[self setKeyboardHeightForBackgroundImage:keyboardHeight];
|
||||||
|
|
||||||
[super setKeyboardHeight:keyboardHeight];
|
[super setKeyboardHeight:keyboardHeight];
|
||||||
|
|
||||||
|
[self checkAndShowBackgroundImage];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)startActivityIndicator
|
- (void)startActivityIndicator
|
||||||
|
@ -451,19 +453,32 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if there is enough room for displaying the background
|
// Check conditions before displaying the background
|
||||||
// before displaying it
|
|
||||||
- (void)checkAndShowBackgroundImage
|
- (void)checkAndShowBackgroundImage
|
||||||
{
|
{
|
||||||
// In landscape with the iPhone 5 & 6 screen size, the backgroundImageView overlaps the tabs header,
|
// Note: This background is hidden when keyboard is dismissed.
|
||||||
// So, hide backgroundImageView
|
// The other conditions depend on the current selected view controller.
|
||||||
if (self.backgroundImageView.superview.frame.size.height > 375 && (self.searchBar.text.length == 0))
|
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
|
else
|
||||||
{
|
{
|
||||||
self.backgroundImageView.hidden = YES;
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -678,14 +693,15 @@
|
||||||
recentsDataSource.hideRecents = YES;
|
recentsDataSource.hideRecents = YES;
|
||||||
recentsDataSource.hidepublicRoomsDirectory = NO;
|
recentsDataSource.hidepublicRoomsDirectory = NO;
|
||||||
|
|
||||||
// Reset message search if any
|
// Reset search result (if any)
|
||||||
|
[recentsDataSource searchWithPatterns:nil];
|
||||||
if (searchDataSource.searchText.length)
|
if (searchDataSource.searchText.length)
|
||||||
{
|
{
|
||||||
[searchDataSource searchMessageText:nil];
|
[searchDataSource searchMessageText:nil];
|
||||||
}
|
}
|
||||||
|
|
||||||
[self checkAndShowBackgroundImage];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[self checkAndShowBackgroundImage];
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark - UISearchBarDelegate
|
#pragma mark - UISearchBarDelegate
|
||||||
|
|
Loading…
Reference in a new issue