Fix some build warnings.

This commit is contained in:
Brent Simmons 2024-03-24 22:42:48 -07:00
parent aa31f86362
commit 4990a99ba8
7 changed files with 41 additions and 34 deletions

View File

@ -34,7 +34,11 @@ let package = Package(
"Database", "Database",
"Core", "Core",
"CloudKitExtras" "CloudKitExtras"
]), ],
swiftSettings: [
.enableExperimentalFeature("StrictConcurrency")
]
),
.testTarget( .testTarget(
name: "AccountTests", name: "AccountTests",
dependencies: ["Account"], dependencies: ["Account"],

View File

@ -409,10 +409,18 @@ public final class Account: DisplayNameProvider, UnreadCountProvider, Container,
grantingType.requestOAuthAccessToken(with: response, transport: transport, secretsProvider: secretsProvider, completion: completion) grantingType.requestOAuthAccessToken(with: response, transport: transport, secretsProvider: secretsProvider, completion: completion)
} }
public func receiveRemoteNotification(userInfo: [AnyHashable : Any], completion: @escaping () -> Void) { private func receiveRemoteNotification(userInfo: [AnyHashable : Any], completion: @escaping () -> Void) {
delegate.receiveRemoteNotification(for: self, userInfo: userInfo, completion: completion) delegate.receiveRemoteNotification(for: self, userInfo: userInfo, completion: completion)
} }
public func receiveRemoteNotification(userInfo: [AnyHashable: Any]) async {
await withCheckedContinuation { continuation in
self.receiveRemoteNotification(userInfo: userInfo) {
continuation.resume()
}
}
}
public func refreshAll(completion: @escaping (Result<Void, Error>) -> Void) { public func refreshAll(completion: @escaping (Result<Void, Error>) -> Void) {
delegate.refreshAll(for: self, completion: completion) delegate.refreshAll(for: self, completion: completion)
} }

View File

@ -216,18 +216,10 @@ public final class AccountManager: UnreadCountProvider {
accounts.forEach { $0.resume() } accounts.forEach { $0.resume() }
} }
public func receiveRemoteNotification(userInfo: [AnyHashable : Any], completion: (() -> Void)? = nil) { public func receiveRemoteNotification(userInfo: [AnyHashable : Any]) async {
let group = DispatchGroup()
activeAccounts.forEach { account in for account in activeAccounts {
group.enter() await account.receiveRemoteNotification(userInfo: userInfo)
account.receiveRemoteNotification(userInfo: userInfo) {
group.leave()
}
}
group.notify(queue: DispatchQueue.main) {
completion?()
} }
} }

View File

@ -42,7 +42,7 @@ final class CloudKitAccountDelegate: AccountDelegate {
private let accountZone: CloudKitAccountZone private let accountZone: CloudKitAccountZone
private let articlesZone: CloudKitArticlesZone private let articlesZone: CloudKitArticlesZone
@MainActor private let mainThreadOperationQueue = MainThreadOperationQueue() private let mainThreadOperationQueue = MainThreadOperationQueue()
private lazy var refresher: LocalAccountRefresher = { private lazy var refresher: LocalAccountRefresher = {
let refresher = LocalAccountRefresher() let refresher = LocalAccountRefresher()

View File

@ -10,9 +10,9 @@ import Foundation
import os.log import os.log
import Core import Core
final class FeedMetadataFile { @MainActor final class FeedMetadataFile {
private var log = OSLog(subsystem: Bundle.main.bundleIdentifier!, category: "feedMetadataFile") private let log = OSLog(subsystem: Bundle.main.bundleIdentifier!, category: "feedMetadataFile")
private let fileURL: URL private let fileURL: URL
private let account: Account private let account: Account

View File

@ -65,7 +65,7 @@ final class FeedlyAccountDelegate: AccountDelegate {
private let database: SyncDatabase private let database: SyncDatabase
private weak var currentSyncAllOperation: MainThreadOperation? private weak var currentSyncAllOperation: MainThreadOperation?
@MainActor private let operationQueue = MainThreadOperationQueue() private let operationQueue = MainThreadOperationQueue()
init(dataFolder: String, transport: Transport?, api: FeedlyAPICaller.API, secretsProvider: SecretsProvider) { init(dataFolder: String, transport: Transport?, api: FeedlyAPICaller.API, secretsProvider: SecretsProvider) {
// Many operations have their own operation queues, such as the sync all operation. // Many operations have their own operation queues, such as the sync all operation.

View File

@ -325,7 +325,10 @@ import Sparkle
} }
func application(_ application: NSApplication, didReceiveRemoteNotification userInfo: [String : Any]) { func application(_ application: NSApplication, didReceiveRemoteNotification userInfo: [String : Any]) {
accountManager.receiveRemoteNotification(userInfo: userInfo)
Task { @MainActor in
await self.accountManager.receiveRemoteNotification(userInfo: userInfo)
}
} }
func application(_ sender: NSApplication, openFile filename: String) -> Bool { func application(_ sender: NSApplication, openFile filename: String) -> Bool {