2019-03-13 06:40:11 +01:00
|
|
|
//
|
2019-11-15 03:11:41 +01:00
|
|
|
// WebFeedMetadata.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
|
|
|
|
|
2019-11-15 03:11:41 +01:00
|
|
|
protocol WebFeedMetadataDelegate: class {
|
|
|
|
func valueDidChange(_ feedMetadata: WebFeedMetadata, key: WebFeedMetadata.CodingKeys)
|
2019-03-13 06:40:11 +01:00
|
|
|
}
|
|
|
|
|
2019-11-15 03:11:41 +01:00
|
|
|
final class WebFeedMetadata: Codable {
|
2019-03-13 06:40:11 +01:00
|
|
|
|
|
|
|
enum CodingKeys: String, CodingKey {
|
2019-11-15 03:11:41 +01:00
|
|
|
case webFeedID = "feedID"
|
2019-03-13 06:40:11 +01:00
|
|
|
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-11-15 03:11:41 +01:00
|
|
|
var webFeedID: String {
|
2019-05-08 16:54:55 +02:00
|
|
|
didSet {
|
2019-11-15 03:11:41 +01:00
|
|
|
if webFeedID != oldValue {
|
|
|
|
valueDidChange(.webFeedID)
|
2019-05-08 16:54:55 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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
|
|
|
|
2019-11-15 03:11:41 +01:00
|
|
|
weak var delegate: WebFeedMetadataDelegate?
|
2019-03-13 06:40:11 +01:00
|
|
|
|
2019-11-15 03:11:41 +01:00
|
|
|
init(webFeedID: String) {
|
|
|
|
self.webFeedID = webFeedID
|
2019-03-13 06:40:11 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
func valueDidChange(_ key: CodingKeys) {
|
|
|
|
delegate?.valueDidChange(self, key: key)
|
|
|
|
}
|
|
|
|
}
|