Fix logic in FeedIconDownloader so that we check the home page metadata. (I had broken this recently.)

This commit is contained in:
Brent Simmons 2019-05-17 23:02:18 -07:00
parent 3d253ce6d9
commit 1ee0ab5a73
1 changed files with 16 additions and 12 deletions

View File

@ -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
}
}