Mhurd has submitted this change and it was merged.

Change subject: Add Search Suggestions to web view
......................................................................


Add Search Suggestions to web view

Change-Id: If4374952caa1396c66696f7d30024ef5b79db16a
---
M Wikipedia.xcodeproj/project.pbxproj
A wikipedia/Categories/NSArray+WMFExtensions.h
A wikipedia/Categories/NSArray+WMFExtensions.m
M wikipedia/Networking/Fetchers/SearchResultFetcher.h
M wikipedia/Networking/Fetchers/SearchResultFetcher.m
M wikipedia/View Controllers/Navigation/Top/TopMenuViewController.m
M wikipedia/View Controllers/SearchResults/SearchResultsController.h
M wikipedia/View Controllers/SearchResults/SearchResultsController.m
M wikipedia/View Controllers/WebView/WebViewController.m
M wikipedia/View Controllers/WebView/WebViewController_Private.h
M wikipedia/en.lproj/Localizable.strings
M wikipedia/qqq.lproj/Localizable.strings
12 files changed, 161 insertions(+), 25 deletions(-)

Approvals:
  Mhurd: Verified; Looks good to me, approved
  Bgerstle: Looks good to me, but someone else must approve



diff --git a/Wikipedia.xcodeproj/project.pbxproj 
b/Wikipedia.xcodeproj/project.pbxproj
index b7c2089..8b0731a 100644
--- a/Wikipedia.xcodeproj/project.pbxproj
+++ b/Wikipedia.xcodeproj/project.pbxproj
@@ -297,6 +297,8 @@
                C42D947E1A937DAC00A4871A /* SavedArticlesFetcher.m in Sources 
*/ = {isa = PBXBuildFile; fileRef = C42D947D1A937DAC00A4871A /* 
SavedArticlesFetcher.m */; };
                C42D94861A937DE000A4871A /* WMFBorderButton.m in Sources */ = 
{isa = PBXBuildFile; fileRef = C42D94831A937DE000A4871A /* WMFBorderButton.m 
*/; };
                C42D94871A937DE000A4871A /* WMFProgressLineView.m in Sources */ 
= {isa = PBXBuildFile; fileRef = C42D94851A937DE000A4871A /* 
WMFProgressLineView.m */; };
+               C42D94B81A953E6500A4871A /* 
WMFReadMoreSuggestionsViewController.m in Sources */ = {isa = PBXBuildFile; 
fileRef = C42D94B71A953E6500A4871A /* WMFReadMoreSuggestionsViewController.m 
*/; };
+               C42D94BC1A95405000A4871A /* NSArray+WMFExtensions.m in Sources 
*/ = {isa = PBXBuildFile; fileRef = C42D94BB1A95405000A4871A /* 
NSArray+WMFExtensions.m */; };
                C46FBA4B1A8530EE00C5730F /* Pods-acknowledgements.plist in 
Resources */ = {isa = PBXBuildFile; fileRef = C46FBA4A1A8530EE00C5730F /* 
Pods-acknowledgements.plist */; };
                C90799BA1A8564C60044E13C /* WMFShareOptionsViewController.m in 
Sources */ = {isa = PBXBuildFile; fileRef = C90799B91A8564C60044E13C /* 
WMFShareOptionsViewController.m */; };
                C913C89C1A94019A00BEEAF0 /* WMFSuggestedPagesFunnel.m in 
Sources */ = {isa = PBXBuildFile; fileRef = C913C89B1A94019A00BEEAF0 /* 
WMFSuggestedPagesFunnel.m */; };
@@ -817,6 +819,10 @@
                C42D94831A937DE000A4871A /* WMFBorderButton.m */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path 
= WMFBorderButton.m; sourceTree = "<group>"; };
                C42D94841A937DE000A4871A /* WMFProgressLineView.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = 
WMFProgressLineView.h; sourceTree = "<group>"; };
                C42D94851A937DE000A4871A /* WMFProgressLineView.m */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path 
