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

Unified Diff: ios/chrome/browser/ui/content_suggestions/content_suggestions_view_controller.mm

Issue 2736653002: Suggested Articles can be dismissed (Closed)
Patch Set: Address comments 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ios/chrome/browser/ui/content_suggestions/content_suggestions_view_controller.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/chrome/browser/ui/content_suggestions/content_suggestions_view_controller.mm
diff --git a/ios/chrome/browser/ui/content_suggestions/content_suggestions_view_controller.mm b/ios/chrome/browser/ui/content_suggestions/content_suggestions_view_controller.mm
index 3fb509f14aefe104bec348c3038c1326ee9dde0e..3754aa9ff72f0f36b8e098e34d786d9f22279726 100644
--- a/ios/chrome/browser/ui/content_suggestions/content_suggestions_view_controller.mm
+++ b/ios/chrome/browser/ui/content_suggestions/content_suggestions_view_controller.mm
@@ -41,6 +41,8 @@ const NSTimeInterval kAnimationDuration = 0.35;
@synthesize suggestionCommandHandler = _suggestionCommandHandler;
@synthesize collectionUpdater = _collectionUpdater;
+#pragma mark - Public
+
- (instancetype)initWithStyle:(CollectionViewControllerStyle)style
dataSource:(id<ContentSuggestionsDataSource>)dataSource {
self = [super initWithStyle:style];
@@ -51,6 +53,20 @@ const NSTimeInterval kAnimationDuration = 0.35;
return self;
}
+- (void)dismissEntryAtIndexPath:(NSIndexPath*)indexPath {
+ if (!indexPath || ![self.collectionViewModel hasItemAtIndexPath:indexPath]) {
+ return;
+ }
+
+ [self.collectionView performBatchUpdates:^{
+ [self collectionView:self.collectionView
+ willDeleteItemsAtIndexPaths:@[ indexPath ]];
+
+ [self.collectionView deleteItemsAtIndexPaths:@[ indexPath ]];
+ }
+ completion:nil];
+}
+
#pragma mark - UIViewController
- (void)viewDidLoad {
@@ -197,8 +213,10 @@ const NSTimeInterval kAnimationDuration = 0.35;
ContentSuggestionsArticleItem* articleItem =
base::mac::ObjCCastStrict<ContentSuggestionsArticleItem>(touchedItem);
- [self.suggestionCommandHandler displayContextMenuForArticle:articleItem
- atPoint:touchLocation];
+ [self.suggestionCommandHandler
+ displayContextMenuForArticle:articleItem
+ atPoint:touchLocation
+ atIndexPath:touchedItemIndexPath];
}
@end
« no previous file with comments | « ios/chrome/browser/ui/content_suggestions/content_suggestions_view_controller.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698