Move array of sendToCommands from AppDelegate to SharingServicePickerDelegate, where it belongs, since it’s the only place where it’s used.

This commit is contained in:
Brent Simmons 2018-12-27 21:49:18 -08:00
parent 94da6fc7de
commit 9a1ccc4296
2 changed files with 5 additions and 5 deletions

View File

@ -31,10 +31,6 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserInterfaceValidations,
@IBOutlet var sortByNewestArticleOnTopMenuItem: NSMenuItem! @IBOutlet var sortByNewestArticleOnTopMenuItem: NSMenuItem!
@IBOutlet var checkForUpdatesMenuItem: NSMenuItem! @IBOutlet var checkForUpdatesMenuItem: NSMenuItem!
lazy var sendToCommands: [SendToCommand] = {
return [SendToMicroBlogCommand(), SendToMarsEditCommand()]
}()
var unreadCount = 0 { var unreadCount = 0 {
didSet { didSet {
if unreadCount != oldValue { if unreadCount != oldValue {

View File

@ -26,9 +26,13 @@ import AppKit
return sharingServiceDelegate return sharingServiceDelegate
} }
private static let sendToCommands: [SendToCommand] = {
return [SendToMicroBlogCommand(), SendToMarsEditCommand()]
}()
static func customSharingServices(for items: [Any]) -> [NSSharingService] { static func customSharingServices(for items: [Any]) -> [NSSharingService] {
let customServices = appDelegate.sendToCommands.compactMap { (sendToCommand) -> NSSharingService? in let customServices = sendToCommands.compactMap { (sendToCommand) -> NSSharingService? in
guard let object = items.first else { guard let object = items.first else {
return nil return nil