Skip to content

Commit

Permalink
Temporarily show old-style alerts with search.
Browse files Browse the repository at this point in the history
-Shows "no results found" and server error messages as alerts.
 That way, if a user searches for a term which doesn't produce
 results, or if there are network connectivity issues, the user
 will get an indication of what happened.
  • Loading branch information
montehurd committed Sep 18, 2015
1 parent a98d281 commit 1e3f550
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Wikipedia/UI-V5/WMFSearchViewController.m
Expand Up @@ -15,6 +15,7 @@


#import "NSString+FormattedAttributedString.h"
#import "UIViewController+Alert.h"

static NSUInteger const kWMFMinResultsBeforeAutoFullTextSearch = 12;

Expand Down Expand Up @@ -244,9 +245,16 @@ - (void)searchForSearchTerm:(NSString*)searchTerm {
return [AnyPromise promiseWithValue:results];
}).then(^(WMFSearchResults* results){
if ([searchTerm isEqualToString:results.searchTerm]) {

if (results.articles.count == 0) {
[self showAlert:MWLocalizedString(@"search-no-matches", nil) type:ALERT_TYPE_TOP duration:2.0];
}
self.resultsListController.dataSource = results;
}
}).catch(^(NSError* error){

[self showAlert:error.userInfo[NSLocalizedDescriptionKey] type:ALERT_TYPE_TOP duration:2.0];

NSLog(@"%@", [error description]);

This comment has been minimized.

Copy link
@bgerstle

bgerstle Sep 18, 2015

Contributor

this can be deleted now, or at least converted into a DDLogError

});
}
Expand Down

0 comments on commit 1e3f550

Please sign in to comment.