diff --git a/Modules/Account/Sources/Account/Account.swift b/Modules/Account/Sources/Account/Account.swift index 0acb62ef0..c810dd3e1 100644 --- a/Modules/Account/Sources/Account/Account.swift +++ b/Modules/Account/Sources/Account/Account.swift @@ -230,8 +230,7 @@ public enum FetchType { if refreshInProgress != oldValue { if refreshInProgress { NotificationCenter.default.post(name: .AccountRefreshDidBegin, object: self) - } - else { + } else { NotificationCenter.default.post(name: .AccountRefreshDidFinish, object: self) opmlFile.markAsDirty() } @@ -382,7 +381,7 @@ public enum FetchType { client: OAuthAuthorizationClient, accountType: AccountType, transport: Transport = URLSession.webserviceTransport(), - completion: @escaping @MainActor (Result) -> ()) { + completion: @escaping @MainActor (Result) -> Void) { let grantingType: OAuthAuthorizationGranting.Type switch accountType { @@ -395,7 +394,7 @@ public enum FetchType { grantingType.requestOAuthAccessToken(with: response, transport: transport, completion: completion) } - public func receiveRemoteNotification(userInfo: [AnyHashable : Any]) async { + public func receiveRemoteNotification(userInfo: [AnyHashable: Any]) async { await delegate.receiveRemoteNotification(for: self, userInfo: userInfo) } @@ -495,7 +494,7 @@ public enum FetchType { } @MainActor func loadOPMLItems(_ items: [RSOPMLItem]) { - addOPMLItems(OPMLNormalizer.normalize(items)) + addOPMLItems(OPMLNormalizer.normalize(items)) } public func markArticles(_ articles: Set
, statusKey: ArticleStatus.Key, flag: Bool, completion: @escaping (Result) -> Void) { @@ -766,7 +765,7 @@ public enum FetchType { public func fetchStarredArticleIDsAsync() async throws -> Set { try await database.fetchStarredArticleIDsAsync() } - + /// Fetch articleIDs for articles that we should have, but don’t. These articles are either (starred) or (newer than the article cutoff date). @MainActor public func fetchArticleIDsForStatusesWithoutArticlesNewerThanCutoffDateAsync() async throws -> Set { try await database.fetchArticleIDsForStatusesWithoutArticlesNewerThanCutoffDateAsync() @@ -836,7 +835,7 @@ public enum FetchType { let updatedStatuses = try await database.markAsync(articles: articles, statusKey: statusKey, flag: flag) let updatedArticleIDs = updatedStatuses.articleIDs() - let updatedArticles = Set(articles.filter{ updatedArticleIDs.contains($0.articleID) }) + let updatedArticles = Set(articles.filter { updatedArticleIDs.contains($0.articleID) }) noteStatusesForArticlesDidChange(updatedArticles) return updatedArticles @@ -1042,7 +1041,7 @@ public enum FetchType { // MARK: - Equatable - public class func ==(lhs: Account, rhs: Account) -> Bool { + public static func ==(lhs: Account, rhs: Account) -> Bool { return lhs === rhs } } @@ -1145,7 +1144,6 @@ public enum FetchType { return articles } - // MARK: - Feed Articles func _fetchArticles(feed: Feed) throws -> Set
{ @@ -1236,13 +1234,12 @@ public enum FetchType { if feeds.isEmpty { return } + if feeds.count == 1, let feed = feeds.first { _fetchUnreadCount(feed: feed) - } - else if feeds.count < 10 { + } else if feeds.count < 10 { _fetchUnreadCounts(feeds: feeds) - } - else { + } else { _fetchAllUnreadCounts() } } diff --git a/Modules/Account/Sources/Account/AccountManager.swift b/Modules/Account/Sources/Account/AccountManager.swift index 46b48c3c6..e2f3bf1ce 100644 --- a/Modules/Account/Sources/Account/AccountManager.swift +++ b/Modules/Account/Sources/Account/AccountManager.swift @@ -66,7 +66,6 @@ import RSDatabase return false } - public var activeAccounts: [Account] { assert(Thread.isMainThread) return Array(accountsDictionary.values.filter { $0.isActive }) @@ -77,7 +76,7 @@ import RSDatabase } public var lastArticleFetchEndTime: Date? { - var lastArticleFetchEndTime: Date? = nil + var lastArticleFetchEndTime: Date? for account in activeAccounts { if let accountLastArticleFetchEndTime = account.metadata.lastArticleFetchEndTime { if lastArticleFetchEndTime == nil || lastArticleFetchEndTime! < accountLastArticleFetchEndTime { @@ -112,8 +111,7 @@ import RSDatabase let localAccountFolder = (accountsFolder as NSString).appendingPathComponent("OnMyMac") do { try FileManager.default.createDirectory(atPath: localAccountFolder, withIntermediateDirectories: true, attributes: nil) - } - catch { + } catch { assertionFailure("Could not create folder for OnMyMac account.") abort() } @@ -181,11 +179,9 @@ import RSDatabase do { try FileManager.default.removeItem(atPath: account.dataFolder) - } - catch let error as CocoaError where error.code == .fileNoSuchFile { + } catch let error as CocoaError where error.code == .fileNoSuchFile { // Already doesn’t exist. - } - catch { + } catch { // TODO: add logging and/or reporting to user. No need to crash here. } @@ -263,7 +259,7 @@ import RSDatabase } } - public func receiveRemoteNotification(userInfo: [AnyHashable : Any]) async { + public func receiveRemoteNotification(userInfo: [AnyHashable: Any]) async { Task { for account in activeAccounts { await account.receiveRemoteNotification(userInfo: userInfo) @@ -351,7 +347,7 @@ import RSDatabase public func anyAccountHasFeedWithURL(_ urlString: String) -> Bool { for account in activeAccounts { - if let _ = account.existingFeed(withURL: urlString) { + if account.existingFeed(withURL: urlString) != nil { return true } } @@ -472,8 +468,7 @@ private extension AccountManager { do { filenames = try FileManager.default.contentsOfDirectory(atPath: accountsFolder) - } - catch { + } catch { print("Error reading Accounts folder: \(error)") return } diff --git a/Modules/Account/Sources/Account/CloudKit/CloudKitAccountDelegate.swift b/Modules/Account/Sources/Account/CloudKit/CloudKitAccountDelegate.swift index 450a6bc9d..43f1b5441 100644 --- a/Modules/Account/Sources/Account/CloudKit/CloudKitAccountDelegate.swift +++ b/Modules/Account/Sources/Account/CloudKit/CloudKitAccountDelegate.swift @@ -73,10 +73,10 @@ enum CloudKitAccountDelegateError: LocalizedError, Sendable { NotificationCenter.default.addObserver(self, selector: #selector(syncProgressDidChange(_:)), name: .DownloadProgressDidChange, object: syncProgress) } - func receiveRemoteNotification(for account: Account, userInfo: [AnyHashable : Any]) async { + func receiveRemoteNotification(for account: Account, userInfo: [AnyHashable: Any]) async { await withCheckedContinuation { continuation in let op = CloudKitRemoteNotificationOperation(accountZone: accountZone, articlesZone: articlesZone, userInfo: userInfo) - op.completionBlock = { mainThreadOperation in + op.completionBlock = { _ in continuation.resume() } mainThreadOperationQueue.add(op) @@ -279,7 +279,7 @@ enum CloudKitAccountDelegateError: LocalizedError, Sendable { } } } - + for await result in group { if case .failure = result { errorOccurred = true @@ -316,11 +316,11 @@ enum CloudKitAccountDelegateError: LocalizedError, Sendable { folder.externalID = externalID account.addFolderToTree(folder) - + await withTaskGroup(of: Void.self) { group in for feed in feedsToRestore { folder.topLevelFeeds.remove(feed) - + group.addTask { do { try await self.restoreFeed(for: account, feed: feed, container: folder) @@ -346,7 +346,7 @@ enum CloudKitAccountDelegateError: LocalizedError, Sendable { let syncStatuses = Set(articles.map { article in SyncStatus(articleID: article.articleID, key: SyncStatus.Key(statusKey), flag: flag) }) - + try await syncDatabase.insertStatuses(syncStatuses) if let count = try? await syncDatabase.selectPendingCount(), count > 100 { try await sendArticleStatus(for: account) @@ -548,7 +548,7 @@ private extension CloudKitAccountDelegate { } func updateAndCreateFeedInCloud(account: Account, feed: Feed, parsedFeed: ParsedFeed, bestFeedSpecifier: FeedSpecifier, editedName: String?, container: Container) async throws { - let _ = try await account.updateAsync(feed: feed, parsedFeed: parsedFeed) + _ = try await account.updateAsync(feed: feed, parsedFeed: parsedFeed) let externalID = try await accountZone.createFeed(url: bestFeedSpecifier.urlString, name: parsedFeed.title, @@ -657,7 +657,7 @@ private extension CloudKitAccountDelegate { syncProgress.addTasks(2) do { - let _ = try await accountZone.removeFeed(feed, from: container) + _ = try await accountZone.removeFeed(feed, from: container) syncProgress.completeTask() } catch { syncProgress.completeTask() @@ -681,7 +681,6 @@ private extension CloudKitAccountDelegate { throw error } } - } extension CloudKitAccountDelegate: LocalAccountRefresherDelegate { diff --git a/Modules/Account/Sources/Account/CloudKit/CloudKitAccountZone.swift b/Modules/Account/Sources/Account/CloudKit/CloudKitAccountZone.swift index d6dfa8a09..bb0956292 100644 --- a/Modules/Account/Sources/Account/CloudKit/CloudKitAccountZone.swift +++ b/Modules/Account/Sources/Account/CloudKit/CloudKitAccountZone.swift @@ -241,7 +241,7 @@ enum CloudKitAccountZoneError: LocalizedError { } case .zoneNotFound, .userDeletedZone: DispatchQueue.main.async { - self.createZoneRecord() { result in + self.createZoneRecord { result in switch result { case .success: self.findOrCreateAccount(completion: completion) diff --git a/Modules/Account/Sources/Account/CloudKit/CloudKitArticlesZone.swift b/Modules/Account/Sources/Account/CloudKit/CloudKitArticlesZone.swift index e3b7ad3b3..4055ca48f 100644 --- a/Modules/Account/Sources/Account/CloudKit/CloudKitArticlesZone.swift +++ b/Modules/Account/Sources/Account/CloudKit/CloudKitArticlesZone.swift @@ -17,12 +17,11 @@ import SyncDatabase import CloudKitSync final class CloudKitArticlesZone: CloudKitZone { - var zoneID: CKRecordZone.ID weak var container: CKContainer? weak var database: CKDatabase? - var delegate: CloudKitZoneDelegate? = nil + var delegate: CloudKitZoneDelegate? let compressionQueue = DispatchQueue(label: "Articles Zone Compression Queue") @@ -253,5 +252,4 @@ private extension CloudKitArticlesZone { return result } - } diff --git a/Modules/Account/Sources/Account/CloudKit/CloudKitArticlesZoneDelegate.swift b/Modules/Account/Sources/Account/CloudKit/CloudKitArticlesZoneDelegate.swift index f4225cb33..5ebb0c254 100644 --- a/Modules/Account/Sources/Account/CloudKit/CloudKitArticlesZoneDelegate.swift +++ b/Modules/Account/Sources/Account/CloudKit/CloudKitArticlesZoneDelegate.swift @@ -35,7 +35,7 @@ final class CloudKitArticlesZoneDelegate: CloudKitZoneDelegate { do { let pendingReadStatusArticleIDs = try await syncDatabase.selectPendingReadStatusArticleIDs() ?? Set() let pendingStarredStatusArticleIDs = try await syncDatabase.selectPendingStarredStatusArticleIDs() ?? Set() - + await delete(recordKeys: deleted, pendingStarredStatusArticleIDs: pendingStarredStatusArticleIDs) try await update(records: changed, pendingReadStatusArticleIDs: pendingReadStatusArticleIDs, diff --git a/Modules/Account/Sources/Account/CloudKit/CloudKitRemoteNotificationOperation.swift b/Modules/Account/Sources/Account/CloudKit/CloudKitRemoteNotificationOperation.swift index 0c753fb50..3a11829db 100644 --- a/Modules/Account/Sources/Account/CloudKit/CloudKitRemoteNotificationOperation.swift +++ b/Modules/Account/Sources/Account/CloudKit/CloudKitRemoteNotificationOperation.swift @@ -14,10 +14,10 @@ import CloudKitSync @MainActor final class CloudKitRemoteNotificationOperation: MainThreadOperation, @unchecked Sendable { private weak var accountZone: CloudKitAccountZone? private weak var articlesZone: CloudKitArticlesZone? - nonisolated(unsafe) private var userInfo: [AnyHashable : Any] + nonisolated(unsafe) private var userInfo: [AnyHashable: Any] private static let logger = cloudKitLogger - init(accountZone: CloudKitAccountZone, articlesZone: CloudKitArticlesZone, userInfo: [AnyHashable : Any]) { + init(accountZone: CloudKitAccountZone, articlesZone: CloudKitArticlesZone, userInfo: [AnyHashable: Any]) { self.accountZone = accountZone self.articlesZone = articlesZone self.userInfo = userInfo diff --git a/Modules/Account/Sources/Account/CloudKit/CloudKitSendStatusOperation.swift b/Modules/Account/Sources/Account/CloudKit/CloudKitSendStatusOperation.swift index 02b676d55..c94dfa442 100644 --- a/Modules/Account/Sources/Account/CloudKit/CloudKitSendStatusOperation.swift +++ b/Modules/Account/Sources/Account/CloudKit/CloudKitSendStatusOperation.swift @@ -113,7 +113,6 @@ final class CloudKitSendStatusOperation: MainThreadOperation, @unchecked Sendabl CloudKitArticleStatusUpdate(articleID: key, statuses: value, article: articlesDict[key]) } - // If this happens, we have somehow gotten into a state where we have new status records // but the articles didn't come back in the fetch. We need to clean up those sync records // and stop processing. diff --git a/Modules/Account/Sources/Account/Container.swift b/Modules/Account/Sources/Account/Container.swift index 3db716b70..9872b5887 100644 --- a/Modules/Account/Sources/Account/Container.swift +++ b/Modules/Account/Sources/Account/Container.swift @@ -1,4 +1,3 @@ - // // Container.swift // NetNewsWire @@ -12,12 +11,10 @@ import RSCore import Articles extension Notification.Name { - public static let ChildrenDidChange = Notification.Name("ChildrenDidChange") } @MainActor public protocol Container: AnyObject, ContainerIdentifiable { - var account: Account? { get } var topLevelFeeds: Set { get set } var folders: Set? { get set } @@ -32,7 +29,7 @@ extension Notification.Name { func removeFeedFromTreeAtTopLevel(_ feed: Feed) func addFeedToTreeAtTopLevel(_ feed: Feed) - //Recursive — checks subfolders + // Recursive — checks subfolders func flattenedFeeds() -> Set func has(_ feed: Feed) -> Bool func hasFeed(with feedID: String) -> Bool @@ -164,4 +161,3 @@ extension Notification.Name { NotificationCenter.default.post(name: .ChildrenDidChange, object: self) } } - diff --git a/Modules/Account/Sources/Account/ContainerIdentifier.swift b/Modules/Account/Sources/Account/ContainerIdentifier.swift index 1c5abab36..98fe3bbca 100644 --- a/Modules/Account/Sources/Account/ContainerIdentifier.swift +++ b/Modules/Account/Sources/Account/ContainerIdentifier.swift @@ -57,16 +57,16 @@ public enum ContainerIdentifier: Hashable, Equatable, Sendable { } extension ContainerIdentifier: Encodable { - enum CodingKeys: CodingKey { - case type - case accountID - case folderName - } + enum CodingKeys: CodingKey { + case type + case accountID + case folderName + } - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - switch self { - case .smartFeedController: + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + switch self { + case .smartFeedController: try container.encode("smartFeedController", forKey: .type) case .account(let accountID): try container.encode("account", forKey: .type) @@ -75,14 +75,14 @@ extension ContainerIdentifier: Encodable { try container.encode("folder", forKey: .type) try container.encode(accountID, forKey: .accountID) try container.encode(folderName, forKey: .folderName) - } - } + } + } } extension ContainerIdentifier: Decodable { - public init(from decoder: Decoder) throws { - let container = try decoder.container(keyedBy: CodingKeys.self) + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) let type = try container.decode(String.self, forKey: .type) switch type { @@ -96,6 +96,5 @@ extension ContainerIdentifier: Decodable { let folderName = try container.decode(String.self, forKey: .folderName) self = .folder(accountID, folderName) } - } - + } } diff --git a/Modules/Account/Sources/Account/DataExtensions.swift b/Modules/Account/Sources/Account/DataExtensions.swift index a480b9694..d710697b5 100644 --- a/Modules/Account/Sources/Account/DataExtensions.swift +++ b/Modules/Account/Sources/Account/DataExtensions.swift @@ -15,7 +15,6 @@ public extension Notification.Name { } public extension Feed { - static let SettingUserInfoKey = "feedSetting" struct SettingKey { @@ -48,7 +47,6 @@ extension Feed { } public extension Article { - @MainActor var account: Account? { return AccountManager.shared.existingAccount(accountID: accountID) } @@ -57,4 +55,3 @@ public extension Article { return account?.existingFeed(withFeedID: feedID) } } - diff --git a/Modules/Account/Sources/Account/Feed.swift b/Modules/Account/Sources/Account/Feed.swift index 97ee17368..8321d3094 100644 --- a/Modules/Account/Sources/Account/Feed.swift +++ b/Modules/Account/Sources/Account/Feed.swift @@ -30,8 +30,7 @@ import Articles set { if let url = newValue, !url.isEmpty { metadata.homePageURL = url.normalizedURL - } - else { + } else { metadata.homePageURL = nil } } @@ -81,8 +80,7 @@ import Articles set { if let authorsSet = newValue { metadata.authors = Array(authorsSet) - } - else { + } else { metadata.authors = nil } } @@ -100,8 +98,7 @@ import Articles if newValue != editedName { if let valueToSet = newValue, !valueToSet.isEmpty { metadata.editedName = valueToSet - } - else { + } else { metadata.editedName = nil } postDisplayNameDidChangeNotification() @@ -254,9 +251,6 @@ import Articles var metadata: FeedMetadata - // MARK: - Private - - // MARK: - Init init(account: Account, url: String, metadata: FeedMetadata) { @@ -287,8 +281,8 @@ import Articles // MARK: - Equatable - public class func ==(lhs: Feed, rhs: Feed) -> Bool { - return lhs.feedID == rhs.feedID && lhs.accountID == rhs.accountID + public static func ==(lhs: Feed, rhs: Feed) -> Bool { + lhs.feedID == rhs.feedID && lhs.accountID == rhs.accountID } } diff --git a/Modules/Account/Sources/Account/FeedMetadataFile.swift b/Modules/Account/Sources/Account/FeedMetadataFile.swift index ea3601de2..fd9aba75f 100644 --- a/Modules/Account/Sources/Account/FeedMetadataFile.swift +++ b/Modules/Account/Sources/Account/FeedMetadataFile.swift @@ -72,8 +72,8 @@ private extension FeedMetadataFile { private func metadataForOnlySubscribedToFeeds() -> Account.FeedMetadataDictionary { let feedIDs = account.idToFeedDictionary.keys - return account.feedMetadata.filter { (feedID: String, metadata: FeedMetadata) -> Bool in - return feedIDs.contains(metadata.feedID) + return account.feedMetadata.filter { (_, metadata) -> Bool in + feedIDs.contains(metadata.feedID) } } } diff --git a/Modules/Account/Sources/Account/Folder.swift b/Modules/Account/Sources/Account/Folder.swift index 81451bb9e..d9c5a7d6a 100644 --- a/Modules/Account/Sources/Account/Folder.swift +++ b/Modules/Account/Sources/Account/Folder.swift @@ -27,7 +27,7 @@ public final class Folder: SidebarItem, Renamable, Container, Hashable { } public var topLevelFeeds: Set = Set() - public var folders: Set? = nil // subfolders are not supported, so this is always nil + public var folders: Set? // subfolders are not supported, so this is always nil public var name: String? { didSet { @@ -37,7 +37,7 @@ public final class Folder: SidebarItem, Renamable, Container, Hashable { static let untitledName = NSLocalizedString("Untitled ƒ", comment: "Folder name") nonisolated public let folderID: Int // not saved: per-run only - public var externalID: String? = nil + public var externalID: String? static var incrementingID = 0 // MARK: - DisplayNameProvider @@ -192,7 +192,7 @@ extension Folder: OPMLRepresentable { var hasAtLeastOneChild = false - for feed in topLevelFeeds.sorted() { + for feed in topLevelFeeds.sorted() { s += feed.OPMLString(indentLevel: indentLevel + 1, allowCustomAttributes: allowCustomAttributes) hasAtLeastOneChild = true } diff --git a/Modules/Account/Sources/Account/NewsBlur/Internals/NewsBlurAccountDelegate+Internal.swift b/Modules/Account/Sources/Account/NewsBlur/Internals/NewsBlurAccountDelegate+Internal.swift index 32004c4de..0b09a2474 100644 --- a/Modules/Account/Sources/Account/NewsBlur/Internals/NewsBlurAccountDelegate+Internal.swift +++ b/Modules/Account/Sources/Account/NewsBlur/Internals/NewsBlurAccountDelegate+Internal.swift @@ -107,8 +107,7 @@ import os.log feed.homePageURL = feed.homePageURL feed.externalID = String(feed.feedID) feed.faviconURL = feed.faviconURL - } - else { + } else { feedsToAdd.insert(feed) } } @@ -397,7 +396,7 @@ import os.log } let folderName = (container as? Folder)?.name - + do { try await caller.deleteFeed(feedID: feedID, folder: folderName) diff --git a/Modules/Account/Sources/Account/NewsBlur/NewsBlurAccountDelegate.swift b/Modules/Account/Sources/Account/NewsBlur/NewsBlurAccountDelegate.swift index 1775253f4..26e6cf03c 100644 --- a/Modules/Account/Sources/Account/NewsBlur/NewsBlurAccountDelegate.swift +++ b/Modules/Account/Sources/Account/NewsBlur/NewsBlurAccountDelegate.swift @@ -27,7 +27,7 @@ import Secrets } } - var accountMetadata: AccountMetadata? = nil + var accountMetadata: AccountMetadata? var refreshProgress = DownloadProgress(numberOfTasks: 0) let caller: NewsBlurAPICaller @@ -59,7 +59,7 @@ import Secrets syncDatabase = SyncDatabase(databasePath: dataFolder.appending("/DB.sqlite3")) } - func receiveRemoteNotification(for account: Account, userInfo: [AnyHashable : Any]) async { + func receiveRemoteNotification(for account: Account, userInfo: [AnyHashable: Any]) async { } func refreshAll(for account: Account) async throws { @@ -235,7 +235,6 @@ import Secrets return !feedIDsAndItems.isEmpty } - @MainActor func importOPML(for account: Account, opmlFile: URL) async throws { } diff --git a/Modules/Account/Sources/Account/OPMLFile.swift b/Modules/Account/Sources/Account/OPMLFile.swift index 7a3b5cacf..bf5d372b0 100644 --- a/Modules/Account/Sources/Account/OPMLFile.swift +++ b/Modules/Account/Sources/Account/OPMLFile.swift @@ -76,7 +76,7 @@ private extension OPMLFile { } func opmlFileData() -> Data? { - var fileData: Data? = nil + var fileData: Data? do { fileData = try Data(contentsOf: fileURL) diff --git a/Modules/Account/Sources/Account/OPMLNormalizer.swift b/Modules/Account/Sources/Account/OPMLNormalizer.swift index 2830ca857..d1ed0dccf 100644 --- a/Modules/Account/Sources/Account/OPMLNormalizer.swift +++ b/Modules/Account/Sources/Account/OPMLNormalizer.swift @@ -24,14 +24,14 @@ final class OPMLNormalizer { items.forEach { (item) in - if let _ = item.feedSpecifier { + if item.feedSpecifier != nil { if !feedsToAdd.contains(where: { $0.feedSpecifier?.feedURL == item.feedSpecifier?.feedURL }) { feedsToAdd.append(item) } return } - guard let _ = item.titleFromAttributes else { + guard item.titleFromAttributes != nil else { // Folder doesn’t have a name, so it won’t be created, and its items will go one level up. if let itemChildren = item.children { normalize(itemChildren, parentFolder: parentFolder) diff --git a/Modules/Account/Sources/Account/ReaderAPI/ReaderAPIAccountDelegate.swift b/Modules/Account/Sources/Account/ReaderAPI/ReaderAPIAccountDelegate.swift index 6485242d7..db8c17bfb 100644 --- a/Modules/Account/Sources/Account/ReaderAPI/ReaderAPIAccountDelegate.swift +++ b/Modules/Account/Sources/Account/ReaderAPI/ReaderAPIAccountDelegate.swift @@ -355,7 +355,6 @@ final class ReaderAPIAccountDelegate: AccountDelegate { } } - func moveFeed(account: Account, feed: Feed, sourceContainer: Container, destinationContainer: Container) async throws { if sourceContainer is Account { diff --git a/Modules/Account/Sources/Account/ReaderAPI/ReaderAPICaller.swift b/Modules/Account/Sources/Account/ReaderAPI/ReaderAPICaller.swift index 443770d8a..bf0ab6887 100644 --- a/Modules/Account/Sources/Account/ReaderAPI/ReaderAPICaller.swift +++ b/Modules/Account/Sources/Account/ReaderAPI/ReaderAPICaller.swift @@ -57,22 +57,18 @@ enum CreateReaderAPISubscriptionResult { var credentials: Credentials? @MainActor var server: String? { - get { - return apiBaseURL?.host - } + apiBaseURL?.host } @MainActor private var apiBaseURL: URL? { - get { - switch variant { - case .generic, .freshRSS: - guard let accountMetadata = accountMetadata else { - return nil - } - return accountMetadata.endpointURL - default: - return URL(string: variant.host) + switch variant { + case .generic, .freshRSS: + guard let accountMetadata = accountMetadata else { + return nil } + return accountMetadata.endpointURL + default: + return URL(string: variant.host) } } @@ -292,7 +288,6 @@ enum CreateReaderAPISubscriptionResult { return .created(subscription) } - public func renameSubscription(subscriptionID: String, newName: String) async throws { try await changeSubscription(subscriptionID: subscriptionID, title: newName) diff --git a/Modules/Account/Sources/Account/ReaderAPI/ReaderAPIEntry.swift b/Modules/Account/Sources/Account/ReaderAPI/ReaderAPIEntry.swift index 399db439e..806935aa5 100644 --- a/Modules/Account/Sources/Account/ReaderAPI/ReaderAPIEntry.swift +++ b/Modules/Account/Sources/Account/ReaderAPI/ReaderAPIEntry.swift @@ -123,7 +123,7 @@ struct ReaderAPIEntryOrigin: Codable, Sendable { let title: String? enum CodingKeys: String, CodingKey { - case streamId = "streamId" - case title = "title" + case streamId + case title } } diff --git a/Modules/Account/Sources/Account/ReaderAPI/ReaderAPISubscription.swift b/Modules/Account/Sources/Account/ReaderAPI/ReaderAPISubscription.swift index 3f87c877e..9ab151cca 100644 --- a/Modules/Account/Sources/Account/ReaderAPI/ReaderAPISubscription.swift +++ b/Modules/Account/Sources/Account/ReaderAPI/ReaderAPISubscription.swift @@ -25,9 +25,9 @@ struct ReaderAPIQuickAddResult: Codable, Sendable { let streamId: String? enum CodingKeys: String, CodingKey { - case numResults = "numResults" - case error = "error" - case streamId = "streamId" + case numResults + case error + case streamId } } @@ -35,7 +35,7 @@ struct ReaderAPISubscriptionContainer: Codable, Sendable { let subscriptions: [ReaderAPISubscription] enum CodingKeys: String, CodingKey { - case subscriptions = "subscriptions" + case subscriptions } } @@ -66,7 +66,7 @@ struct ReaderAPISubscription: Codable, Sendable { enum CodingKeys: String, CodingKey { case feedID = "id" case name = "title" - case categories = "categories" + case categories case feedURL = "url" case homePageURL = "htmlUrl" case iconURL = "iconUrl" diff --git a/Modules/Account/Sources/Account/ReaderAPI/ReaderAPITag.swift b/Modules/Account/Sources/Account/ReaderAPI/ReaderAPITag.swift index 04519a815..f15d01fbc 100644 --- a/Modules/Account/Sources/Account/ReaderAPI/ReaderAPITag.swift +++ b/Modules/Account/Sources/Account/ReaderAPI/ReaderAPITag.swift @@ -12,7 +12,7 @@ struct ReaderAPITagContainer: Codable, Sendable { let tags: [ReaderAPITag] enum CodingKeys: String, CodingKey { - case tags = "tags" + case tags } } @@ -22,7 +22,7 @@ struct ReaderAPITag: Codable, Sendable { enum CodingKeys: String, CodingKey { case tagID = "id" - case type = "type" + case type } var folderName: String? { diff --git a/Modules/Account/Sources/Account/ReaderAPI/ReaderAPIUnreadEntry.swift b/Modules/Account/Sources/Account/ReaderAPI/ReaderAPIUnreadEntry.swift index 0f2d4c566..d34ae73a7 100644 --- a/Modules/Account/Sources/Account/ReaderAPI/ReaderAPIUnreadEntry.swift +++ b/Modules/Account/Sources/Account/ReaderAPI/ReaderAPIUnreadEntry.swift @@ -13,8 +13,8 @@ struct ReaderAPIReferenceWrapper: Codable, Sendable { let continuation: String? enum CodingKeys: String, CodingKey { - case itemRefs = "itemRefs" - case continuation = "continuation" + case itemRefs + case continuation } } diff --git a/Modules/RSMarkdown/Package.swift b/Modules/RSMarkdown/Package.swift index edd9cfd08..9dc8f3a27 100644 --- a/Modules/RSMarkdown/Package.swift +++ b/Modules/RSMarkdown/Package.swift @@ -7,7 +7,7 @@ let package = Package( products: [ .library( name: "RSMarkdown", - targets: ["RSMarkdown"]), + targets: ["RSMarkdown"]) ], dependencies: [ .package(url: "https://github.com/apple/swift-markdown.git", from: "0.4.0") @@ -28,6 +28,6 @@ let package = Package( name: "RSMarkdownTests", dependencies: ["RSMarkdown"], resources: [.process("Resources")] - ), + ) ] ) diff --git a/Modules/RSMarkdown/Tests/RSMarkdownTests/RSMarkdownTests.swift b/Modules/RSMarkdown/Tests/RSMarkdownTests/RSMarkdownTests.swift index 45e9e2016..720f55371 100644 --- a/Modules/RSMarkdown/Tests/RSMarkdownTests/RSMarkdownTests.swift +++ b/Modules/RSMarkdown/Tests/RSMarkdownTests/RSMarkdownTests.swift @@ -125,7 +125,7 @@ final class RSMarkdownTests: XCTestCase { let markdown = """ First paragraph. - Second paragraph with + Second paragraph with line break. """ let html = RSMarkdown.markdownToHTML(markdown) diff --git a/Modules/SyncDatabase/Package.swift b/Modules/SyncDatabase/Package.swift index 95fd7e7ce..717f58365 100644 --- a/Modules/SyncDatabase/Package.swift +++ b/Modules/SyncDatabase/Package.swift @@ -8,12 +8,12 @@ let package = Package( .library( name: "SyncDatabase", type: .dynamic, - targets: ["SyncDatabase"]), + targets: ["SyncDatabase"]) ], dependencies: [ .package(path: "../Articles"), .package(path: "../RSCore"), - .package(path: "../RSDatabase"), + .package(path: "../RSDatabase") ], targets: [ .target( @@ -21,13 +21,13 @@ let package = Package( dependencies: [ "RSCore", "RSDatabase", - "Articles", + "Articles" ], swiftSettings: [ .enableUpcomingFeature("NonisolatedNonsendingByDefault"), .enableUpcomingFeature("InferIsolatedConformances"), .unsafeFlags(["-warnings-as-errors"]) ] - ), + ) ] ) diff --git a/Modules/SyncDatabase/Sources/SyncDatabase/SyncStatusTable.swift b/Modules/SyncDatabase/Sources/SyncDatabase/SyncStatusTable.swift index a1e131205..74e075546 100644 --- a/Modules/SyncDatabase/Sources/SyncDatabase/SyncStatusTable.swift +++ b/Modules/SyncDatabase/Sources/SyncDatabase/SyncStatusTable.swift @@ -119,7 +119,7 @@ private extension SyncStatusTable { return nil } - let articleIDs = resultSet.mapToSet{ $0.string(forColumnIndex: 0) } + let articleIDs = resultSet.mapToSet { $0.string(forColumnIndex: 0) } return articleIDs } }