A small menubar app that allows you to switch between R versions quickly (if you have multiple versions of R framework installed).
https://rud.is/rswitch
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
61 lines
1.7 KiB
61 lines
1.7 KiB
//
|
|
// Notify.swift
|
|
// RSwitch
|
|
//
|
|
// Created by hrbrmstr on 8/24/19.
|
|
// Copyright © 2019 Bob Rudis. All rights reserved.
|
|
//
|
|
|
|
import Foundation
|
|
import Cocoa
|
|
|
|
extension AppDelegate : NSUserNotificationCenterDelegate {
|
|
|
|
|
|
func notifyUserWithDL(title: String? = nil, subtitle: String? = nil, text: String? = nil) -> Void {
|
|
|
|
let notification = NSUserNotification()
|
|
|
|
// notification.identifier = "RSwitch"
|
|
notification.title = title
|
|
notification.subtitle = subtitle
|
|
notification.informativeText = text
|
|
notification.hasActionButton = true
|
|
notification.otherButtonTitle = "Dismiss"
|
|
notification.actionButtonTitle = "Download"
|
|
|
|
notification.soundName = NSUserNotificationDefaultSoundName
|
|
|
|
NSUserNotificationCenter.default.delegate = self
|
|
NSUserNotificationCenter.default.deliver(notification)
|
|
|
|
}
|
|
|
|
|
|
func notifyUser(title: String? = nil, subtitle: String? = nil, text: String? = nil) -> Void {
|
|
|
|
let notification = NSUserNotification()
|
|
|
|
// notification.identifier = "RSwitch"
|
|
notification.title = title
|
|
notification.subtitle = subtitle
|
|
notification.informativeText = text
|
|
|
|
notification.soundName = NSUserNotificationDefaultSoundName
|
|
|
|
NSUserNotificationCenter.default.delegate = self
|
|
NSUserNotificationCenter.default.deliver(notification)
|
|
|
|
}
|
|
|
|
func userNotificationCenter(_ center: NSUserNotificationCenter, shouldPresent notification: NSUserNotification) -> Bool {
|
|
print("should present")
|
|
return(true)
|
|
}
|
|
|
|
func userNotificationCenter(_ center: NSUserNotificationCenter, didActivate notification: NSUserNotification) {
|
|
print("did activate")
|
|
print(notification)
|
|
}
|
|
|
|
}
|
|
|