Create FeedMetadata. Not actually used just yet. (Soon.)

This commit is contained in:
Brent Simmons 2019-03-12 22:40:11 -07:00
parent dd39e3a0fe
commit d498c3f19d
3 changed files with 123 additions and 0 deletions

View File

@ -24,6 +24,7 @@
846E77541F6F00E300A165E2 /* AccountManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 846E77531F6F00E300A165E2 /* AccountManager.swift */; };
848935001F62484F00CEBD24 /* Account.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 848934F61F62484F00CEBD24 /* Account.framework */; };
848935051F62485000CEBD24 /* AccountTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 848935041F62485000CEBD24 /* AccountTests.swift */; };
84B2D4D02238CD8A00498ADA /* FeedMetadata.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84B2D4CE2238C13D00498ADA /* FeedMetadata.swift */; };
84B99C9F1FAE8D3200ECDEDB /* ContainerPath.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84B99C9E1FAE8D3200ECDEDB /* ContainerPath.swift */; };
84C3654A1F899F3B001EC85C /* CombinedRefreshProgress.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84C365491F899F3B001EC85C /* CombinedRefreshProgress.swift */; };
84C8B3F41F89DE430053CCA6 /* DataExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84C8B3F31F89DE430053CCA6 /* DataExtensions.swift */; };
@ -101,6 +102,8 @@
848935041F62485000CEBD24 /* AccountTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountTests.swift; sourceTree = "<group>"; };
848935061F62485000CEBD24 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
848935101F62486800CEBD24 /* Account.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Account.swift; sourceTree = "<group>"; };
84AF4EA3222CFDD100F6A800 /* AccountSettings.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountSettings.swift; sourceTree = "<group>"; };
84B2D4CE2238C13D00498ADA /* FeedMetadata.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FeedMetadata.swift; sourceTree = "<group>"; };
84B99C9E1FAE8D3200ECDEDB /* ContainerPath.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContainerPath.swift; sourceTree = "<group>"; };
84C365491F899F3B001EC85C /* CombinedRefreshProgress.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CombinedRefreshProgress.swift; sourceTree = "<group>"; };
84C8B3F31F89DE430053CCA6 /* DataExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DataExtensions.swift; sourceTree = "<group>"; };
@ -200,9 +203,11 @@
children = (
846E77531F6F00E300A165E2 /* AccountManager.swift */,
848935101F62486800CEBD24 /* Account.swift */,
84AF4EA3222CFDD100F6A800 /* AccountSettings.swift */,
841974241F6DDCE4006346C4 /* AccountDelegate.swift */,
841974001F6DD1EC006346C4 /* Folder.swift */,
844B297C2106C7EC004020B3 /* Feed.swift */,
84B2D4CE2238C13D00498ADA /* FeedMetadata.swift */,
844B297E210CE37E004020B3 /* UnreadCountProvider.swift */,
84B99C9E1FAE8D3200ECDEDB /* ContainerPath.swift */,
84C365491F899F3B001EC85C /* CombinedRefreshProgress.swift */,
@ -417,6 +422,7 @@
841974251F6DDCE4006346C4 /* AccountDelegate.swift in Sources */,
846E77541F6F00E300A165E2 /* AccountManager.swift in Sources */,
844B297D2106C7EC004020B3 /* Feed.swift in Sources */,
84B2D4D02238CD8A00498ADA /* FeedMetadata.swift in Sources */,
84B99C9F1FAE8D3200ECDEDB /* ContainerPath.swift in Sources */,
846E77501F6EF9C400A165E2 /* LocalAccountRefresher.swift in Sources */,
84D09623217418DC00D77525 /* FeedbinTagging.swift in Sources */,

View File

@ -0,0 +1,10 @@
//
// AccountSettings.swift
// Account
//
// Created by Brent Simmons on 3/3/19.
// Copyright © 2019 Ranchero Software, LLC. All rights reserved.
//
import Foundation

View File

@ -0,0 +1,107 @@
//
// FeedMetadata.swift
// Account
//
// Created by Brent Simmons on 3/12/19.
// Copyright © 2019 Ranchero Software, LLC. All rights reserved.
//
import Foundation
import RSWeb
import Articles
protocol FeedMetadataDelegate: class {
func valueDidChange(_ feedMetadata: FeedMetadata, key: FeedMetadata.CodingKeys)
}
final class FeedMetadata: Codable {
let feedID: String
enum CodingKeys: String, CodingKey {
case feedID
case homePageURL
case iconURL
case faviconURL
case name
case editedName
case authors
case contentHash
case conditionalGetInfo
}
var homePageURL: String? {
didSet {
if homePageURL != oldValue {
valueDidChange(.homePageURL)
}
}
}
var iconURL: String? {
didSet {
if iconURL != oldValue {
valueDidChange(.iconURL)
}
}
}
var faviconURL: String? {
didSet {
if faviconURL != oldValue {
valueDidChange(.faviconURL)
}
}
}
var name: String? {
didSet {
if name != oldValue {
valueDidChange(.name)
}
}
}
var editedName: String? {
didSet {
if editedName != oldValue {
valueDidChange(.editedName)
}
}
}
var contentHash: String? {
didSet {
if contentHash != oldValue {
valueDidChange(.contentHash)
}
}
}
var authors: [Author]? {
didSet {
if authors != oldValue {
valueDidChange(.authors)
}
}
}
var conditionalGetInfo: HTTPConditionalGetInfo? {
didSet {
if conditionalGetInfo != oldValue {
valueDidChange(.conditionalGetInfo)
}
}
}
weak var delegate: FeedMetadataDelegate?
init(feedID: String, delegate: FeedMetadataDelegate) {
self.feedID = feedID
self.delegate = delegate
}
func valueDidChange(_ key: CodingKeys) {
delegate?.valueDidChange(self, key: key)
}
}