Ignore Feed Icon in special cases. Issue #1265

This commit is contained in:
Maurice Parker 2019-11-06 17:59:27 -06:00
parent b0f9d97650
commit 238289ec5d
2 changed files with 7 additions and 3 deletions

View File

@ -40,6 +40,10 @@ public final class FeedIconDownloader {
} }
} }
private var homePagesWithUglyIcons: Set<String> = {
return Set(["https://www.macsparky.com/"])
}()
private var urlsInProgress = Set<String>() private var urlsInProgress = Set<String>()
private var cache = [Feed: IconImage]() private var cache = [Feed: IconImage]()
private var waitingForFeedURLs = [String: Feed]() private var waitingForFeedURLs = [String: Feed]()
@ -120,7 +124,7 @@ private extension FeedIconDownloader {
func icon(forHomePageURL homePageURL: String, feed: Feed, _ imageResultBlock: @escaping (RSImage?) -> Void) { func icon(forHomePageURL homePageURL: String, feed: Feed, _ imageResultBlock: @escaping (RSImage?) -> Void) {
if homePagesWithNoIconURLCache.contains(homePageURL) { if homePagesWithNoIconURLCache.contains(homePageURL) || homePagesWithUglyIcons.contains(homePageURL) {
imageResultBlock(nil) imageResultBlock(nil)
return return
} }

View File

@ -182,7 +182,7 @@ private extension AppDelegate {
let homePageURLsWithNoFaviconURL = tempDir.appendingPathComponent("HomePageURLsWithNoFaviconURLCache.plist") let homePageURLsWithNoFaviconURL = tempDir.appendingPathComponent("HomePageURLsWithNoFaviconURLCache.plist")
// If the image disk cache hasn't been flushed for 3 days and the network is available, delete it // If the image disk cache hasn't been flushed for 3 days and the network is available, delete it
// if let flushDate = AppDefaults.lastImageCacheFlushDate, flushDate.addingTimeInterval(3600*24*3) < Date() { if let flushDate = AppDefaults.lastImageCacheFlushDate, flushDate.addingTimeInterval(3600*24*3) < Date() {
if let reachability = try? Reachability(hostname: "apple.com") { if let reachability = try? Reachability(hostname: "apple.com") {
if reachability.connection != .unavailable { if reachability.connection != .unavailable {
for tempItem in [faviconsFolderURL, imagesFolderURL, homePageToIconURL, homePagesWithNoIconURL, homePageToFaviconURL, homePageURLsWithNoFaviconURL] { for tempItem in [faviconsFolderURL, imagesFolderURL, homePageToIconURL, homePagesWithNoIconURL, homePageToFaviconURL, homePageURLsWithNoFaviconURL] {
@ -196,7 +196,7 @@ private extension AppDelegate {
AppDefaults.lastImageCacheFlushDate = Date() AppDefaults.lastImageCacheFlushDate = Date()
} }
} }
// } }
try! FileManager.default.createDirectory(at: faviconsFolderURL, withIntermediateDirectories: true, attributes: nil) try! FileManager.default.createDirectory(at: faviconsFolderURL, withIntermediateDirectories: true, attributes: nil)
let faviconsFolder = faviconsFolderURL.absoluteString let faviconsFolder = faviconsFolderURL.absoluteString