mirror of
https://github.com/nicoverbruggen/phpmon.git
synced 2025-08-07 20:10:08 +02:00
✨ Allow switching PHP versions via callback
This commit is contained in:
@ -1215,7 +1215,7 @@
|
||||
"@executable_path/../Frameworks",
|
||||
);
|
||||
MACOSX_DEPLOYMENT_TARGET = 11.0;
|
||||
MARKETING_VERSION = "5.0-b2";
|
||||
MARKETING_VERSION = "5.0-b3";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.nicoverbruggen.phpmon.beta;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
@ -1240,7 +1240,7 @@
|
||||
"@executable_path/../Frameworks",
|
||||
);
|
||||
MACOSX_DEPLOYMENT_TARGET = 11.0;
|
||||
MARKETING_VERSION = "5.0-b2";
|
||||
MARKETING_VERSION = "5.0-b3";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.nicoverbruggen.phpmon.beta;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
|
@ -23,14 +23,39 @@ extension AppDelegate {
|
||||
func application(_ application: NSApplication, open urls: [URL]) {
|
||||
// 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
|
||||
self.interpretCommand(
|
||||
url.absoluteString.replacingOccurrences(of: "phpmon://", with: "")
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
private func interpretCommand(_ command: String) {
|
||||
switch (command) {
|
||||
case "list":
|
||||
SiteListVC.show()
|
||||
break
|
||||
default:
|
||||
break
|
||||
}
|
||||
|
||||
if command.starts(with: "callback/switch") {
|
||||
// TODO: Send XML for suggestions?
|
||||
// I looked at the output of Dash (which is my example of an amazing app here)
|
||||
// and it works like this: open -g "dash-workflow-callback://{query}"
|
||||
// which returns XML. I'm not sure how to do that here, but if I could
|
||||
// dynamically return a list of valid PHP versions, it'd be easy mode.
|
||||
}
|
||||
|
||||
if command.starts(with: "switch/php/") {
|
||||
// See if the PHP version we're attempting to switch to is valid
|
||||
let version = String(command.split(separator: "/").last!)
|
||||
if PhpEnv.shared.availablePhpVersions.contains(version) {
|
||||
MainMenu.shared.switchToPhpVersion(version)
|
||||
} else {
|
||||
Alert.notify(
|
||||
message: "Unsupported version",
|
||||
info: "PHP Monitor can't switch to PHP \(version), as it may not be installed or available."
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user