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

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

@ -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)
}

@ -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()
activeAccounts.forEach { account in
group.enter()
account.receiveRemoteNotification(userInfo: userInfo) {
group.leave()
}
}
group.notify(queue: DispatchQueue.main) {
completion?()
public func receiveRemoteNotification(userInfo: [AnyHashable : Any]) async {
for account in activeAccounts {
await account.receiveRemoteNotification(userInfo: userInfo)
}
}

@ -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()

@ -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

@ -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.

@ -325,9 +325,12 @@ 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 {
guard filename.hasSuffix(ArticleTheme.nnwThemeSuffix) else { return false }
importTheme(filename: filename)