From dcc19c1be09c6a8341e05b28ab129c5de76de80e Mon Sep 17 00:00:00 2001 From: Brent Simmons Date: Mon, 14 Oct 2024 22:56:26 -0700 Subject: [PATCH] Remove no-longer-needed downloadMetadata delegate method. --- .../Images/Sources/Images/Favicons/FaviconDownloader.swift | 4 +--- .../Images/Sources/Images/Favicons/FaviconURLFinder.swift | 4 ++-- Shared/AppDelegate+Shared.swift | 5 ----- 3 files changed, 3 insertions(+), 10 deletions(-) diff --git a/Modules/Images/Sources/Images/Favicons/FaviconDownloader.swift b/Modules/Images/Sources/Images/Favicons/FaviconDownloader.swift index 20a61e313..85f4755b6 100644 --- a/Modules/Images/Sources/Images/Favicons/FaviconDownloader.swift +++ b/Modules/Images/Sources/Images/Favicons/FaviconDownloader.swift @@ -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 } diff --git a/Modules/Images/Sources/Images/Favicons/FaviconURLFinder.swift b/Modules/Images/Sources/Images/Favicons/FaviconURLFinder.swift index 4c9689b18..117252ca3 100644 --- a/Modules/Images/Sources/Images/Favicons/FaviconURLFinder.swift +++ b/Modules/Images/Sources/Images/Favicons/FaviconURLFinder.swift @@ -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 diff --git a/Shared/AppDelegate+Shared.swift b/Shared/AppDelegate+Shared.swift index 02484da2a..7aaf82466 100644 --- a/Shared/AppDelegate+Shared.swift +++ b/Shared/AppDelegate+Shared.swift @@ -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