Skip to content

Commit

Permalink
Alert self close times adjusted
Browse files Browse the repository at this point in the history
Signed-off-by: Austin Kootz <[email protected]>
  • Loading branch information
Austin Kootz committed Apr 20, 2018
1 parent 48f7622 commit c80e195
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
Binary file not shown.
13 changes: 5 additions & 8 deletions EjectionSeat/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSMenuDelegate, NSUserNotifi
var lastVolume: String = ""
let version: String = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as! String

func delay(_ seconds: Double, codeBlock: @escaping () -> Void){
DispatchQueue.main.asyncAfter(deadline: .now() + .seconds(3), execute: codeBlock)
func delay(_ seconds: Int, block: @escaping () -> Void){
DispatchQueue.main.asyncAfter(deadline: .now() + .seconds(seconds), execute: block)
}

func applicationDidFinishLaunching(_ aNotification: Notification) {
Expand Down Expand Up @@ -172,12 +172,9 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSMenuDelegate, NSUserNotifi
}

func userNotificationCenter(_ center: NSUserNotificationCenter, didDeliver notification: NSUserNotification) {
if !notification.hasActionButton {
delay(3) {
print(notification)
NSUserNotificationCenter.default.removeDeliveredNotification(notification)
}
}
notification.hasActionButton ?
delay(60){NSUserNotificationCenter.default.removeDeliveredNotification(notification)} :
delay(3){NSUserNotificationCenter.default.removeDeliveredNotification(notification)}
}

func userNotificationCenter(_ center: NSUserNotificationCenter, didActivate notification: NSUserNotification) {
Expand Down

0 comments on commit c80e195

Please sign in to comment.