Mac OS X NSUserNotificationCenter notification get dismiss event/callback

前端 未结 4 1415
猫巷女王i
猫巷女王i 2020-12-31 06:39

In our app we are displaying Notification Center notifications in alert style.

Displaying notification works fine, as well as we get callback when user interacts wit

4条回答
  •  失恋的感觉
    2020-12-31 06:59

    This helped me out

    func userNotificationCenter(_ center: NSUserNotificationCenter, didActivate notification: NSUserNotification) {
        switch (notification.activationType) {
        case .none:
            print("none CLicked")
            break
        case .actionButtonClicked:
            print("Additional Action Clicked")
            break
        case .contentsClicked:
            print("contents CLicked")
            break
        case .replied:
            print("replied Action Clicked")
            break
        case .additionalActionClicked:
            print("Additional  MENU  Action Clicked")
            break
        }
    

提交回复
热议问题