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

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

Issue 2720423003: Get Suggestions image only if it is not empty (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
« no previous file with comments | « ios/chrome/browser/ui/content_suggestions/content_suggestions_article_item_unittest.mm ('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_collection_updater.mm
diff --git a/ios/chrome/browser/ui/content_suggestions/content_suggestions_collection_updater.mm b/ios/chrome/browser/ui/content_suggestions/content_suggestions_collection_updater.mm
index 96a0e9c2b55cc987b80d8fbd6cf25f2c1fabf83f..c0f4c134adbfdf8296b77b5930e89e14a1c12ca7 100644
--- a/ios/chrome/browser/ui/content_suggestions/content_suggestions_collection_updater.mm
+++ b/ios/chrome/browser/ui/content_suggestions/content_suggestions_collection_updater.mm
@@ -153,21 +153,22 @@ SectionIdentifier SectionIdentifierForInfo(
__weak ContentSuggestionsCollectionUpdater* weakSelf = self;
__weak ContentSuggestionsArticleItem* weakArticle = articleItem;
void (^imageFetchedCallback)(const gfx::Image&) = ^(const gfx::Image& image) {
+ if (image.IsEmpty()) {
+ return;
+ }
+
ContentSuggestionsCollectionUpdater* strongSelf = weakSelf;
ContentSuggestionsArticleItem* strongArticle = weakArticle;
if (!strongSelf || !strongArticle) {
return;
}
- strongArticle.imageBeingFetched = NO;
strongArticle.image = image.CopyUIImage();
[strongSelf.collectionViewController
reconfigureCellsForItems:@[ strongArticle ]
inSectionWithIdentifier:sectionIdentifier];
};
- articleItem.imageBeingFetched = YES;
-
[self.dataSource.imageFetcher
fetchImageForSuggestion:articleItem.suggestionIdentifier
callback:imageFetchedCallback];
« no previous file with comments | « ios/chrome/browser/ui/content_suggestions/content_suggestions_article_item_unittest.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698