Check if the Micro.blog app exists on disk when app becomes active.
This commit is contained in:
parent
b83a5694dc
commit
17ce4fc26a
|
@ -8,7 +8,7 @@
|
|||
|
||||
import Foundation
|
||||
|
||||
struct SendToMarsEditCommand {
|
||||
final class SendToMarsEditCommand: SendToCommand {
|
||||
|
||||
func canSendObject(_ object: Any?) -> Bool {
|
||||
|
||||
|
|
|
@ -6,26 +6,37 @@
|
|||
// Copyright © 2018 Ranchero Software. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import Cocoa
|
||||
|
||||
// Not undoable.
|
||||
|
||||
struct SendToMicroBlogCommand: SendToCommand {
|
||||
final class SendToMicroBlogCommand: SendToCommand {
|
||||
|
||||
private let bundleID = "blog.micro.mac"
|
||||
private var appExists = false
|
||||
|
||||
init() {
|
||||
|
||||
self.appExists = appExistsOnDisk(bundleID)
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(appDidBecomeActive(_:)), name: NSApplication.didBecomeActiveNotification, object: nil)
|
||||
}
|
||||
|
||||
func canSendObject(_ object: Any?) -> Bool {
|
||||
|
||||
if !appExists {
|
||||
return false
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func sendObject(_ object: Any?) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private extension SendToMicroBlogCommand {
|
||||
@objc func appDidBecomeActive(_ note: Notification) {
|
||||
|
||||
func appExists() {
|
||||
|
||||
|
||||
self.appExists = appExistsOnDisk(bundleID)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue