Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(29)

Side by Side Diff: ios/chrome/browser/ui/content_suggestions/content_suggestions_collection_updater.mm

Issue 2745593002: Remove categories notified as invalid (Closed)
Patch Set: Add comment Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #import "ios/chrome/browser/ui/content_suggestions/content_suggestions_collectio n_updater.h" 5 #import "ios/chrome/browser/ui/content_suggestions/content_suggestions_collectio n_updater.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/mac/foundation_util.h" 8 #include "base/mac/foundation_util.h"
9 #include "base/time/time.h" 9 #include "base/time/time.h"
10 #import "ios/chrome/browser/ui/collection_view/collection_view_controller.h" 10 #import "ios/chrome/browser/ui/collection_view/collection_view_controller.h"
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 articleItem.suggestionIdentifier = suggestion.suggestionIdentifier; 181 articleItem.suggestionIdentifier = suggestion.suggestionIdentifier;
182 182
183 [model addItem:articleItem toSectionWithIdentifier:sectionIdentifier]; 183 [model addItem:articleItem toSectionWithIdentifier:sectionIdentifier];
184 } 184 }
185 185
186 if ([self.collectionViewController isViewLoaded]) { 186 if ([self.collectionViewController isViewLoaded]) {
187 [self.collectionViewController.collectionView reloadData]; 187 [self.collectionViewController.collectionView reloadData];
188 } 188 }
189 } 189 }
190 190
191 - (void)clearSection:(ContentSuggestionsSectionInformation*)sectionInfo {
192 SectionIdentifier sectionIdentifier = SectionIdentifierForInfo(sectionInfo);
193 NSInteger section = [self.collectionViewController.collectionViewModel
194 sectionIdentifierForSection:sectionIdentifier];
195
196 [self.collectionViewController dismissSection:section];
197 }
198
191 #pragma mark - Public methods 199 #pragma mark - Public methods
192 200
193 - (BOOL)shouldUseCustomStyleForSection:(NSInteger)section { 201 - (BOOL)shouldUseCustomStyleForSection:(NSInteger)section {
194 NSNumber* identifier = @([self.collectionViewController.collectionViewModel 202 NSNumber* identifier = @([self.collectionViewController.collectionViewModel
195 sectionIdentifierForSection:section]); 203 sectionIdentifierForSection:section]);
196 ContentSuggestionsSectionInformation* sectionInformation = 204 ContentSuggestionsSectionInformation* sectionInformation =
197 self.sectionInfoBySectionIdentifier[identifier]; 205 self.sectionInfoBySectionIdentifier[identifier];
198 return sectionInformation.layout == ContentSuggestionsSectionLayoutCustom; 206 return sectionInformation.layout == ContentSuggestionsSectionLayoutCustom;
199 } 207 }
200 208
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 } 258 }
251 return sectionIdentifier; 259 return sectionIdentifier;
252 } 260 }
253 261
254 - (void)resetModels { 262 - (void)resetModels {
255 [self.collectionViewController loadModel]; 263 [self.collectionViewController loadModel];
256 self.sectionInfoBySectionIdentifier = [[NSMutableDictionary alloc] init]; 264 self.sectionInfoBySectionIdentifier = [[NSMutableDictionary alloc] init];
257 } 265 }
258 266
259 @end 267 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698