From 3b92fe9c78f54fbdaa9265a0e90d55a2fe9b91d6 Mon Sep 17 00:00:00 2001 From: Brent Simmons Date: Fri, 22 Nov 2024 21:51:35 -0800 Subject: [PATCH] =?UTF-8?q?Remove=20code=20for=20handling=20April=202020?= =?UTF-8?q?=20retention=20change,=20since=20it=E2=80=99s=20been=20four-and?= =?UTF-8?q?-a-half=20years.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Account/Sources/Account/Account.swift | 12 ------------ Account/Sources/Account/AccountMetadata.swift | 8 +------- .../ArticlesDatabase/ArticlesDatabase.swift | 18 ------------------ 3 files changed, 1 insertion(+), 37 deletions(-) diff --git a/Account/Sources/Account/Account.swift b/Account/Sources/Account/Account.swift index 305186116..0c52c714a 100644 --- a/Account/Sources/Account/Account.swift +++ b/Account/Sources/Account/Account.swift @@ -321,19 +321,7 @@ public final class Account: DisplayNameProvider, UnreadCountProvider, Container, webFeedMetadataFile.load() opmlFile.load() - var shouldHandleRetentionPolicyChange = false - if type == .onMyMac { - let didHandlePolicyChange = metadata.performedApril2020RetentionPolicyChange ?? false - shouldHandleRetentionPolicyChange = !didHandlePolicyChange - } - DispatchQueue.main.async { - if shouldHandleRetentionPolicyChange { - // Handle one-time database changes made necessary by April 2020 retention policy change. - self.database.performApril2020RetentionPolicyChange() - self.metadata.performedApril2020RetentionPolicyChange = true - } - self.database.cleanupDatabaseAtStartup(subscribedToWebFeedIDs: self.flattenedWebFeeds().webFeedIDs()) self.fetchAllUnreadCounts() } diff --git a/Account/Sources/Account/AccountMetadata.swift b/Account/Sources/Account/AccountMetadata.swift index 4fa08063a..8d9ba4fc1 100644 --- a/Account/Sources/Account/AccountMetadata.swift +++ b/Account/Sources/Account/AccountMetadata.swift @@ -83,13 +83,7 @@ final class AccountMetadata: Codable { } } - var performedApril2020RetentionPolicyChange: Bool? { - didSet { - if performedApril2020RetentionPolicyChange != oldValue { - valueDidChange(.performedApril2020RetentionPolicyChange) - } - } - } + var performedApril2020RetentionPolicyChange: Bool? // No longer used. var externalID: String? { didSet { diff --git a/ArticlesDatabase/Sources/ArticlesDatabase/ArticlesDatabase.swift b/ArticlesDatabase/Sources/ArticlesDatabase/ArticlesDatabase.swift index 5a7355201..e70ddd138 100644 --- a/ArticlesDatabase/Sources/ArticlesDatabase/ArticlesDatabase.swift +++ b/ArticlesDatabase/Sources/ArticlesDatabase/ArticlesDatabase.swift @@ -296,24 +296,6 @@ public final class ArticlesDatabase { articlesTable.deleteArticlesNotInSubscribedToFeedIDs(subscribedToWebFeedIDs) articlesTable.deleteOldStatuses() } - - /// Do database cleanups made necessary by the retention policy change in April 2020. - /// - /// The retention policy for feed-based systems changed in April 2020: - /// we keep articles only for as long as they’re in the feed. - /// This change could result in a bunch of older articles suddenly - /// appearing as unread articles. - /// - /// These are articles that were in the database, - /// but weren’t appearing in the UI because they were beyond the 90-day window. - /// (The previous retention policy used a 90-day window.) - /// - /// This function marks everything as read that’s beyond that 90-day window. - /// It’s intended to be called only once on an account. - public func performApril2020RetentionPolicyChange() { - precondition(retentionStyle == .feedBased) - articlesTable.markOlderStatusesAsRead() - } } // MARK: - Private