Remove unused delegates.

This commit is contained in:
Brent Simmons
2024-10-14 23:01:24 -07:00
parent dcc19c1be0
commit b8218c0b87
6 changed files with 9 additions and 35 deletions

View File

@@ -140,8 +140,6 @@ import Sparkle
installAppleEventHandlers()
CacheCleaner.purgeIfNecessary()
initializeDownloaders()
}
func applicationDidFinishLaunching(_ note: Notification) {

View File

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

View File

@@ -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<String>()
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() {

View File

@@ -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? = {

View File

@@ -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() {

View File

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