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

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

Issue 2701833003: Fetch images for ContentSuggestions (Closed)
Patch Set: Address comments 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_article_item.mm
diff --git a/ios/chrome/browser/ui/content_suggestions/content_suggestions_article_item.mm b/ios/chrome/browser/ui/content_suggestions/content_suggestions_article_item.mm
index a7aeb51c0269a41ec1c0f6299d941968d70f033a..4749f4f7104e4e5a6e9e991f3c909bb4064cd77b 100644
--- a/ios/chrome/browser/ui/content_suggestions/content_suggestions_article_item.mm
+++ b/ios/chrome/browser/ui/content_suggestions/content_suggestions_article_item.mm
@@ -19,6 +19,7 @@ const CGFloat kStandardSpacing = 8;
@interface ContentSuggestionsArticleItem ()
@property(nonatomic, copy) NSString* subtitle;
+@property(nonatomic, weak) id<ContentSuggestionsArticleItemDelegate> delegate;
@end
@@ -33,25 +34,30 @@ const CGFloat kStandardSpacing = 8;
@synthesize publisher = _publisher;
@synthesize publishDate = _publishDate;
@synthesize suggestionIdentifier = _suggestionIdentifier;
+@synthesize delegate = _delegate;
+@synthesize imageBeingFetched = _imageBeingFetched;
- (instancetype)initWithType:(NSInteger)type
title:(NSString*)title
subtitle:(NSString*)subtitle
- image:(UIImage*)image
+ delegate:(id<ContentSuggestionsArticleItemDelegate>)delegate
url:(const GURL&)url {
self = [super initWithType:type];
if (self) {
self.cellClass = [ContentSuggestionsArticleCell class];
_title = [title copy];
_subtitle = [subtitle copy];
- _image = image;
_articleURL = url;
+ _delegate = delegate;
}
return self;
}
- (void)configureCell:(ContentSuggestionsArticleCell*)cell {
[super configureCell:cell];
+ if (!self.image && !self.imageBeingFetched) {
+ [self.delegate loadImageForArticleItem:self];
+ }
cell.titleLabel.text = _title;
cell.subtitleLabel.text = _subtitle;
cell.imageView.image = _image;

Powered by Google App Engine
This is Rietveld 408576698