= WMFProgressLineView.m; sourceTree = "<group>"; };
+               C42D94B61A953E6500A4871A /* 
WMFReadMoreSuggestionsViewController.h */ = {isa = PBXFileReference; 
fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = 
WMFReadMoreSuggestionsViewController.h; sourceTree = "<group>"; };
+               C42D94B71A953E6500A4871A /* 
WMFReadMoreSuggestionsViewController.m */ = {isa = PBXFileReference; 
fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = 
WMFReadMoreSuggestionsViewController.m; sourceTree = "<group>"; };
+               C42D94BA1A95405000A4871A /* NSArray+WMFExtensions.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = 
"NSArray+WMFExtensions.h"; path = 
"Wikipedia/Categories/NSArray+WMFExtensions.h"; sourceTree = SOURCE_ROOT; };
+               C42D94BB1A95405000A4871A /* NSArray+WMFExtensions.m */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name 
= "NSArray+WMFExtensions.m"; path = 
"Wikipedia/Categories/NSArray+WMFExtensions.m"; sourceTree = SOURCE_ROOT; };
                C46FBA4A1A8530EE00C5730F /* Pods-acknowledgements.plist */ = 
{isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; 
name = "Pods-acknowledgements.plist"; path = "../../../Pods/Target Support 
Files/Pods/Pods-acknowledgements.plist"; sourceTree = "<group>"; };
                C90799B81A8564C60044E13C /* WMFShareOptionsViewController.h */ 
= {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = 
sourcecode.c.h; name = WMFShareOptionsViewController.h; path = 
ShareCard/WMFShareOptionsViewController.h; sourceTree = "<group>"; };
                C90799B91A8564C60044E13C /* WMFShareOptionsViewController.m */ 
= {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = 
sourcecode.c.objc; name = WMFShareOptionsViewController.m; path = 
ShareCard/WMFShareOptionsViewController.m; sourceTree = "<group>"; };
@@ -1771,6 +1777,8 @@
                                04BA489F1A80062E00CB5CAE /* UIFont+WMFStyle.h 
*/,
                                04BA48A01A80062E00CB5CAE /* UIFont+WMFStyle.m 
*/,
                                04D149D818877343006B4104 /* Alerts */,
+                               C42D94BA1A95405000A4871A /* 
NSArray+WMFExtensions.h */,
+                               C42D94BB1A95405000A4871A /* 
NSArray+WMFExtensions.m */,
                                BCB66A0A1A85183000C7B1FE /* 
NSString+WMFHTMLParsing.h */,
                                BCB66A0B1A85183000C7B1FE /* 
NSString+WMFHTMLParsing.m */,
                                042950D21A9D3BA7009BE784 /* 
UIColor+WMFHexColor.h */,
@@ -2104,6 +2112,16 @@
                        );
                        path = "Custom Views";
                        sourceTree = "<group>";
