mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
Restore the infrastructure for saving conditional GET info, since the built-in caching isn’t handling this as well as it appeared at first.
This commit is contained in:
@@ -919,6 +919,14 @@ public final class Account: DisplayNameProvider, UnreadCountProvider, Container,
|
||||
|
||||
// MARK: - Debug
|
||||
|
||||
public func debugDropConditionalGetInfo() {
|
||||
#if DEBUG
|
||||
for feed in flattenedWebFeeds() {
|
||||
feed.dropConditionalGetInfo()
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
public func debugRunSearch() {
|
||||
#if DEBUG
|
||||
let t1 = Date()
|
||||
|
||||
@@ -792,6 +792,7 @@ private extension CloudKitAccountDelegate {
|
||||
return
|
||||
}
|
||||
self.articlesZone.deleteArticles(webFeedExternalID) { result in
|
||||
feed.dropConditionalGetInfo()
|
||||
self.syncProgress.completeTask()
|
||||
completion(result)
|
||||
}
|
||||
|
||||
@@ -82,8 +82,9 @@ class CloudKitAcountZoneDelegate: CloudKitZoneDelegate {
|
||||
|
||||
func removeWebFeed(_ externalID: String) {
|
||||
if let webFeed = account?.existingWebFeed(withExternalID: externalID), let containers = account?.existingContainers(withWebFeed: webFeed) {
|
||||
containers.forEach {
|
||||
$0.removeWebFeed(webFeed)
|
||||
for container in containers {
|
||||
webFeed.dropConditionalGetInfo()
|
||||
container.removeWebFeed(webFeed)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ public extension WebFeed {
|
||||
public static let editedName = "editedName"
|
||||
public static let authors = "authors"
|
||||
public static let contentHash = "contentHash"
|
||||
public static let conditionalGetInfo = "conditionalGetInfo"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -123,6 +123,15 @@ public final class WebFeed: Feed, Renamable, Hashable {
|
||||
}
|
||||
}
|
||||
|
||||
public var conditionalGetInfo: HTTPConditionalGetInfo? {
|
||||
get {
|
||||
return metadata.conditionalGetInfo
|
||||
}
|
||||
set {
|
||||
metadata.conditionalGetInfo = newValue
|
||||
}
|
||||
}
|
||||
|
||||
public var contentHash: String? {
|
||||
get {
|
||||
return metadata.contentHash
|
||||
@@ -235,6 +244,13 @@ public final class WebFeed: Feed, Renamable, Hashable {
|
||||
self.metadata = metadata
|
||||
}
|
||||
|
||||
// MARK: - API
|
||||
|
||||
public func dropConditionalGetInfo() {
|
||||
conditionalGetInfo = nil
|
||||
contentHash = nil
|
||||
}
|
||||
|
||||
// MARK: - Hashable
|
||||
|
||||
public func hash(into hasher: inout Hasher) {
|
||||
|
||||
@@ -26,6 +26,7 @@ final class WebFeedMetadata: Codable {
|
||||
case contentHash
|
||||
case isNotifyAboutNewArticles
|
||||
case isArticleExtractorAlwaysOn
|
||||
case conditionalGetInfo
|
||||
case externalID = "subscriptionID"
|
||||
case folderRelationship
|
||||
}
|
||||
@@ -102,6 +103,14 @@ final class WebFeedMetadata: Codable {
|
||||
}
|
||||
}
|
||||
|
||||
var conditionalGetInfo: HTTPConditionalGetInfo? {
|
||||
didSet {
|
||||
if conditionalGetInfo != oldValue {
|
||||
valueDidChange(.conditionalGetInfo)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var externalID: String? {
|
||||
didSet {
|
||||
if externalID != oldValue {
|
||||
|
||||
@@ -704,6 +704,14 @@ extension AppDelegate {
|
||||
AccountManager.shared.defaultAccount.debugRunSearch()
|
||||
}
|
||||
|
||||
@IBAction func debugDropConditionalGetInfo(_ sender: Any?) {
|
||||
#if DEBUG
|
||||
for account in AccountManager.shared.activeAccounts {
|
||||
account.debugDropConditionalGetInfo()
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@IBAction func debugTestCrashReporterWindow(_ sender: Any?) {
|
||||
#if DEBUG
|
||||
crashReportWindowController = CrashReportWindowController(crashLogText: "This is a test crash log.")
|
||||
|
||||
Reference in New Issue
Block a user