From 13fbad12a5fc22c4916d8dbc990c451b35977d34 Mon Sep 17 00:00:00 2001 From: Brent Simmons Date: Thu, 13 Sep 2018 22:52:34 -0700 Subject: [PATCH] Store feed.contentHash in Settings.odb. --- Frameworks/Account/Feed.swift | 43 ++++++++++++++++++++--------------- submodules/RSDatabase | 2 +- 2 files changed, 26 insertions(+), 19 deletions(-) diff --git a/Frameworks/Account/Feed.swift b/Frameworks/Account/Feed.swift index 92210e806..78194e085 100644 --- a/Frameworks/Account/Feed.swift +++ b/Frameworks/Account/Feed.swift @@ -14,6 +14,19 @@ import RSDatabase public final class Feed: DisplayNameProvider, UnreadCountProvider, Hashable { + private struct Key { + static let url = "url" + static let feedID = "feedID" + static let homePageURL = "homePageURL" + static let iconURL = "iconURL" + static let faviconURL = "faviconURL" + static let name = "name" + static let editedName = "editedName" + static let authors = "authors" + static let conditionalGetInfo = "conditionalGetInfo" + static let contentHash = "contentHash" + } + public weak var account: Account? public let url: String public let feedID: String @@ -45,7 +58,14 @@ public final class Feed: DisplayNameProvider, UnreadCountProvider, Hashable { } public var conditionalGetInfo: HTTPConditionalGetInfo? - public var contentHash: String? + public var contentHash: String? { + get { + return settingsTable.string(for: Key.contentHash) + } + set { + settingsTable.setString(newValue, for: Key.contentHash) + } + } // MARK: - DisplayNameProvider @@ -83,19 +103,6 @@ public final class Feed: DisplayNameProvider, UnreadCountProvider, Hashable { // MARK: - Disk Dictionary - private struct Key { - static let url = "url" - static let feedID = "feedID" - static let homePageURL = "homePageURL" - static let iconURL = "iconURL" - static let faviconURL = "faviconURL" - static let name = "name" - static let editedName = "editedName" - static let authors = "authors" - static let conditionalGetInfo = "conditionalGetInfo" - static let contentHash = "contentHash" - } - convenience public init?(account: Account, dictionary: [String: Any]) { guard let url = dictionary[Key.url] as? String else { @@ -109,7 +116,7 @@ public final class Feed: DisplayNameProvider, UnreadCountProvider, Hashable { self.faviconURL = dictionary[Key.faviconURL] as? String self.name = dictionary[Key.name] as? String self.editedName = dictionary[Key.editedName] as? String - self.contentHash = dictionary[Key.contentHash] as? String +// self.contentHash = dictionary[Key.contentHash] as? String if let conditionalGetInfoDictionary = dictionary[Key.conditionalGetInfo] as? [String: String] { self.conditionalGetInfo = HTTPConditionalGetInfo(dictionary: conditionalGetInfoDictionary) @@ -153,9 +160,9 @@ public final class Feed: DisplayNameProvider, UnreadCountProvider, Hashable { if let authorsArray = authors?.diskArray() { d[Key.authors] = authorsArray } - if let contentHash = contentHash { - d[Key.contentHash] = contentHash - } +// if let contentHash = contentHash { +// d[Key.contentHash] = contentHash +// } if let conditionalGetInfo = conditionalGetInfo { d[Key.conditionalGetInfo] = conditionalGetInfo.dictionary } diff --git a/submodules/RSDatabase b/submodules/RSDatabase index 1681337a1..6d2255167 160000 --- a/submodules/RSDatabase +++ b/submodules/RSDatabase @@ -1 +1 @@ -Subproject commit 1681337a15a60ca11dcc2bd95f0a5970368219b6 +Subproject commit 6d22551675068414d952509538ac7b7c771202db