2019-03-13 06:40:11 +01:00
|
|
|
//
|
|
|
|
// FeedMetadata.swift
|
2019-07-09 07:58:19 +02:00
|
|
|
// NetNewsWire
|
2019-03-13 06:40:11 +01:00
|
|
|
//
|
|
|
|
// 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)
|
|
|
|
}
|
|
|
|
|
2019-03-17 00:39:16 +01:00
|
|
|
final class FeedMetadata: Codable {
|
2019-03-13 06:40:11 +01:00
|
|
|
|
|
|
|
enum CodingKeys: String, CodingKey {
|
|
|
|
case feedID
|
|
|
|
case homePageURL
|
|
|
|
case iconURL
|
|
|
|
case faviconURL
|
|
|
|
case editedName
|
|
|
|
case authors
|
|
|
|
case contentHash
|
2019-10-03 02:42:16 +02:00
|
|
|
case isNotifyAboutNewArticles
|
2019-09-20 02:49:11 +02:00
|
|
|
case isArticleExtractorAlwaysOn
|
2019-03-13 06:40:11 +01:00
|
|
|
case conditionalGetInfo
|
2019-05-09 01:13:54 +02:00
|
|
|
case subscriptionID
|
2019-05-08 01:34:45 +02:00
|
|
|
case folderRelationship
|
2019-03-13 06:40:11 +01:00
|
|
|
}
|
|
|
|
|
2019-05-08 16:54:55 +02:00
|
|
|
var feedID: String {
|
|
|
|
didSet {
|
|
|
|
if feedID != oldValue {
|
|
|
|
valueDidChange(.feedID)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-03-13 06:40:11 +01:00
|
|
|
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 editedName: String? {
|
|
|
|
didSet {
|
|
|
|
if editedName != oldValue {
|
|
|
|
valueDidChange(.editedName)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
var contentHash: String? {
|
|
|
|
didSet {
|
|
|
|
if contentHash != oldValue {
|
|
|
|
valueDidChange(.contentHash)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-09-20 02:49:11 +02:00
|
|
|
|
2019-10-03 02:42:16 +02:00
|
|
|
var isNotifyAboutNewArticles: Bool? {
|
|
|
|
didSet {
|
|
|
|
if isNotifyAboutNewArticles != oldValue {
|
|
|
|
valueDidChange(.isNotifyAboutNewArticles)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-09-20 03:12:55 +02:00
|
|
|
var isArticleExtractorAlwaysOn: Bool? {
|
2019-09-20 02:49:11 +02:00
|
|
|
didSet {
|
|
|
|
if isArticleExtractorAlwaysOn != oldValue {
|
2019-10-03 02:42:16 +02:00
|
|
|
valueDidChange(.isArticleExtractorAlwaysOn)
|
2019-09-20 02:49:11 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-03-13 06:40:11 +01:00
|
|
|
|
|
|
|
var authors: [Author]? {
|
|
|
|
didSet {
|
|
|
|
if authors != oldValue {
|
|
|
|
valueDidChange(.authors)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
var conditionalGetInfo: HTTPConditionalGetInfo? {
|
|
|
|
didSet {
|
|
|
|
if conditionalGetInfo != oldValue {
|
|
|
|
valueDidChange(.conditionalGetInfo)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-05-08 01:34:45 +02:00
|
|
|
|
2019-05-09 01:13:54 +02:00
|
|
|
var subscriptionID: String? {
|
|
|
|
didSet {
|
|
|
|
if subscriptionID != oldValue {
|
|
|
|
valueDidChange(.subscriptionID)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-05-08 16:54:55 +02:00
|
|
|
// Folder Name: Sync Service Relationship ID
|
2019-05-08 01:34:45 +02:00
|
|
|
var folderRelationship: [String: String]? {
|
|
|
|
didSet {
|
|
|
|
if folderRelationship != oldValue {
|
|
|
|
valueDidChange(.folderRelationship)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-03-13 06:40:11 +01:00
|
|
|
|
|
|
|
weak var delegate: FeedMetadataDelegate?
|
|
|
|
|
2019-03-14 07:41:43 +01:00
|
|
|
init(feedID: String) {
|
2019-03-13 06:40:11 +01:00
|
|
|
self.feedID = feedID
|
|
|
|
}
|
|
|
|
|
|
|
|
func valueDidChange(_ key: CodingKeys) {
|
|
|
|
delegate?.valueDidChange(self, key: key)
|
|
|
|
}
|
|
|
|
}
|