Bug Fix: Directory should be accessible from search even if the search field is empty

https://github.com/vector-im/vector-ios/issues/104
This commit is contained in:
giomfo
2016-05-30 13:42:45 +02:00
parent 982aa45362
commit d7f9011a0b
5 changed files with 82 additions and 36 deletions
+19 -9
View File
@@ -636,12 +636,8 @@
[recentsDataSource searchWithPatterns:nil];
// If the currently selected tab is the recents, force to show it right now
// The transition looks smoother
if (animated && self.selectedViewController.view.hidden == YES && self.selectedViewController == recentsViewController)
{
self.selectedViewController.view.hidden = NO;
}
recentsDataSource.hideRecents = NO;
recentsDataSource.hidepublicRoomsDirectory = YES;
}
// Update search results under the currently selected tab
@@ -649,7 +645,8 @@
{
if (self.searchBar.text.length)
{
self.selectedViewController.view.hidden = NO;
recentsDataSource.hideRecents = NO;
recentsDataSource.hidepublicRoomsDirectory = NO;
self.backgroundImageView.hidden = YES;
// Forward the search request to the data source
@@ -677,8 +674,16 @@
}
else
{
// Nothing to search = Show nothing
self.selectedViewController.view.hidden = YES;
// Nothing to search, show only the public dictionary
recentsDataSource.hideRecents = YES;
recentsDataSource.hidepublicRoomsDirectory = NO;
// Reset message search if any
if (searchDataSource.searchText.length)
{
[searchDataSource searchMessageText:nil];
}
[self checkAndShowBackgroundImage];
}
}
@@ -692,6 +697,11 @@
// As the public room search is local, it can be updated on each text change
[self updateSearch];
}
else if (!self.searchBar.text.length)
{
// Reset message search if any
[self updateSearch];
}
}
- (void)searchBarSearchButtonClicked:(UISearchBar *)searchBar