From 3d5358af09a801e26b9f3f1609bb5d080bb13cc7 Mon Sep 17 00:00:00 2001 From: Brent Simmons Date: Fri, 26 May 2017 13:07:55 -0700 Subject: [PATCH] =?UTF-8?q?Unbreak=20the=20build.=20Don=E2=80=99t=20know?= =?UTF-8?q?=20if=20anything=20works,=20but=20at=20least=20it=20builds.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Frameworks/LocalAccount/LocalAccount.swift | 4 ++-- Frameworks/LocalAccount/LocalAccountRefresher.swift | 13 ++++++++++--- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/Frameworks/LocalAccount/LocalAccount.swift b/Frameworks/LocalAccount/LocalAccount.swift index cc651b22b..cd46c5c21 100644 --- a/Frameworks/LocalAccount/LocalAccount.swift +++ b/Frameworks/LocalAccount/LocalAccount.swift @@ -95,7 +95,7 @@ public final class LocalAccount: Account, PlistProvider { NotificationCenter.default.addObserver(self, selector: #selector(unreadCountDidChange(_:)), name: .UnreadCountDidChange, object: nil) - NotificationCenter.default.addObserver(self, selector: #selector(refreshProgressDidChange(_:)), name: .RSProgressDidChange, object: nil) + NotificationCenter.default.addObserver(self, selector: #selector(refreshProgressDidChange(_:)), name: .AccountRefreshProgressDidChange, object: nil) DispatchQueue.main.async() { () -> Void in self.updateUnreadCounts(feedIDs: self.flattenedFeedIDs) @@ -332,7 +332,7 @@ public final class LocalAccount: Account, PlistProvider { dynamic func refreshProgressDidChange(_ notification: Notification) { - guard let progress = notification.object as? RSProgress, progress === refresher.progress else { + guard let progress = notification.object as? DownloadProgress, progress === refresher.progress else { return } diff --git a/Frameworks/LocalAccount/LocalAccountRefresher.swift b/Frameworks/LocalAccount/LocalAccountRefresher.swift index de8ec5883..31d214a6d 100644 --- a/Frameworks/LocalAccount/LocalAccountRefresher.swift +++ b/Frameworks/LocalAccount/LocalAccountRefresher.swift @@ -96,7 +96,7 @@ final class LocalAccountRefresher: DownloadSessionDelegate { if data.isEmpty { return true } - if let mimeType = RSMimeTypeForData(data), RSMimeTypeIsMedia(mimeType) { + if data.isDefinitelyNotFeed() { return false } @@ -125,6 +125,13 @@ final class LocalAccountRefresher: DownloadSessionDelegate { // // print("Not modified response for \(feed.url).") } - - +} + +private extension Data { + + func isDefinitelyNotFeed() -> Bool { + + // We only detect a few image types for now. This should get fleshed-out at some later date. + return (self as NSData).rs_dataIsImage() + } }