Skip to content

Commit

Permalink
In some situation, use toast instead of system user notifications.
Browse files Browse the repository at this point in the history
  • Loading branch information
qiuyuzhou committed Mar 20, 2017
1 parent 129c4d7 commit 63afe0a
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions ShadowsocksX-NG/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -262,12 +262,9 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDele
} else {
errMsg = "No current server profile.".localized
}
let userNote = NSUserNotification()
userNote.title = errMsg
userNote.soundName = NSUserNotificationDefaultSoundName

NSUserNotificationCenter.default
.deliver(userNote);
if let msg = errMsg {
self.makeToast(msg)
}
}

@IBAction func scanQRCodeFromScreen(_ sender: NSMenuItem) {
Expand Down Expand Up @@ -358,11 +355,8 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDele
NSPasteboard.general().clearContents()
NSPasteboard.general().setString(command, forType: NSStringPboardType)

// Give a system notification.
let notification = NSUserNotification()
notification.title = "Export Command Copied.".localized
NSUserNotificationCenter.default
.deliver(notification)
// Show a toast notification.
self.makeToast("Export Command Copied.".localized)
}

@IBAction func showLogs(_ sender: NSMenuItem) {
Expand Down

0 comments on commit 63afe0a

Please sign in to comment.