From f187f6a9ef6c48e093e43c6cfa4e7d20c53eeaab Mon Sep 17 00:00:00 2001 From: Brent Simmons Date: Tue, 26 Sep 2017 13:32:02 -0700 Subject: [PATCH] Make Feed provide a disk dictionary. --- Frameworks/Data/Feed.swift | 21 +++++++++++++++++++ .../RSWeb/RSWeb/HTTPConditionalGetInfo.swift | 5 +---- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/Frameworks/Data/Feed.swift b/Frameworks/Data/Feed.swift index 24e60b09c..2f9595a2b 100644 --- a/Frameworks/Data/Feed.swift +++ b/Frameworks/Data/Feed.swift @@ -88,6 +88,27 @@ public final class Feed: DisplayNameProvider, UnreadCountProvider, Hashable { get { var d = [String: Any]() + d[Key.url] = url + d[Key.feedID] = feedID + if let homePageURL = homePageURL { + d[Key.homePageURL] = homePageURL + } + if let name = name { + d[Key.name] = name + } + if let editedName = editedName { + d[Key.editedName] = editedName + } + if let contentHash = contentHash { + d[Key.contentHash] = contentHash + } + if unreadCount > 0 { + d[Key.unreadCount] = unreadCount + } + if let conditionalGetInfo = conditionalGetInfo { + d[Key.conditionalGetInfo] = conditionalGetInfo.dictionary + } + return d } } diff --git a/Frameworks/RSWeb/RSWeb/HTTPConditionalGetInfo.swift b/Frameworks/RSWeb/RSWeb/HTTPConditionalGetInfo.swift index a6cd1f2ff..49569f127 100755 --- a/Frameworks/RSWeb/RSWeb/HTTPConditionalGetInfo.swift +++ b/Frameworks/RSWeb/RSWeb/HTTPConditionalGetInfo.swift @@ -36,11 +36,8 @@ public struct HTTPConditionalGetInfo { self.init(lastModified: lastModified, etag: etag) } - public var dictionary: [String: String]? { + public var dictionary: [String: String] { get { - if lastModified == nil && etag == nil { - return nil - } var d = [String: String]() if let lastModified = lastModified { d[HTTPResponseHeader.lastModified] = lastModified