Remove no-longer-needed downloadMetadata delegate method.

This commit is contained in:
Brent Simmons
2024-10-14 22:56:26 -07:00
parent 25e68fbfe2
commit dcc19c1be0
3 changed files with 3 additions and 10 deletions

View File

@@ -21,8 +21,6 @@ public extension Notification.Name {
public protocol FaviconDownloaderDelegate {
@MainActor var appIconImage: IconImage? { get }
@MainActor func downloadMetadata(_ url: String) async throws -> HTMLMetadata?
}
@MainActor public final class FaviconDownloader {
@@ -228,7 +226,7 @@ private extension FaviconDownloader {
guard let url = URL(string: homePageURL) else {
return nil
}
guard let faviconURLs = await FaviconURLFinder.findFaviconURLs(with: homePageURL, downloadMetadata: delegate!.downloadMetadata(_:)) else {
guard let faviconURLs = await FaviconURLFinder.findFaviconURLs(with: homePageURL) else {
return nil
}

View File

@@ -22,14 +22,14 @@ import UniformTypeIdentifiers
/// - Parameters:
/// - homePageURL: The page to search.
/// - urls: An array of favicon URLs as strings.
static func findFaviconURLs(with homePageURL: String, downloadMetadata: ((String) async throws -> HTMLMetadata?)) async -> [String]? {
static func findFaviconURLs(with homePageURL: String) async -> [String]? {
guard let _ = URL(string: homePageURL) else {
return nil
}
// If the favicon has an explicit type, check that for an ignored type; otherwise, check the file extension.
let htmlMetadata = try? await downloadMetadata(homePageURL)
let htmlMetadata = await HTMLMetadataDownloader.downloadMetadata(for: homePageURL)
let faviconURLs = htmlMetadata?.favicons?.compactMap { favicon -> String? in
shouldAllowFavicon(favicon) ? favicon.urlString : nil

View File

@@ -17,11 +17,6 @@ extension AppDelegate: FaviconDownloaderDelegate, FeedIconDownloaderDelegate {
IconImage.appIcon
}
func downloadMetadata(_ url: String) async throws -> HTMLMetadata? {
await HTMLMetadataDownloader.downloadMetadata(for: url)
}
func initializeDownloaders() {
FaviconDownloader.shared.delegate = self