mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
Fix a few concurrency warnings.
This commit is contained in:
@@ -12,7 +12,7 @@ import AppKit
|
||||
///
|
||||
/// The app may or may not be running. It may or may not exist.
|
||||
|
||||
public final class UserApp {
|
||||
@MainActor public final class UserApp {
|
||||
|
||||
public let bundleID: String
|
||||
public var icon: NSImage? = nil
|
||||
|
||||
@@ -37,7 +37,7 @@ public protocol SendToCommand {
|
||||
/// - object: The object to test.
|
||||
/// - selectedText: The currently selected text.
|
||||
/// - Returns: `true` if the object can be sent, `false` otherwise.
|
||||
func canSendObject(_ object: Any?, selectedText: String?) -> Bool
|
||||
@MainActor func canSendObject(_ object: Any?, selectedText: String?) -> Bool
|
||||
|
||||
/// Send an object to the target application.
|
||||
///
|
||||
|
||||
@@ -18,15 +18,18 @@ import Core
|
||||
}
|
||||
|
||||
func sharingServicePicker(_ sharingServicePicker: NSSharingServicePicker, sharingServicesForItems items: [Any], proposedSharingServices proposedServices: [NSSharingService]) -> [NSSharingService] {
|
||||
let filteredServices = proposedServices.filter { $0.menuItemTitle != "NetNewsWire" }
|
||||
return filteredServices + SharingServicePickerDelegate.customSharingServices(for: items)
|
||||
|
||||
MainActor.assumeIsolated {
|
||||
let filteredServices = proposedServices.filter { $0.menuItemTitle != "NetNewsWire" }
|
||||
return filteredServices + SharingServicePickerDelegate.customSharingServices(for: items)
|
||||
}
|
||||
}
|
||||
|
||||
func sharingServicePicker(_ sharingServicePicker: NSSharingServicePicker, delegateFor sharingService: NSSharingService) -> NSSharingServiceDelegate? {
|
||||
return sharingServiceDelegate
|
||||
}
|
||||
|
||||
static func customSharingServices(for items: [Any]) -> [NSSharingService] {
|
||||
@MainActor static func customSharingServices(for items: [Any]) -> [NSSharingService] {
|
||||
let customServices: [SendToCommand] = [SendToMarsEditCommand(), SendToMicroBlogCommand()]
|
||||
|
||||
return customServices.compactMap { (sendToCommand) -> NSSharingService? in
|
||||
|
||||
@@ -11,7 +11,7 @@ import Articles
|
||||
import Core
|
||||
import AppKitExtras
|
||||
|
||||
final class SendToMarsEditCommand: SendToCommand {
|
||||
@MainActor final class SendToMarsEditCommand: SendToCommand {
|
||||
|
||||
let title = "MarsEdit"
|
||||
let image: RSImage? = AppAssets.marsEditIcon
|
||||
@@ -44,9 +44,9 @@ final class SendToMarsEditCommand: SendToCommand {
|
||||
}
|
||||
}
|
||||
|
||||
private extension SendToMarsEditCommand {
|
||||
@MainActor private extension SendToMarsEditCommand {
|
||||
|
||||
@MainActor func send(_ article: Article, to app: UserApp) {
|
||||
func send(_ article: Article, to app: UserApp) {
|
||||
|
||||
// App has already been launched.
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ import AppKitExtras
|
||||
|
||||
// Not undoable.
|
||||
|
||||
final class SendToMicroBlogCommand: SendToCommand {
|
||||
@MainActor final class SendToMicroBlogCommand: SendToCommand {
|
||||
|
||||
let title = "Micro.blog"
|
||||
let image: RSImage? = AppAssets.microblogIcon
|
||||
@@ -30,7 +30,7 @@ final class SendToMicroBlogCommand: SendToCommand {
|
||||
return true
|
||||
}
|
||||
|
||||
@MainActor func sendObject(_ object: Any?, selectedText: String?) {
|
||||
func sendObject(_ object: Any?, selectedText: String?) {
|
||||
|
||||
guard canSendObject(object, selectedText: selectedText) else {
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user