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

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

Issue 2701833003: Fetch images for ContentSuggestions (Closed)
Patch Set: Reviewable 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 107f26dfed705ba66fc25064f791999c9a890bc3..dadefbb016dbdfa1751af15cc4670d860aa1a365 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
@@ -18,6 +18,7 @@ const CGFloat kStandardSpacing = 8;
@interface ContentSuggestionsArticleItem ()
@property(nonatomic, copy) NSString* subtitle;
+@property(nonatomic, weak) id<ContentSuggestionsArticleItemDelegate> delegate;
@end
@@ -30,25 +31,31 @@ const CGFloat kStandardSpacing = 8;
@synthesize image = _image;
@synthesize articleURL = _articleURL;
@synthesize suggestionID = _suggestionID;
+@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.imageBeingFetched = YES;
marq (ping after 24h) 2017/02/21 11:27:08 I think it would be better to set this to YES in t
gambard 2017/02/21 15:07:53 Done.
+ [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