tokenary/Encrypted Ink/AppDelegate.swift

30 lines
884 B
Swift
Raw Normal View History

2021-06-12 13:48:29 +03:00
// Copyright © 2021 Encrypted Ink. All rights reserved.
2021-06-12 13:32:27 +03:00
import Cocoa
2021-06-12 18:22:02 +03:00
@NSApplicationMain
2021-06-12 13:32:27 +03:00
class AppDelegate: NSObject, NSApplicationDelegate {
2021-06-12 18:48:23 +03:00
2021-06-13 01:35:24 +03:00
func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool {
return false
}
2021-06-12 13:32:27 +03:00
func applicationDidFinishLaunching(_ aNotification: Notification) {
2021-06-13 06:30:20 +03:00
Agent.shared.start()
2021-06-13 13:13:47 +03:00
Agent.shared.setupStatusBarItem()
2021-06-12 13:32:27 +03:00
}
2021-06-12 21:15:32 +03:00
func applicationShouldHandleReopen(_ sender: NSApplication, hasVisibleWindows flag: Bool) -> Bool {
2021-06-13 06:30:20 +03:00
Agent.shared.reopen()
2021-06-12 21:15:32 +03:00
return true
}
2021-06-15 00:08:26 +03:00
func application(_ application: NSApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([NSUserActivityRestoring]) -> Void) -> Bool {
if let url = userActivity.webpageURL?.absoluteString {
print(url)
}
return true
}
2021-06-12 18:48:23 +03:00
}