Explorar el Código

Show error notification if publishing fails

master
Matt Baer hace 6 años
padre
commit
6ab534d0f3
Se han modificado 1 ficheros con 13 adiciones y 7 borrados
  1. +13
    -7
      writeas/ViewController.swift

+ 13
- 7
writeas/ViewController.swift Ver fichero

@@ -102,17 +102,23 @@ class ViewController: NSViewController, NSTextViewDelegate, NSUserNotificationCe
task.waitUntilExit()

DispatchQueue.main.async {
var notification = NSUserNotification()

// All these values are optional
notification.title = "Published!"
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
}

var notification = NSUserNotification()

if task.terminationStatus == 0 {
// Successfully published
notification.title = "Published!"
notification.informativeText = "The link is copied — press ⌘+V to share it."
} else {
// Something went wrong
notification.title = "Unable to publish."
notification.informativeText = "There was a problem publishing. Please check your internet and try again."
}
notification.soundName = NSUserNotificationDefaultSoundName

NSUserNotificationCenter.default.deliver(notification)
}
}


Cargando…
Cancelar
Guardar