mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2026-11-30 17:29:23 +00:00
Avoid sending postFeedIconDidBecomeAvailableNotification when there's already a cached image (and thus a previous postFeedIconDidBecomeAvailableNotification).
This commit is contained in:
1 parent
5a4b43a3aa
commit
eb4de0df6d
1 file changed
+10
-1
@@ -65,6 +65,9 @@ extension Notification.Name {
|
||||
return
|
||||
}
|
||||
icon(forHomePageURL: homePageURL, feed: feed) { image, iconURL in
|
||||
if self.cache[feed] != nil {
|
||||
return // already cached
|
||||
}
|
||||
if let image, let iconURL {
|
||||
self.cache[feed] = IconImage(image)
|
||||
self.cacheIconURLForFeedURL(iconURL: iconURL, feedURL: feed.url)
|
||||
@@ -77,6 +80,9 @@ extension Notification.Name {
|
||||
if let iconURL = feed.iconURL {
|
||||
icon(forURL: iconURL, feed: feed) { (image) in
|
||||
Task { @MainActor in
|
||||
if self.cache[feed] != nil {
|
||||
return // already cached
|
||||
}
|
||||
if let image = image {
|
||||
self.cache[feed] = IconImage(image)
|
||||
self.cacheIconURLForFeedURL(iconURL: iconURL, feedURL: feed.url)
|
||||
@@ -94,9 +100,12 @@ extension Notification.Name {
|
||||
if let previouslyFoundIconURL = feedURLToIconURLCache[feed.url] {
|
||||
icon(forURL: previouslyFoundIconURL, feed: feed) { image in
|
||||
MainActor.assumeIsolated {
|
||||
if self.cache[feed] != nil {
|
||||
return // already cached
|
||||
}
|
||||
if let image {
|
||||
self.postFeedIconDidBecomeAvailableNotification(feed)
|
||||
self.cache[feed] = IconImage(image)
|
||||
self.postFeedIconDidBecomeAvailableNotification(feed)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user