[FABRIC-10264] [ios] Crash fix.

This commit is contained in:
Ilya Grechuhin 2017-11-14 14:22:42 +03:00 committed by Roman Kuznetsov
parent 6bf3c40cc9
commit 24ff3e62bb
2 changed files with 11 additions and 18 deletions

View file

@ -324,8 +324,15 @@ using Observers = NSHashTable<Observer>;
- (void)onSearchCompleted
{
if (self.state == MWMSearchManagerStateTableSearch)
[self updateTableSearchActionBar];
if (self.state != MWMSearchManagerStateTableSearch)
return;
[self.tableViewController onSearchCompleted];
[self updateTableSearchActionBar];
}
- (void)onSearchResultsUpdated
{
[self.tableViewController reloadData];
}
- (void)updateTableSearchActionBar

View file

@ -19,18 +19,10 @@
{
self = [super init];
if (self)
{
_delegate = delegate;
[MWMSearch addObserver:self];
}
return self;
}
- (void)dealloc
{
[MWMSearch removeObserver:self];
}
- (void)viewDidLoad
{
[super viewDidLoad];
@ -64,7 +56,7 @@
{
[coordinator
animateAlongsideTransition:^(id<UIViewControllerTransitionCoordinatorContext> context) {
[self onSearchResultsUpdated];
[self reloadData];
}
completion:nil];
}
@ -168,16 +160,10 @@
- (void)onSearchCompleted
{
[self onSearchResultsUpdated];
[self reloadData];
BOOL const noResults = [MWMSearch resultsCount] == 0;
self.tableView.hidden = noResults;
[(MWMSearchTableView *)self.view hideNoResultsView:!noResults];
[self reloadData];
}
- (void)onSearchResultsUpdated
{
[self reloadData];
}
@end