From 1ee0ab5a73838f2969845d0de53ea2c9d7e999ab Mon Sep 17 00:00:00 2001 From: Brent Simmons Date: Fri, 17 May 2019 23:02:18 -0700 Subject: [PATCH] Fix logic in FeedIconDownloader so that we check the home page metadata. (I had broken this recently.) --- Shared/Images/FeedIconDownloader.swift | 28 +++++++++++++++----------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/Shared/Images/FeedIconDownloader.swift b/Shared/Images/FeedIconDownloader.swift index 9f87a5f8e..630a13b94 100644 --- a/Shared/Images/FeedIconDownloader.swift +++ b/Shared/Images/FeedIconDownloader.swift @@ -37,18 +37,6 @@ public final class FeedIconDownloader { return cachedImage } - if let iconURL = feed.iconURL { - icon(forURL: iconURL) { (image) in - if let image = image { - self.postFeedIconDidBecomeAvailableNotification(feed) - self.cache[feed] = image - } - else { - checkHomePageURL() - } - } - } - func checkHomePageURL() { guard let homePageURL = feed.homePageURL else { return @@ -61,6 +49,22 @@ public final class FeedIconDownloader { } } + if let iconURL = feed.iconURL { + icon(forURL: iconURL) { (image) in + if let image = image { + self.postFeedIconDidBecomeAvailableNotification(feed) + self.cache[feed] = image + } + else { + checkHomePageURL() + } + } + } + else { + checkHomePageURL() + } + + return nil } }