Make Feed provide a disk dictionary.
This commit is contained in:
parent
9b566dd10d
commit
f187f6a9ef
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue