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

@ -2,15 +2,15 @@
import PackageDescription import PackageDescription
let package = Package( let package = Package(
name: "Account", name: "Account",
platforms: [.macOS(.v14), .iOS(.v17)], platforms: [.macOS(.v14), .iOS(.v17)],
products: [ products: [
.library( .library(
name: "Account", name: "Account",
type: .dynamic, type: .dynamic,
targets: ["Account"]), targets: ["Account"]),
], ],
dependencies: [ dependencies: [
.package(url: "https://github.com/Ranchero-Software/RSParser.git", .upToNextMajor(from: "2.0.2")), .package(url: "https://github.com/Ranchero-Software/RSParser.git", .upToNextMajor(from: "2.0.2")),
.package(url: "https://github.com/Ranchero-Software/RSWeb.git", .upToNextMajor(from: "1.0.0")), .package(url: "https://github.com/Ranchero-Software/RSWeb.git", .upToNextMajor(from: "1.0.0")),
.package(path: "../Articles"), .package(path: "../Articles"),
@ -21,10 +21,10 @@ let package = Package(
.package(path: "../Core"), .package(path: "../Core"),
.package(path: "../CloudKitExtras") .package(path: "../CloudKitExtras")
], ],
targets: [ targets: [
.target( .target(
name: "Account", name: "Account",
dependencies: [ dependencies: [
"RSParser", "RSParser",
"RSWeb", "RSWeb",
"Articles", "Articles",
@ -34,12 +34,16 @@ let package = Package(
"Database", "Database",
"Core", "Core",
"CloudKitExtras" "CloudKitExtras"
]), ],
.testTarget( swiftSettings: [
name: "AccountTests", .enableExperimentalFeature("StrictConcurrency")
dependencies: ["Account"], ]
),
.testTarget(
name: "AccountTests",
dependencies: ["Account"],
resources: [ resources: [
.copy("JSON"), .copy("JSON"),
]), ]),
] ]
) )

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 {