Bug Fix - Search from rooms list: bg bubbles recovering known contacts list

#946
This commit is contained in:
giomfo 2017-01-19 14:28:44 +01:00
parent 95bfd3fd83
commit bcdfb40b8e
5 changed files with 27 additions and 11 deletions

View file

@ -112,8 +112,9 @@
@param searchText the search pattern (nil to reset filtering). @param searchText the search pattern (nil to reset filtering).
@param forceReset tell whether the search request must be applied by ignoring the previous search result if any (use NO by default). @param forceReset tell whether the search request must be applied by ignoring the previous search result if any (use NO by default).
@param complete a block object called when the operation is complete.
*/ */
- (void)searchWithPattern:(NSString *)searchText forceReset:(BOOL)forceReset; - (void)searchWithPattern:(NSString *)searchText forceReset:(BOOL)forceReset complete:(void (^)())complete;
/** /**
Refresh the contacts table display. Refresh the contacts table display.

View file

@ -215,7 +215,7 @@
} }
} }
- (void)searchWithPattern:(NSString *)searchText forceReset:(BOOL)forceRefresh - (void)searchWithPattern:(NSString *)searchText forceReset:(BOOL)forceRefresh complete:(void (^)())complete
{ {
// Update search results. // Update search results.
searchText = [searchText stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]]; searchText = [searchText stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
@ -348,12 +348,17 @@
// Force scroll to top // Force scroll to top
[self.tableView setContentOffset:CGPointMake(-self.tableView.contentInset.left, -self.tableView.contentInset.top) animated:NO]; [self.tableView setContentOffset:CGPointMake(-self.tableView.contentInset.left, -self.tableView.contentInset.top) animated:NO];
if (complete)
{
complete();
}
} }
else else
{ {
// Launch a new search // Launch a new search
forceSearchResultRefresh = NO; forceSearchResultRefresh = NO;
[self searchWithPattern:searchProcessingText forceReset:YES]; [self searchWithPattern:searchProcessingText forceReset:YES complete:complete];
} }
} }
}); });
@ -378,7 +383,7 @@
} }
// Refresh the search result // Refresh the search result
[self searchWithPattern:currentSearchText forceReset:YES]; [self searchWithPattern:currentSearchText forceReset:YES complete:nil];
} }
- (NSMutableArray<MXKContact*>*)unfilteredLocalContactsArray - (NSMutableArray<MXKContact*>*)unfilteredLocalContactsArray
@ -726,7 +731,7 @@
- (void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText - (void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText
{ {
[self searchWithPattern:searchText forceReset:NO]; [self searchWithPattern:searchText forceReset:NO complete:nil];
} }
- (void)searchBarSearchButtonClicked:(UISearchBar *)searchBar - (void)searchBarSearchButtonClicked:(UISearchBar *)searchBar
@ -754,7 +759,7 @@
searchBar.text = nil; searchBar.text = nil;
// Reset filtering // Reset filtering
[self searchWithPattern:nil forceReset:NO]; [self searchWithPattern:nil forceReset:NO complete:nil];
// Leave search // Leave search
[searchBar resignFirstResponder]; [searchBar resignFirstResponder];

View file

@ -1131,7 +1131,11 @@
} }
else if (self.selectedViewController == peopleSearchViewController) else if (self.selectedViewController == peopleSearchViewController)
{ {
[peopleSearchViewController searchWithPattern:self.searchBar.text forceReset:NO]; [peopleSearchViewController searchWithPattern:self.searchBar.text forceReset:NO complete:^{
[self checkAndShowBackgroundImage];
}];
} }
else if (self.selectedViewController == filesSearchViewController) else if (self.selectedViewController == filesSearchViewController)
{ {
@ -1159,7 +1163,13 @@
{ {
[messagesSearchDataSource searchMessages:nil force:NO]; [messagesSearchDataSource searchMessages:nil force:NO];
} }
[peopleSearchViewController searchWithPattern:nil forceReset:NO];
[peopleSearchViewController searchWithPattern:nil forceReset:NO complete:^{
[self checkAndShowBackgroundImage];
}];
if (filesSearchDataSource.searchText.length) if (filesSearchDataSource.searchText.length)
{ {
[filesSearchDataSource searchMessages:nil force:NO]; [filesSearchDataSource searchMessages:nil force:NO];

View file

@ -583,7 +583,7 @@
if (currentSearchText) if (currentSearchText)
{ {
contactsPickerViewController.searchBar.text = currentSearchText; contactsPickerViewController.searchBar.text = currentSearchText;
[contactsPickerViewController searchWithPattern:currentSearchText forceReset:YES]; [contactsPickerViewController searchWithPattern:currentSearchText forceReset:YES complete:nil];
} }
[self pushViewController:contactsPickerViewController]; [self pushViewController:contactsPickerViewController];

View file

@ -586,7 +586,7 @@
- (void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText - (void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText
{ {
[self searchWithPattern:searchText forceReset:NO]; [self searchWithPattern:searchText forceReset:NO complete:nil];
} }
- (BOOL)searchBarShouldBeginEditing:(UISearchBar *)searchBar - (BOOL)searchBarShouldBeginEditing:(UISearchBar *)searchBar
@ -632,7 +632,7 @@
self.isAddParticipantSearchBarEditing = NO; self.isAddParticipantSearchBarEditing = NO;
// Reset filtering // Reset filtering
[self searchWithPattern:nil forceReset:NO]; [self searchWithPattern:nil forceReset:NO complete:nil];
// Leave search // Leave search
[searchBar resignFirstResponder]; [searchBar resignFirstResponder];