Browse Source

Disable Publish menu item while publishing

master
Matt Baer 4 years ago
parent
commit
cb93c3874f
3 changed files with 8 additions and 0 deletions
  1. +3
    -0
      writeas/AppDelegate.swift
  2. +1
    -0
      writeas/Base.lproj/Main.storyboard
  3. +4
    -0
      writeas/ViewController.swift

+ 3
- 0
writeas/AppDelegate.swift View File

@@ -7,12 +7,14 @@
//

import Cocoa
import Foundation

@NSApplicationMain
class AppDelegate: NSObject, NSApplicationDelegate {

var vc: ViewController?

@IBOutlet weak var filePublishItem: NSMenuItem!
@IBOutlet weak var nightModeItem: NSMenuItem!
@IBOutlet weak var formatFontSerifItem: NSMenuItem!
@IBOutlet weak var formatFontSansItem: NSMenuItem!
@@ -85,6 +87,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
}

@IBAction func publishDoc(_ sender: Any) {
filePublishItem.isEnabled = false
vc?.publish()
}



+ 1
- 0
writeas/Base.lproj/Main.storyboard View File

@@ -368,6 +368,7 @@ DQ
</application>
<customObject id="Voe-Tx-rLC" customClass="AppDelegate" customModule="Write_as" customModuleProvider="target">
<connections>
<outlet property="filePublishItem" destination="Vdf-ed-k4A" id="TU2-UK-bgQ"/>
<outlet property="formatFontMonoItem" destination="WRG-CD-K1S" id="919-ab-Ig1"/>
<outlet property="formatFontSansItem" destination="Vjx-xi-njq" id="LIr-Ct-Ied"/>
<outlet property="formatFontSerifItem" destination="GB9-OM-e27" id="rVW-JC-eyr"/>


+ 4
- 0
writeas/ViewController.swift View File

@@ -110,6 +110,10 @@ class ViewController: NSViewController, NSTextViewDelegate, NSUserNotificationCe
notification.informativeText = "The link is copied — press ⌘+V to share it."
notification.soundName = NSUserNotificationDefaultSoundName

if let ad = NSApplication.shared().delegate as? AppDelegate {
ad.filePublishItem.isEnabled = true
}

NSUserNotificationCenter.default.deliver(notification)
}
}


Loading…
Cancel
Save