From 2c8fb1a3169c422f34b14df3e0ca04d25e2a944f Mon Sep 17 00:00:00 2001 From: Brent Simmons Date: Sun, 25 Oct 2026 14:38:04 -0700 Subject: [PATCH] Add thumbnail downloading activity. --- .../ActivityLog/Sources/ActivityLog/ActivityKind.swift | 6 +++++- .../ActivityLog/Sources/ActivityLog/ActivityOwner.swift | 8 +++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/Modules/ActivityLog/Sources/ActivityLog/ActivityKind.swift b/Modules/ActivityLog/Sources/ActivityLog/ActivityKind.swift index 579cc39f1..f4b345f78 100644 --- a/Modules/ActivityLog/Sources/ActivityLog/ActivityKind.swift +++ b/Modules/ActivityLog/Sources/ActivityLog/ActivityKind.swift @@ -63,6 +63,7 @@ public enum ActivityKind: Sendable, Hashable { case downloadFavicon(faviconURL: String) case downloadAvatar(avatarURL: String) case downloadHTMLMetadata(urlString: String) + case downloadThumbnail(imageURL: String) /// Localized description for activity kinds that don't carry a URL to display separately. /// Returns nil for the URL-bearing cases — each caller renders its own primary + URL form. @@ -124,7 +125,7 @@ public enum ActivityKind: Sendable, Hashable { return NSLocalizedString("Validating credentials", bundle: .module, comment: "Activity kind") case .exportOPML: return NSLocalizedString("Exporting OPML", bundle: .module, comment: "Activity kind") - case .refreshFeedContent, .findFeed, .fetchFeedCandidate, .downloadFeedImage, .downloadFavicon, .downloadAvatar, .downloadHTMLMetadata: + case .refreshFeedContent, .findFeed, .fetchFeedCandidate, .downloadFeedImage, .downloadFavicon, .downloadAvatar, .downloadHTMLMetadata, .downloadThumbnail: return nil } } @@ -157,6 +158,9 @@ public enum ActivityKind: Sendable, Hashable { case .downloadHTMLMetadata(let urlString): let format = NSLocalizedString("Downloading metadata %@", bundle: .module, comment: "Activity kind — downloading HTML metadata — %@ is the URL") return String(format: format, urlString) + case .downloadThumbnail(let imageURL): + let format = NSLocalizedString("Downloading thumbnail %@", bundle: .module, comment: "Activity kind — downloading a timeline thumbnail — %@ is the URL") + return String(format: format, imageURL) default: return "" } diff --git a/Modules/ActivityLog/Sources/ActivityLog/ActivityOwner.swift b/Modules/ActivityLog/Sources/ActivityLog/ActivityOwner.swift index cc9181714..5d04e2565 100644 --- a/Modules/ActivityLog/Sources/ActivityLog/ActivityOwner.swift +++ b/Modules/ActivityLog/Sources/ActivityLog/ActivityOwner.swift @@ -16,6 +16,7 @@ public enum ActivityOwner: Sendable, Hashable { case faviconDownloader case avatarDownloader case htmlMetadataDownloader + case thumbnailDownloader public var displayName: String { switch self { @@ -33,6 +34,8 @@ public enum ActivityOwner: Sendable, Hashable { return NSLocalizedString("Avatars", bundle: .module, comment: "Activity owner name") case .htmlMetadataDownloader: return NSLocalizedString("HTML Metadata", bundle: .module, comment: "Activity owner name") + case .thumbnailDownloader: + return NSLocalizedString("Thumbnails", bundle: .module, comment: "Activity owner name") } } @@ -46,7 +49,8 @@ public enum ActivityOwner: Sendable, Hashable { (.feedImageDownloader, .feedImageDownloader), (.faviconDownloader, .faviconDownloader), (.avatarDownloader, .avatarDownloader), - (.htmlMetadataDownloader, .htmlMetadataDownloader): + (.htmlMetadataDownloader, .htmlMetadataDownloader), + (.thumbnailDownloader, .thumbnailDownloader): return true case (.account(let lhsID, _), .account(let rhsID, _)): return lhsID == rhsID @@ -72,6 +76,8 @@ public enum ActivityOwner: Sendable, Hashable { hasher.combine(5) case .htmlMetadataDownloader: hasher.combine(6) + case .thumbnailDownloader: + hasher.combine(7) } } }