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",
"Core",
"CloudKitExtras"
]),
],
swiftSettings: [
.enableExperimentalFeature("StrictConcurrency")
]
),
.testTarget(
name: "AccountTests",
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)
}
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)
}
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) {
delegate.refreshAll(for: self, completion: completion)
}

View File

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

View File

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

View File

@ -10,9 +10,9 @@ import Foundation
import os.log
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 account: Account

View File

@ -65,7 +65,7 @@ final class FeedlyAccountDelegate: AccountDelegate {
private let database: SyncDatabase
private weak var currentSyncAllOperation: MainThreadOperation?
@MainActor private let operationQueue = MainThreadOperationQueue()
private let operationQueue = MainThreadOperationQueue()
init(dataFolder: String, transport: Transport?, api: FeedlyAPICaller.API, secretsProvider: SecretsProvider) {
// 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]) {
accountManager.receiveRemoteNotification(userInfo: userInfo)
Task { @MainActor in
await self.accountManager.receiveRemoteNotification(userInfo: userInfo)
}
}
func application(_ sender: NSApplication, openFile filename: String) -> Bool {