Skip downloading feeds for the Feed Directory, since feed previews have been punted to after 1.0.

This commit is contained in:
Brent Simmons 2018-02-11 16:19:53 -08:00
parent 8060f1ccd6
commit 3262a7a8fc
1 changed files with 30 additions and 28 deletions

View File

@ -62,15 +62,17 @@ final class FeedListFeed: Hashable, DisplayNameProvider {
func downloadIfNeeded() { func downloadIfNeeded() {
guard let lastDownloadAttemptDate = lastDownloadAttemptDate else { // Not doing feed previews until after 1.0.
downloadFeed()
return
}
let cutoffDate = Date().addingTimeInterval(-(30 * 60)) // 30 minutes in the past // guard let lastDownloadAttemptDate = lastDownloadAttemptDate else {
if lastDownloadAttemptDate < cutoffDate { // downloadFeed()
downloadFeed() // return
} // }
//
// let cutoffDate = Date().addingTimeInterval(-(30 * 60)) // 30 minutes in the past
// if lastDownloadAttemptDate < cutoffDate {
// downloadFeed()
// }
} }
static func ==(lhs: FeedListFeed, rhs: FeedListFeed) -> Bool { static func ==(lhs: FeedListFeed, rhs: FeedListFeed) -> Bool {
@ -83,29 +85,29 @@ private extension FeedListFeed {
func postFeedListFeedDidBecomeAvailableNotification() { func postFeedListFeedDidBecomeAvailableNotification() {
NotificationCenter.default.post(name: .FeedListFeedDidBecomeAvailable, object: self, userInfo: nil) // NotificationCenter.default.post(name: .FeedListFeedDidBecomeAvailable, object: self, userInfo: nil)
} }
func downloadFeed() { func downloadFeed() {
lastDownloadAttemptDate = Date() // lastDownloadAttemptDate = Date()
guard let feedURL = URL(string: url) else { // guard let feedURL = URL(string: url) else {
return // return
} // }
//
downloadUsingCache(feedURL) { (data, response, error) in // downloadUsingCache(feedURL) { (data, response, error) in
//
guard let data = data, error == nil else { // guard let data = data, error == nil else {
return // return
} // }
//
let parserData = ParserData(url: self.url, data: data) // let parserData = ParserData(url: self.url, data: data)
FeedParser.parse(parserData) { (parsedFeed, error) in // FeedParser.parse(parserData) { (parsedFeed, error) in
//
if let parsedFeed = parsedFeed, parsedFeed.items.count > 0 { // if let parsedFeed = parsedFeed, parsedFeed.items.count > 0 {
self.parsedFeed = parsedFeed // self.parsedFeed = parsedFeed
} // }
} // }
} // }
} }
} }