diff --git a/Mac/AppDelegate.swift b/Mac/AppDelegate.swift index e1a38a22d..845488b78 100644 --- a/Mac/AppDelegate.swift +++ b/Mac/AppDelegate.swift @@ -140,8 +140,6 @@ import Sparkle installAppleEventHandlers() CacheCleaner.purgeIfNecessary() - - initializeDownloaders() } func applicationDidFinishLaunching(_ note: Notification) { diff --git a/Modules/Images/Sources/Images/Favicons/FaviconDownloader.swift b/Modules/Images/Sources/Images/Favicons/FaviconDownloader.swift index 85f4755b6..43b5d1769 100644 --- a/Modules/Images/Sources/Images/Favicons/FaviconDownloader.swift +++ b/Modules/Images/Sources/Images/Favicons/FaviconDownloader.swift @@ -18,11 +18,6 @@ public extension Notification.Name { static let FaviconDidBecomeAvailable = Notification.Name("FaviconDidBecomeAvailableNotification") // userInfo key: FaviconDownloader.UserInfoKey.faviconURL } -public protocol FaviconDownloaderDelegate { - - @MainActor var appIconImage: IconImage? { get } -} - @MainActor public final class FaviconDownloader { public static let shared = FaviconDownloader() @@ -56,8 +51,6 @@ public protocol FaviconDownloaderDelegate { private let queue: DispatchQueue private var cache = [Feed: IconImage]() // faviconURL: RSImage - public var delegate: FaviconDownloaderDelegate? - struct UserInfoKey { static let faviconURL = "faviconURL" } @@ -132,7 +125,7 @@ public protocol FaviconDownloaderDelegate { if let url = URL(string: homePageURL) { if url.host == "nnw.ranchero.com" || url.host == "netnewswire.blog" { - return delegate?.appIconImage + return IconImage.appIcon } } diff --git a/Modules/Images/Sources/Images/FeedIconDownloader.swift b/Modules/Images/Sources/Images/FeedIconDownloader.swift index 3147ea6d5..3c446afef 100644 --- a/Modules/Images/Sources/Images/FeedIconDownloader.swift +++ b/Modules/Images/Sources/Images/FeedIconDownloader.swift @@ -18,11 +18,6 @@ public extension Notification.Name { static let FeedIconDidBecomeAvailable = Notification.Name("FeedIconDidBecomeAvailableNotification") // UserInfoKey.feed } -public protocol FeedIconDownloaderDelegate: Sendable { - - @MainActor var appIconImage: IconImage? { get } -} - @MainActor public final class FeedIconDownloader { public static let shared = FeedIconDownloader() @@ -64,8 +59,6 @@ public protocol FeedIconDownloaderDelegate: Sendable { private var urlsInProgress = Set() private var cache = [Feed: IconImage]() private var waitingForFeedURLs = [String: Feed]() - - public var delegate: FeedIconDownloaderDelegate? public init() { @@ -91,7 +84,7 @@ public protocol FeedIconDownloaderDelegate: Sendable { } if let hpURLString = feed.homePageURL, let hpURL = URL(string: hpURLString), (hpURL.host == "nnw.ranchero.com" || hpURL.host == "netnewswire.blog") { - return delegate?.appIconImage + return IconImage.appIcon } @MainActor func checkHomePageURL() { diff --git a/Modules/Images/Sources/Images/RSImage-AppIcons.swift b/Modules/Images/Sources/Images/RSImage-AppIcons.swift index 3c312c97d..b9281b978 100644 --- a/Modules/Images/Sources/Images/RSImage-AppIcons.swift +++ b/Modules/Images/Sources/Images/RSImage-AppIcons.swift @@ -8,7 +8,11 @@ import Foundation import Core -import Images +#if os(macOS) +import AppKit +#elseif os(iOS) +import UIKit +#endif extension RSImage { static let appIconImage: RSImage? = { diff --git a/Shared/AppDelegate+Shared.swift b/Shared/AppDelegate+Shared.swift index 7aaf82466..95882930e 100644 --- a/Shared/AppDelegate+Shared.swift +++ b/Shared/AppDelegate+Shared.swift @@ -11,17 +11,7 @@ import Images import Account import Parser -extension AppDelegate: FaviconDownloaderDelegate, FeedIconDownloaderDelegate { - - var appIconImage: IconImage? { - IconImage.appIcon - } - - func initializeDownloaders() { - - FaviconDownloader.shared.delegate = self - FeedIconDownloader.shared.delegate = self - } +extension AppDelegate { func handleUnreadCountDidChange() { diff --git a/iOS/AppDelegate.swift b/iOS/AppDelegate.swift index 73819bc62..136a7ed54 100644 --- a/iOS/AppDelegate.swift +++ b/iOS/AppDelegate.swift @@ -79,7 +79,6 @@ final class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationC registerBackgroundTasks() CacheCleaner.purgeIfNecessary() - initializeDownloaders() initializeHomeScreenQuickActions() Task { @MainActor in @@ -128,10 +127,7 @@ final class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationC SingleLineUILabelSizer.emptyCache() IconImageCache.shared.emptyCache() AccountManager.shared.emptyCaches() - - Task.detached { - await DownloadWithCacheManager.shared.cleanupCache() - } + DownloadWithCacheManager.shared.cleanupCache() } // MARK: Notifications