NetNewsWire/Frameworks/Account/AccountMetadata.swift

108 lines
2.0 KiB
Swift
Raw Normal View History

//
// AccountMetadata.swift
// Account
//
// Created by Brent Simmons on 3/3/19.
// Copyright © 2019 Ranchero Software, LLC. All rights reserved.
//
import Foundation
import RSWeb
protocol AccountMetadataDelegate: class {
func valueDidChange(_ accountMetadata: AccountMetadata, key: AccountMetadata.CodingKeys)
}
final class AccountMetadata: Codable {
enum CodingKeys: String, CodingKey {
case name
case isActive
case username
case conditionalGetInfo
case lastArticleFetchStartTime = "lastArticleFetch"
case lastArticleFetchEndTime
case endpointURL
2020-03-30 22:15:45 +02:00
case externalID
case performedApril2020RetentionPolicyChange
}
var name: String? {
didSet {
if name != oldValue {
valueDidChange(.name)
}
}
}
var isActive: Bool = true {
didSet {
if isActive != oldValue {
valueDidChange(.isActive)
}
}
}
var username: String? {
didSet {
if username != oldValue {
valueDidChange(.username)
}
}
}
var conditionalGetInfo = [String: HTTPConditionalGetInfo]() {
didSet {
if conditionalGetInfo != oldValue {
valueDidChange(.conditionalGetInfo)
}
}
}
2019-05-13 01:32:32 +02:00
var lastArticleFetchStartTime: Date? {
2019-05-13 01:32:32 +02:00
didSet {
if lastArticleFetchStartTime != oldValue {
valueDidChange(.lastArticleFetchStartTime)
}
}
}
var lastArticleFetchEndTime: Date? {
didSet {
if lastArticleFetchEndTime != oldValue {
valueDidChange(.lastArticleFetchEndTime)
2019-05-13 01:32:32 +02:00
}
}
}
var endpointURL: URL? {
didSet {
if endpointURL != oldValue {
valueDidChange(.endpointURL)
}
}
}
var performedApril2020RetentionPolicyChange: Bool? {
didSet {
if performedApril2020RetentionPolicyChange != oldValue {
valueDidChange(.performedApril2020RetentionPolicyChange)
}
}
}
2020-03-30 22:15:45 +02:00
var externalID: String? {
didSet {
if externalID != oldValue {
valueDidChange(.externalID)
}
}
}
weak var delegate: AccountMetadataDelegate?
func valueDidChange(_ key: CodingKeys) {
delegate?.valueDidChange(self, key: key)
}
}