From 238289ec5de481188b2083c59e140bfc29118b5d Mon Sep 17 00:00:00 2001 From: Maurice Parker Date: Wed, 6 Nov 2019 17:59:27 -0600 Subject: [PATCH] Ignore Feed Icon in special cases. Issue #1265 --- Shared/Images/FeedIconDownloader.swift | 6 +++++- iOS/AppDelegate.swift | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Shared/Images/FeedIconDownloader.swift b/Shared/Images/FeedIconDownloader.swift index 4b12c8721..7fb4c042b 100644 --- a/Shared/Images/FeedIconDownloader.swift +++ b/Shared/Images/FeedIconDownloader.swift @@ -40,6 +40,10 @@ public final class FeedIconDownloader { } } + private var homePagesWithUglyIcons: Set = { + return Set(["https://www.macsparky.com/"]) + }() + private var urlsInProgress = Set() private var cache = [Feed: IconImage]() private var waitingForFeedURLs = [String: Feed]() @@ -120,7 +124,7 @@ private extension FeedIconDownloader { func icon(forHomePageURL homePageURL: String, feed: Feed, _ imageResultBlock: @escaping (RSImage?) -> Void) { - if homePagesWithNoIconURLCache.contains(homePageURL) { + if homePagesWithNoIconURLCache.contains(homePageURL) || homePagesWithUglyIcons.contains(homePageURL) { imageResultBlock(nil) return } diff --git a/iOS/AppDelegate.swift b/iOS/AppDelegate.swift index 839ccf3de..f75dc0880 100644 --- a/iOS/AppDelegate.swift +++ b/iOS/AppDelegate.swift @@ -182,7 +182,7 @@ private extension AppDelegate { 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 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 reachability.connection != .unavailable { for tempItem in [faviconsFolderURL, imagesFolderURL, homePageToIconURL, homePagesWithNoIconURL, homePageToFaviconURL, homePageURLsWithNoFaviconURL] { @@ -196,7 +196,7 @@ private extension AppDelegate { AppDefaults.lastImageCacheFlushDate = Date() } } -// } + } try! FileManager.default.createDirectory(at: faviconsFolderURL, withIntermediateDirectories: true, attributes: nil) let faviconsFolder = faviconsFolderURL.absoluteString