+               };
+               C42D94A21A950B2E00A4871A /* Read More */ = {
+                       isa = PBXGroup;
+                       children = (
+                               C42D94B61A953E6500A4871A /* 
WMFReadMoreSuggestionsViewController.h */,
+                               C42D94B71A953E6500A4871A /* 
WMFReadMoreSuggestionsViewController.m */,
+                       );
+                       name = "Read More";
+                       path = "Wikipedia/View Controllers/Read More";
+                       sourceTree = SOURCE_ROOT;
                };
                C9180EC118AED30C006C1DCA /* mw-utils */ = {
                        isa = PBXGroup;
@@ -2965,6 +2983,7 @@
                                04A97E8718B81D5D0046B166 /* 
AccountCreationViewController.m in Sources */,
                                C42D947E1A937DAC00A4871A /* 
SavedArticlesFetcher.m in Sources */,
                                04530AF81935C07500022512 /* 
ModalContentViewController.m in Sources */,
+                               C42D94BC1A95405000A4871A /* 
NSArray+WMFExtensions.m in Sources */,
                                0487048219F8262600B7D307 /* AssetsFileFetcher.m 
in Sources */,
                                BC955BC71A82BEFD000EF9E4 /* 
MWKImageInfoFetcher.m in Sources */,
                                04C7576E1A1AA2D00084AC39 /* RecentSearchCell.m 
in Sources */,
diff --git a/wikipedia/Categories/NSArray+WMFExtensions.h 
b/wikipedia/Categories/NSArray+WMFExtensions.h
new file mode 100644
index 0000000..89e7b43
--- /dev/null
+++ b/wikipedia/Categories/NSArray+WMFExtensions.h
@@ -0,0 +1,16 @@
+
+#import <Foundation/Foundation.h>
+
+@interface NSArray (WMFExtensions)
+
+/**
+ *  Safely trim an array to a specified length.
+ *  Will not throw an exception if
+ *
+ *  @param length The max length
+ *
+ *  @return The trimmed array
+ */
+- (NSArray*)wmf_arrayByTrimmingToLength:(NSUInteger)length;
+
+@end
diff --git a/wikipedia/Categories/NSArray+WMFExtensions.m 
b/wikipedia/Categories/NSArray+WMFExtensions.m
new file mode 100644
index 0000000..38c34e5
--- /dev/null
+++ b/wikipedia/Categories/NSArray+WMFExtensions.m
@@ -0,0 +1,27 @@
+//
+//  NSArray+WMFExtensions.m
+//  Wikipedia
+//
+//  Created by Corey Floyd on 2/18/15.
+//  Copyright (c) 2015 Wikimedia Foundation. All rights reserved.
+//
+
+#import "NSArray+WMFExtensions.h"
+
+@implementation NSArray (WMFExtensions)
+
+- (NSArray*)wmf_arrayByTrimmingToLength:(NSUInteger)length{
+    
+    if([self count] == 0){
+        return self;
+    }
+    
+    if([self count] < length){
+        return self;
+    }
+    
+    return [self subarrayWithRange:NSMakeRange(0, length)];
+}
+
+
+@end
diff --git a/wikipedia/Networking/Fetchers/SearchResultFetcher.h 
b/wikipedia/Networking/Fetchers/SearchResultFetcher.h
index 96ce7b9..0c4eea8 100644
--- a/wikipedia/Networking/Fetchers/SearchResultFetcher.h
+++ b/wikipedia/Networking/Fetchers/SearchResultFetcher.h
@@ -40,6 +40,7 @@
 -(instancetype)initAndSearchForTerm: (NSString *)searchTerm
                          searchType: (SearchType)searchType
                        searchReason: (SearchReason)searchReason
+                         maxResults: (NSUInteger)maxResults
                         withManager: (AFHTTPRequestOperationManager *)manager
                  thenNotifyDelegate: (id <FetchFinishedDelegate>)delegate;
 @end
diff --git a/wikipedia/Networking/Fetchers/SearchResultFetcher.m 
b/wikipedia/Networking/Fetchers/SearchResultFetcher.m
index 6a23866..eeaf42a 100644
--- a/wikipedia/Networking/Fetchers/SearchResultFetcher.m
+++ b/wikipedia/Networking/Fetchers/SearchResultFetcher.m
@@ -16,6 +16,8 @@
 @property (nonatomic) SearchType searchType;
 @property (nonatomic) SearchReason searchReason;
 
+@property (nonatomic, assign) NSUInteger maxSearchResults;
+
 @property (nonatomic, strong) NSArray *searchResults;
 @property (nonatomic, strong) NSString *searchSuggestion;
 
@@ -28,6 +30,7 @@
 -(instancetype)initAndSearchForTerm: (NSString *)searchTerm
                          searchType: (SearchType)searchType
                        searchReason: (SearchReason)searchReason
+                         maxResults: (NSUInteger)maxResults
                         withManager: (AFHTTPRequestOperationManager *)manager
                  thenNotifyDelegate: (id <FetchFinishedDelegate>)delegate
 {
@@ -39,6 +42,7 @@
         self.searchType = searchType;
         self.searchReason = searchReason;
         self.fetchFinishedDelegate = delegate;
+        self.maxSearchResults = maxResults ? maxResults : SEARCH_MAX_RESULTS;
         self.spaceCollapsingRegex =
             [NSRegularExpression regularExpressionWithPattern:@"\\s{2,}+" 
options:NSRegularExpressionCaseInsensitive error:nil];
         [self searchWithManager:manager];
@@ -124,12 +128,12 @@
                      @"generator": @"prefixsearch",
                      @"gpssearch": self.searchTerm,
                      @"gpsnamespace": @0,
-                     @"gpslimit": @(SEARCH_MAX_RESULTS),
+                     @"gpslimit": @(self.maxSearchResults),
                      @"prop": @"pageterms|pageimages",
                      @"piprop": @"thumbnail",
                      @"wbptterms": @"description",
                      @"pithumbsize" : @(SEARCH_THUMBNAIL_WIDTH),
-                     @"pilimit": @(SEARCH_MAX_RESULTS),
+                     @"pilimit": @(self.maxSearchResults),
                      // -- Parameters causing prefix search to efficiently 
return suggestion.
                      @"list": @"search",
                      @"srsearch": self.searchTerm,
@@ -157,10 +161,10 @@
                      @"gsrinfo": @"",
                      @"gsrprop": @"redirecttitle",
                      @"gsroffset": @0,
-                     @"gsrlimit": @(SEARCH_MAX_RESULTS),
+                     @"gsrlimit": @(self.maxSearchResults),
                      @"piprop": @"thumbnail",
                      @"pithumbsize" : @(SEARCH_THUMBNAIL_WIDTH),
-                     @"pilimit": @(SEARCH_MAX_RESULTS),
+                     @"pilimit": @(self.maxSearchResults),
                      @"continue": @"",
                      @"format": @"json"
                      };
diff --git a/wikipedia/View Controllers/Navigation/Top/TopMenuViewController.m 
b/wikipedia/View Controllers/Navigation/Top/TopMenuViewController.m
index e6c2802..93e582a 100644
--- a/wikipedia/View Controllers/Navigation/Top/TopMenuViewController.m
+++ b/wikipedia/View Controllers/Navigation/Top/TopMenuViewController.m
@@ -75,7 +75,7 @@
     [super viewDidLoad];
     // Do any additional setup after loading the view.
 
-    self.searchResultsController = [self.storyboard 
instantiateViewControllerWithIdentifier:@"SearchResultsController"];
+    self.searchResultsController = [SearchResultsController 
standardSearchResultsController];
 
     [self setupNavbarContainerSubviews];
 
diff --git a/wikipedia/View Controllers/SearchResults/SearchResultsController.h 
b/wikipedia/View Controllers/SearchResults/SearchResultsController.h
index 33f5e8b..76a6232 100644
--- a/wikipedia/View Controllers/SearchResults/SearchResultsController.h
+++ b/wikipedia/View Controllers/SearchResults/SearchResultsController.h
@@ -1,14 +1,32 @@
-//  Created by Monte Hurd on 12/16/13.
-//  Copyright (c) 2013 Wikimedia Foundation. Provided under MIT-style license; 
please copy and modify!
 
 #import <UIKit/UIKit.h>
-#import "FetcherBase.h"
 
-@interface SearchResultsController : UIViewController <UITableViewDelegate, 
FetchFinishedDelegate>
+@interface SearchResultsController : UIViewController <UITableViewDelegate, 
UITableViewDataSource>
+
+@property (nonatomic, strong, readonly) IBOutlet UITableView 
*searchResultsTable;
 
 @property (strong, nonatomic) NSArray *searchResults;
 @property (strong, nonatomic) NSString *searchString;
 
+@property (assign, nonatomic) NSUInteger maxResults;
+@property (assign, nonatomic) NSUInteger minResultsBeforeRunningFullTextSearch;
+@property (assign, nonatomic) BOOL enableSupplementalFullTextSearch;
+
+/**
+ *  Search Results VC configured for normal full display
+ *
+ *  @return The VC
+ */
++ (SearchResultsController*)standardSearchResultsController;
+
+/**
+ *  The Search Results VC configured for display at the bottom of the webview
+ *
+ *  @return The VC
+ */
++ (SearchResultsController*)readMoreSearchResultsController;
+
+
 -(void)search;
 -(void)clearSearchResults;
 -(void)saveSearchTermToRecentList;
diff --git a/wikipedia/View Controllers/SearchResults/SearchResultsController.m 
b/wikipedia/View Controllers/SearchResults/SearchResultsController.m
index 3457ad6..bbd8e8d 100644
--- a/wikipedia/View Controllers/SearchResults/SearchResultsController.m
+++ b/wikipedia/View Controllers/SearchResults/SearchResultsController.m
@@ -1,5 +1,3 @@
-//  Created by Monte Hurd on 12/16/13.
-//  Copyright (c) 2013 Wikimedia Foundation. Provided under MIT-style license; 
please copy and modify!
 
 #import "SearchResultsController.h"
 #import "WikipediaAppUtils.h"
@@ -23,17 +21,20 @@
 #import "NSArray+Predicate.h"
 #import "SearchResultAttributedString.h"
 #import "UITableView+DynamicCellHeight.h"
+#import "NSArray+WMFExtensions.h"
 
 #define TABLE_CELL_ID @"SearchResultCell"
 #define SEARCH_DELAY 0.4
-#define MIN_RESULTS_BEFORE_AUTO_FULL_TEXT_SEARCH 12
 
-@interface SearchResultsController (){
+static NSUInteger const kWMFMinResultsBeforeAutoFullTextSearch = 12;
+static NSUInteger const kWMFReadMoreNumberOfArticles = 3;
+
+@interface SearchResultsController ()<FetchFinishedDelegate>{
     CGFloat scrollViewDragBeganVerticalOffset_;
 }
 
 @property (nonatomic, strong) NSString *searchSuggestion;
-@property (nonatomic, weak) IBOutlet UITableView *searchResultsTable;
+@property (nonatomic, strong, readwrite) IBOutlet UITableView 
*searchResultsTable;
 @property (nonatomic, strong) NSArray *searchStringWordsToHighlight;
 
 @property (nonatomic, strong) UIImage *placeholderImage;
@@ -61,6 +62,26 @@
 @end
 
 @implementation SearchResultsController
+
++ (SearchResultsController*)standardSearchResultsController{
+    
+    SearchResultsController* vc = [NAV.storyboard 
instantiateViewControllerWithIdentifier:@"SearchResultsController"];
+    vc.maxResults = SEARCH_MAX_RESULTS;
+    vc.minResultsBeforeRunningFullTextSearch = 
kWMFMinResultsBeforeAutoFullTextSearch;
+    vc.enableSupplementalFullTextSearch = YES;
+    return vc;
+}
+
++ (SearchResultsController*)readMoreSearchResultsController{
+    
+    SearchResultsController* vc = [SearchResultsController 
standardSearchResultsController];
+    vc.maxResults = kWMFReadMoreNumberOfArticles;
+    vc.minResultsBeforeRunningFullTextSearch = kWMFReadMoreNumberOfArticles;
+    vc.enableSupplementalFullTextSearch = YES;
+    vc.searchResultsTable.scrollEnabled = NO;
+    return vc;
+}
+
 
 -(void)setupStringAttributes
 {
@@ -166,7 +187,7 @@
     self.searchResults = @[];
     self.searchSuggestion = nil;
     self.navigationItem.hidesBackButton = YES;
-
+    
     // Register the search results cell for reuse
     [self.searchResultsTable registerNib:[UINib 
nibWithNibName:@"SearchResultPrototypeView" bundle:nil] 
forCellReuseIdentifier:TABLE_CELL_ID];
 
@@ -263,7 +284,7 @@
 
     SearchReason reason = ((NSNumber *)timer.userInfo[@"reason"]).integerValue;
 
-    if (self.navigationController.topViewController != self) return;
+//    if (self.navigationController.topViewController != self) return;
 
     if (self.searchString.length == 0) return;
     
@@ -390,10 +411,11 @@
                         [self 
removePrefixResultsFromSupplementalResults:searchResultFetcher.searchResults];
 
                     self.searchResults =
-                        [self.searchResults 
arrayByAddingObjectsFromArray:supplementalFullTextResults];
+                        [[self.searchResults 
arrayByAddingObjectsFromArray:supplementalFullTextResults] 
wmf_arrayByTrimmingToLength:self.maxResults];
                     
                 }else{
-                    self.searchResults = searchResultFetcher.searchResults;
+                    
+                    self.searchResults = [searchResultFetcher.searchResults 
wmf_arrayByTrimmingToLength:self.maxResults];
                 }
                 //NSLog(@"self.searchResultsOrdered = %@", 
self.searchResultsOrdered);
 
@@ -406,7 +428,7 @@
                 // If we received fewer than 
MIN_RESULTS_BEFORE_AUTO_FULL_TEXT_SEARCH prefix results,
                 // do a full-text search too, the results of which will be 
appended to the prefix results.
                 // Note: this also has to be done in the 
FETCH_FINAL_STATUS_FAILED case below.
-                if ((self.searchResults.count < 
MIN_RESULTS_BEFORE_AUTO_FULL_TEXT_SEARCH) && (searchResultFetcher.searchType == 
SEARCH_TYPE_TITLES)){
+                if ((self.searchResults.count < 
self.minResultsBeforeRunningFullTextSearch) && (searchResultFetcher.searchType 
== SEARCH_TYPE_TITLES)){
                         [self 
performSupplementalFullTextSearchForTerm:searchResultFetcher.searchTerm];
                 }
             }
@@ -509,9 +531,15 @@
 
 -(void)performSupplementalFullTextSearchForTerm:(NSString *)searchTerm
 {
+    
+    if(!self.enableSupplementalFullTextSearch){
+        return;
+    }
+    
     (void)[[SearchResultFetcher alloc] initAndSearchForTerm: searchTerm
                                                  searchType: 
SEARCH_TYPE_IN_ARTICLES
                                                searchReason: 
SEARCH_REASON_SUPPLEMENT_PREFIX_WITH_FULL_TEXT
+                                                 maxResults: self.maxResults
                                                 withManager: [QueuesSingleton 
sharedInstance].searchResultsFetchManager
                                          thenNotifyDelegate: self];
 
@@ -534,6 +562,7 @@
     (void)[[SearchResultFetcher alloc] initAndSearchForTerm: searchTerm
                                                  searchType: SEARCH_TYPE_TITLES
                                                searchReason: reason
+                                                 maxResults: self.maxResults
                                                 withManager: [QueuesSingleton 
sharedInstance].searchResultsFetchManager
                                          thenNotifyDelegate: self];
 }
diff --git a/wikipedia/View Controllers/WebView/WebViewController.m 
b/wikipedia/View Controllers/WebView/WebViewController.m
index 37330b3..1975696 100644
--- a/wikipedia/View Controllers/WebView/WebViewController.m
+++ b/wikipedia/View Controllers/WebView/WebViewController.m
@@ -2,6 +2,7 @@
 //  Copyright (c) 2013 Wikimedia Foundation. Provided under MIT-style license; 
please copy and modify!
 
 #import "WebViewController_Private.h"
+#import <Masonry/Masonry.h>
 
 NSString* const WebViewControllerTextWasHighlighted = @"textWasSelected";
 NSString* const WebViewControllerWillShareNotification = @"SelectionShare";
@@ -319,7 +320,7 @@
                                   constant: kScrollIndicatorMinYMargin];
 
     self.scrollIndicatorViewTopConstraint.priority = 
