mirror of
https://github.com/Ranchero-Software/NetNewsWire.git
synced 2024-12-16 11:22:34 +01:00
9de27febf0
Load the next favicon if a favicon is invalid Iterate through multiple favicons and use the first that actually loads - Add a homePageURL property to SingleFaviconDownloader that notification observers can use. - Only add a URL to the favicon cache when we're sure it's valid. Post notification even if the icon failed to load Update RSParser Remove single-favicon helper methods Only load the next favicon if the current load failed Update RSParser Make sure to try the default favicon.ico RSParser test fix update Update RSParser
29 lines
603 B
Swift
29 lines
603 B
Swift
//
|
|
// FaviconURLFinder.swift
|
|
// NetNewsWire
|
|
//
|
|
// Created by Brent Simmons on 11/20/17.
|
|
// Copyright © 2017 Ranchero Software. All rights reserved.
|
|
//
|
|
|
|
import Foundation
|
|
import RSParser
|
|
|
|
// The favicon URLs may be specified in the head section of the home page.
|
|
|
|
struct FaviconURLFinder {
|
|
|
|
static func findFaviconURLs(_ homePageURL: String, _ callback: @escaping ([String]?) -> Void) {
|
|
|
|
guard let _ = URL(string: homePageURL) else {
|
|
callback(nil)
|
|
return
|
|
}
|
|
|
|
HTMLMetadataDownloader.downloadMetadata(for: homePageURL) { (htmlMetadata) in
|
|
callback(htmlMetadata?.faviconLinks)
|
|
}
|
|
}
|
|
}
|
|
|