diff --git a/phpmon/Domain/Core/AppDelegate+InterApp.swift b/phpmon/Domain/Core/AppDelegate+InterApp.swift index 46a45ee..dd6e34f 100644 --- a/phpmon/Domain/Core/AppDelegate+InterApp.swift +++ b/phpmon/Domain/Core/AppDelegate+InterApp.swift @@ -11,8 +11,28 @@ import Foundation extension AppDelegate { + /** + This is an entry point for future development for integrating with the PHP Monitor + application URL. You can use the `phpmon://` protocol to communicate with the app. + + At this time you can trigger the site list using Alfred (or some other application) + by opening the following URL: `phpmon://list`. + + Please note that PHP Monitor needs to be running in the background for this to work. + */ func application(_ application: NSApplication, open urls: [URL]) { - print(urls) + // Only ever interpret the first URL + if let url = urls.first { + let command = url.absoluteString.replacingOccurrences(of: "phpmon://", with: "") + + switch (command) { + case "list": + SiteListVC.show() + break + default: + break + } + } } } diff --git a/phpmon/Domain/Core/AppDelegate+Notifications.swift b/phpmon/Domain/Core/AppDelegate+Notifications.swift index f848b57..6337381 100644 --- a/phpmon/Domain/Core/AppDelegate+Notifications.swift +++ b/phpmon/Domain/Core/AppDelegate+Notifications.swift @@ -13,6 +13,10 @@ extension AppDelegate { // MARK: - Notifications + /** + Sets up notifications. That does mean we need to ask for permission first. + If we cannot get permission, we should log this. + */ public func setupNotifications() { let notificationCenter = UNUserNotificationCenter.current() notificationCenter.delegate = self