mirror of
https://github.com/ZeroTier/ZeroTierOne
synced 2025-08-14 02:27:38 -07:00
setup launch at login on first start
This commit is contained in:
parent
583cd25506
commit
b0971e3a01
5 changed files with 185 additions and 0 deletions
|
@ -28,6 +28,27 @@ class AppDelegate: NSObject, NSApplicationDelegate {
|
|||
var networks = [Network]()
|
||||
|
||||
func applicationDidFinishLaunching(aNotification: NSNotification) {
|
||||
|
||||
let defaults = NSUserDefaults.standardUserDefaults()
|
||||
let defaultsDict = ["firstRun": true]
|
||||
defaults.registerDefaults(defaultsDict)
|
||||
|
||||
|
||||
if defaults.boolForKey("firstRun") {
|
||||
defaults.setBool(false, forKey: "firstRun")
|
||||
defaults.synchronize()
|
||||
|
||||
let loginController = LaunchAtLoginController()
|
||||
|
||||
let bundle = NSBundle.mainBundle()
|
||||
let bundleURL = bundle.bundleURL
|
||||
|
||||
loginController.setLaunchAtLogin(true, forURL: bundleURL)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
let nc = NSNotificationCenter.defaultCenter()
|
||||
nc.addObserver(self, selector: #selector(onNetworkListUpdated(_:)), name: networkUpdateKey, object: nil)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue