mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
Make the send-to-Micro.blog command work. Need some tweaking, but it mostly does the job.
This commit is contained in:
@@ -6,16 +6,45 @@
|
||||
// Copyright © 2018 Ranchero Software. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import Cocoa
|
||||
|
||||
final class SendToMarsEditCommand: SendToCommand {
|
||||
|
||||
let title = NSLocalizedString("Send to MarsEdit", comment: "Send to command")
|
||||
|
||||
var image: NSImage? {
|
||||
return appSpecifierToUse()?.icon ?? nil
|
||||
}
|
||||
|
||||
private let marsEditApps = [ApplicationSpecifier(bundleID: "com.red-sweater.marsedit4"), ApplicationSpecifier(bundleID: "com.red-sweater.marsedit")]
|
||||
|
||||
func canSendObject(_ object: Any?, selectedText: String?) -> Bool {
|
||||
|
||||
if let _ = appSpecifierToUse() {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func sendObject(_ object: Any?, selectedText: String?) {
|
||||
|
||||
if !canSendObject(object, selectedText: selectedText) {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private extension SendToMarsEditCommand {
|
||||
|
||||
func appSpecifierToUse() -> ApplicationSpecifier? {
|
||||
|
||||
for specifier in marsEditApps {
|
||||
specifier.update()
|
||||
if specifier.existsOnDisk {
|
||||
return specifier
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user