Kaynağa Gözat

Show error notification if publishing fails

master
Matt Baer 6 yıl önce
ebeveyn
işleme
6ab534d0f3
1 değiştirilmiş dosya ile 13 ekleme ve 7 silme
  1. +13
    -7
      writeas/ViewController.swift

+ 13
- 7
writeas/ViewController.swift Dosyayı Görüntüle

@@ -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)
}
}


Yükleniyor…
İptal
Kaydet