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

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

Issue 2697573002: Modify article item in ContentSuggestions (Closed)
Patch Set: Fix tests Created 3 years, 10 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
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 f7d74408bbc2f834c1036afc3fc3910c25304cfb..4ed54b7668c9f967bf4ae9311a0d3538b7e7e8f2 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
@@ -8,6 +8,8 @@
#import "ios/chrome/browser/ui/collection_view/cells/MDCCollectionViewCell+Chrome.h"
#import "ios/chrome/browser/ui/collection_view/cells/collection_view_item.h"
#import "ios/chrome/browser/ui/collection_view/collection_view_model.h"
+#import "ios/chrome/browser/ui/content_suggestions/content_suggestion.h"
+#import "ios/chrome/browser/ui/content_suggestions/content_suggestions_article_item.h"
#import "ios/chrome/browser/ui/content_suggestions/content_suggestions_collection_updater.h"
#import "ios/chrome/browser/ui/content_suggestions/content_suggestions_commands.h"
#import "ios/chrome/browser/ui/content_suggestions/content_suggestions_item_actions.h"
@@ -69,8 +71,15 @@ const NSTimeInterval kAnimationDuration = 0.35;
CollectionViewItem* item =
[self.collectionViewModel itemAtIndexPath:indexPath];
- if (item.type == ItemTypeStack) {
- [self.suggestionCommandHandler openReadingList];
+ switch (item.type) {
+ case ItemTypeStack:
+ [self.suggestionCommandHandler openReadingList];
+ break;
+ case ItemTypeArticle:
+ [self openArticle:item];
+ break;
+ default:
+ break;
}
}
@@ -170,4 +179,10 @@ const NSTimeInterval kAnimationDuration = 0.35;
}
}
+- (void)openArticle:(CollectionViewItem*)item {
+ ContentSuggestionsArticleItem* article =
+ base::mac::ObjCCastStrict<ContentSuggestionsArticleItem>(item);
+ [self.suggestionCommandHandler openURL:article.articleURL];
+}
+
@end
« no previous file with comments | « ios/chrome/browser/ui/content_suggestions/content_suggestions_commands.h ('k') | ios/showcase/common/protocol_alerter.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698