diff --git a/Multiplatform/Shared/Images/ArticleIconImageLoader.swift b/Multiplatform/Shared/Images/ArticleIconImageLoader.swift index bae640cc8..ec08f5189 100644 --- a/Multiplatform/Shared/Images/ArticleIconImageLoader.swift +++ b/Multiplatform/Shared/Images/ArticleIconImageLoader.swift @@ -23,6 +23,7 @@ final class ArticleIconImageLoader: ObservableObject { } func loadImage(for article: Article) { + guard image == nil else { return } self.article = article image = article.iconImage() } @@ -50,7 +51,7 @@ private extension ArticleIconImageLoader { for author in authors { if author.avatarURL == avatarURL { - + image = article.iconImage() return } } diff --git a/Multiplatform/Shared/Images/FeedIconImageLoader.swift b/Multiplatform/Shared/Images/FeedIconImageLoader.swift index 4893af107..6a6fa8586 100644 --- a/Multiplatform/Shared/Images/FeedIconImageLoader.swift +++ b/Multiplatform/Shared/Images/FeedIconImageLoader.swift @@ -21,8 +21,27 @@ final class FeedIconImageLoader: ObservableObject { } func loadImage(for feed: Feed) { + guard image == nil else { return } self.feed = feed - + fetchImage() + } + +} + +private extension FeedIconImageLoader { + + @objc func faviconDidBecomeAvailable(_ note: Notification) { + fetchImage() + } + + @objc func webFeedIconDidBecomeAvailable(_ note: Notification) { + guard let feed = feed as? WebFeed, let noteFeed = note.userInfo?[UserInfoKey.webFeed] as? WebFeed, feed == noteFeed else { + return + } + fetchImage() + } + + func fetchImage() { if let webFeed = feed as? WebFeed { if let feedIconImage = appDelegate.webFeedIconDownloader.icon(for: webFeed) { image = feedIconImage @@ -40,19 +59,3 @@ final class FeedIconImageLoader: ObservableObject { } } - -private extension FeedIconImageLoader { - - @objc func faviconDidBecomeAvailable(_ note: Notification) { - guard let feed = feed else { return } - loadImage(for: feed) - } - - @objc func webFeedIconDidBecomeAvailable(_ note: Notification) { - guard let feed = feed as? WebFeed, let noteFeed = note.userInfo?[UserInfoKey.webFeed] as? WebFeed, feed == noteFeed else { - return - } - loadImage(for: feed) - } - -} diff --git a/Multiplatform/Shared/Timeline/TimelineItemView.swift b/Multiplatform/Shared/Timeline/TimelineItemView.swift index 51a63711b..fd5529d2b 100644 --- a/Multiplatform/Shared/Timeline/TimelineItemView.swift +++ b/Multiplatform/Shared/Timeline/TimelineItemView.swift @@ -24,7 +24,7 @@ struct TimelineItemView: View { VStack { Text(verbatim: timelineItem.article.title ?? "N/A") .fontWeight(.semibold) - .lineLimit(3) + .lineLimit(AppDefaults.timelineNumberOfLines) .frame(maxWidth: .infinity, alignment: .leading) .padding(.trailing, 4) Spacer()