UILayoutPriorityDefaultLow;
-    
+
     [self.view addConstraint:self.scrollIndicatorViewTopConstraint];
 
     [self.view addConstraint:[NSLayoutConstraint constraintWithItem: 
self.scrollIndicatorView
@@ -1574,6 +1575,9 @@
         (lastModifiedBy && !lastModifiedBy.anonymous) ? lastModifiedBy.name : 
nil;
         [self.footerOptionsController updateLanguageCount:langCount];
         [self.footerOptionsController updateLastModifiedDate:lastModified 
userName:lastModifiedByUserName];
+        
+        self.searchSuggestionsController.searchString = article.title.text;
+        [self.searchSuggestionsController search];
     }
     
     // This is important! Ensures bottom of web view article can be scrolled 
closer to the top of
@@ -2112,26 +2116,41 @@
                                                        views: 
@{@"subContainer": subContainer}]];
             return subContainer;
         };
-        
+
+        UIView *suggestionsHeaderContainer = addSubContainer();
         UIView *suggestionsContainer = addSubContainer();
         UIView *optionsContainer = addSubContainer();
         UIView *legalContainer = addSubContainer();
         
         NSDictionary *views =
         @{
+          @"suggestionsHeaderContainer": suggestionsHeaderContainer,
           @"suggestionsContainer": suggestionsContainer,
           @"optionsContainer": optionsContainer,
           @"legalContainer": legalContainer
           };
         
         [self.footerContainer addConstraints:
-         [NSLayoutConstraint constraintsWithVisualFormat: 
@"V:|[suggestionsContainer(240)][optionsContainer][legalContainer]"
+         [NSLayoutConstraint constraintsWithVisualFormat: 
@"V:|[suggestionsHeaderContainer(30)][suggestionsContainer(237)][optionsContainer][legalContainer]"
                                                  options: 0
                                                  metrics: nil
                                                    views: views]];
         
-        SuggestionsFooterViewController *suggestionsController = 
[[SuggestionsFooterViewController alloc] init];
-        [self addChildController:suggestionsController 
toContainerView:suggestionsContainer];
+        UILabel* suggestionsLabel = [[UILabel alloc] initWithFrame:CGRectZero];
+        suggestionsLabel.backgroundColor = [UIColor whiteColor];
+        suggestionsLabel.textAlignment = NSTextAlignmentCenter;
+        suggestionsLabel.text = MWLocalizedString(@"article-read-more-title", 
@"Read more");
+        suggestionsLabel.translatesAutoresizingMaskIntoConstraints = NO;
+        [suggestionsHeaderContainer addSubview:suggestionsLabel];
+        
+        [suggestionsLabel mas_makeConstraints:^(MASConstraintMaker *make) {
+            
+            make.edges.equalTo(suggestionsHeaderContainer);
+        }];
+        
+        
+        self.searchSuggestionsController = [SearchResultsController 
readMoreSearchResultsController];
+        [self addChildController:self.searchSuggestionsController 
toContainerView:suggestionsContainer];
         
         self.footerOptionsController = [[OptionsFooterViewController alloc] 
init];
         [self addChildController:self.footerOptionsController 
toContainerView:optionsContainer];
diff --git a/wikipedia/View Controllers/WebView/WebViewController_Private.h 
b/wikipedia/View Controllers/WebView/WebViewController_Private.h
index 7b8fb97..81071bb 100644
--- a/wikipedia/View Controllers/WebView/WebViewController_Private.h
+++ b/wikipedia/View Controllers/WebView/WebViewController_Private.h
@@ -61,7 +61,7 @@
 #import "WebViewController+ImageGalleryPresentation.h"
 
 #import "UIWebView+WMFTrackingView.h"
-#import "SuggestionsFooterViewController.h"
+#import "SearchResultsController.h"
 #import "OptionsFooterViewController.h"
 #import "LegalFooterViewController.h"
 #import "WebViewBottomTrackingContainerView.h"
@@ -148,6 +148,7 @@
 
 @property (strong, nonatomic) WebViewBottomTrackingContainerView 
*footerContainer;
 @property (strong, nonatomic) OptionsFooterViewController 
*footerOptionsController;
+@property (strong, nonatomic) SearchResultsController 
*searchSuggestionsController;
 
 @property (strong, nonatomic) IBOutlet NSLayoutConstraint 
*webViewBottomConstraint;
 
diff --git a/wikipedia/en.lproj/Localizable.strings 
b/wikipedia/en.lproj/Localizable.strings
index 06f6b2e..4b7d011 100644
--- a/wikipedia/en.lproj/Localizable.strings
+++ b/wikipedia/en.lproj/Localizable.strings
@@ -2,6 +2,7 @@
 "article-languages-cancel" = "Cancel";
 "article-languages-downloading" = "Loading article languages...";
 "article-languages-filter-placeholder" = "Language Filter";
+"article-read-more-title" = "Read more";
 
 "info-box-title" = "Quick facts";
 "info-box-close-text" = "Close";
diff --git a/wikipedia/qqq.lproj/Localizable.strings 
b/wikipedia/qqq.lproj/Localizable.strings
index 2a2a8d4..5fd3969 100644
--- a/wikipedia/qqq.lproj/Localizable.strings
+++ b/wikipedia/qqq.lproj/Localizable.strings
@@ -14,6 +14,7 @@
 "article-languages-cancel" = "Button text for dismissing the language selector 
screen.\n{{Identical|Cancel}}";
 "article-languages-downloading" = "Alert text shown when obtaining list of 
languages in which an article is available";
 "article-languages-filter-placeholder" = "Filter languages text box 
placeholder text.";
+"article-read-more-title" = "The text that is displayed before the read more 
section at the bottom of an article";
 "info-box-title" = "The title of info boxes - in collapsed and expanded form";
 "info-box-close-text" = "The text for telling users thyey can tap the bottom 
of the info box to close it\n{{Identical|Close}}";
 "language-button-text" = "Label for 'other languages' button in content area 
footer. %d is placeholder for the number of available languages; note that 
support for PLURAL string marking is not yet available, so make your message 
generic if possible for now.";

-- 
To view, visit https://gerrit.wikimedia.org/r/191527
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: If4374952caa1396c66696f7d30024ef5b79db16a
Gerrit-PatchSet: 4
Gerrit-Project: apps/ios/wikipedia
Gerrit-Branch: master
Gerrit-Owner: Fjalapeno <cfl...@wikimedia.org>
Gerrit-Reviewer: Bgerstle <bgers...@wikimedia.org>
Gerrit-Reviewer: Dr0ptp4kt <ab...@wikimedia.org>
Gerrit-Reviewer: Fjalapeno <cfl...@wikimedia.org>
Gerrit-Reviewer: Mhurd <mh...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to