mirror of
https://github.com/nicoverbruggen/phpmon.git
synced 2025-08-06 19:40:08 +02:00
🐛 Disable Sites menu item when Standalone
This commit is contained in:
@ -554,6 +554,10 @@
|
||||
C485707B28BF458900539B36 /* VersionPopoverView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C44264BF2850BD2A007400F1 /* VersionPopoverView.swift */; };
|
||||
C485707C28BF459500539B36 /* NoWarningsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C41C708C28AA7F7900E8D498 /* NoWarningsView.swift */; };
|
||||
C485707D28BF45A200539B36 /* WarningView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C4297F7928970D59004C4630 /* WarningView.swift */; };
|
||||
C489E0BB2A220A4200323F5E /* FakeBrewFormulaeHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = C489E0BA2A220A4200323F5E /* FakeBrewFormulaeHandler.swift */; };
|
||||
C489E0BC2A220A4200323F5E /* FakeBrewFormulaeHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = C489E0BA2A220A4200323F5E /* FakeBrewFormulaeHandler.swift */; };
|
||||
C489E0BD2A220A4200323F5E /* FakeBrewFormulaeHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = C489E0BA2A220A4200323F5E /* FakeBrewFormulaeHandler.swift */; };
|
||||
C489E0BE2A220A4200323F5E /* FakeBrewFormulaeHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = C489E0BA2A220A4200323F5E /* FakeBrewFormulaeHandler.swift */; };
|
||||
C48D0C9325CC804200CC7490 /* XibLoadable.swift in Sources */ = {isa = PBXBuildFile; fileRef = C48D0C9225CC804200CC7490 /* XibLoadable.swift */; };
|
||||
C48D6C70279CD2AC00F26D7E /* VersionNumber.swift in Sources */ = {isa = PBXBuildFile; fileRef = C48D6C6F279CD2AC00F26D7E /* VersionNumber.swift */; };
|
||||
C48D6C71279CD2AC00F26D7E /* VersionNumber.swift in Sources */ = {isa = PBXBuildFile; fileRef = C48D6C6F279CD2AC00F26D7E /* VersionNumber.swift */; };
|
||||
@ -980,6 +984,7 @@
|
||||
C47DF1AE299D5A3B0007055D /* LoginItemManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginItemManager.swift; sourceTree = "<group>"; };
|
||||
C4811D2322D70A4700B5F6B3 /* App.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = App.swift; sourceTree = "<group>"; };
|
||||
C4811D2922D70F9A00B5F6B3 /* MainMenu.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainMenu.swift; sourceTree = "<group>"; };
|
||||
C489E0BA2A220A4200323F5E /* FakeBrewFormulaeHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FakeBrewFormulaeHandler.swift; sourceTree = "<group>"; };
|
||||
C48D0C9225CC804200CC7490 /* XibLoadable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = XibLoadable.swift; sourceTree = "<group>"; };
|
||||
C48D6C6F279CD2AC00F26D7E /* VersionNumber.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VersionNumber.swift; sourceTree = "<group>"; };
|
||||
C48D6C73279CD3E400F26D7E /* PhpVersionNumberTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PhpVersionNumberTest.swift; sourceTree = "<group>"; };
|
||||
@ -1405,6 +1410,7 @@
|
||||
C48DDD0C29C75C9E00D032D9 /* BlockingOverlayView.swift */,
|
||||
C40D72592A018ACC0054A067 /* PhpFormulaeStatus.swift */,
|
||||
C40D725E2A018AE30054A067 /* BrewFormulaUI.swift */,
|
||||
C489E0BA2A220A4200323F5E /* FakeBrewFormulaeHandler.swift */,
|
||||
);
|
||||
path = PhpManager;
|
||||
sourceTree = "<group>";
|
||||
@ -2282,6 +2288,7 @@
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
C489E0BB2A220A4200323F5E /* FakeBrewFormulaeHandler.swift in Sources */,
|
||||
C41ADCE82970CCC700120423 /* FSNotifier.swift in Sources */,
|
||||
C47699EF28A2F2A30060FEB8 /* WarningManager.swift in Sources */,
|
||||
C490E3BB29BCA375006D2DE6 /* Measurements.swift in Sources */,
|
||||
@ -2638,6 +2645,7 @@
|
||||
C471E7FD28F9BACE0021E251 /* HomebrewService.swift in Sources */,
|
||||
C471E7E428F9BAC20021E251 /* Helpers.swift in Sources */,
|
||||
C4CB6E67292C362C002E9027 /* Homebrew.swift in Sources */,
|
||||
C489E0BD2A220A4200323F5E /* FakeBrewFormulaeHandler.swift in Sources */,
|
||||
C45E2A77291992DA005C7CFD /* FeatureTestCase.swift in Sources */,
|
||||
C471E82028F9BB290021E251 /* NginxConfigurationFile.swift in Sources */,
|
||||
C471E7D428F9BA8F0021E251 /* ActiveFileSystem.swift in Sources */,
|
||||
@ -2687,6 +2695,7 @@
|
||||
C4B79EB929CA387F00A483EE /* BrewFormulaeHandler.swift in Sources */,
|
||||
C471E8A428F9BB8F0021E251 /* AppDelegate+Notifications.swift in Sources */,
|
||||
C490E3B329BC9FEA006D2DE6 /* ProgressWindowView.swift in Sources */,
|
||||
C489E0BE2A220A4200323F5E /* FakeBrewFormulaeHandler.swift in Sources */,
|
||||
C490E3B229BC9FE8006D2DE6 /* ProgressViewSubject.swift in Sources */,
|
||||
C471E8A528F9BB8F0021E251 /* AppDelegate+InterApp.swift in Sources */,
|
||||
C471E8A628F9BB8F0021E251 /* App.swift in Sources */,
|
||||
@ -2973,6 +2982,7 @@
|
||||
C4B97B79275CF1B5003F3378 /* App+ActivationPolicy.swift in Sources */,
|
||||
C4E2E86528FC2F1B003B070C /* XCPMApplication.swift in Sources */,
|
||||
C4E49DE828F764050026AC4E /* ActiveCommand.swift in Sources */,
|
||||
C489E0BC2A220A4200323F5E /* FakeBrewFormulaeHandler.swift in Sources */,
|
||||
C4CE3BBB27B324230086CA49 /* MainMenu+Switcher.swift in Sources */,
|
||||
C4B79ECC29CA475900A483EE /* RemovePhpVersionCommand.swift in Sources */,
|
||||
C4FD87AA29AB9ABD0002D701 /* PhpConfigChecker.swift in Sources */,
|
||||
|
@ -11,6 +11,10 @@ import UserNotifications
|
||||
@NSApplicationMain
|
||||
class AppDelegate: NSObject, NSApplicationDelegate, UNUserNotificationCenterDelegate {
|
||||
|
||||
static var instance: AppDelegate {
|
||||
return NSApplication.shared.delegate as! AppDelegate
|
||||
}
|
||||
|
||||
// MARK: - Variables
|
||||
|
||||
/**
|
||||
@ -121,4 +125,18 @@ class AppDelegate: NSObject, NSApplicationDelegate, UNUserNotificationCenterDele
|
||||
await menu.startup()
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Menu Items
|
||||
|
||||
@IBOutlet weak var menuItemSites: NSMenuItem!
|
||||
|
||||
/**
|
||||
Ensure relevant menu items in the main menu bar (not the pop-up menu)
|
||||
are disabled or hidden when needed.
|
||||
*/
|
||||
public func configureMenuItems(standalone: Bool) {
|
||||
if standalone {
|
||||
menuItemSites.isHidden = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="21507" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="21701" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
|
||||
<dependencies>
|
||||
<deployment identifier="macosx"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="21507"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="21701"/>
|
||||
<capability name="Image references" minToolsVersion="12.0"/>
|
||||
<capability name="Named colors" minToolsVersion="9.0"/>
|
||||
<capability name="Search Toolbar Item" minToolsVersion="12.0" minSystemVersion="11.0"/>
|
||||
@ -34,18 +34,6 @@
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
<menuItem title="File" id="XRy-v5-KNb">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="File" id="zA7-mh-f1x">
|
||||
<items>
|
||||
<menuItem title="Close" keyEquivalent="w" id="2FI-pQ-tuO">
|
||||
<connections>
|
||||
<action selector="performClose:" target="Ady-hI-5gd" id="ZHq-so-Sba"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
<menuItem title="Sites" id="9gy-d3-Pos">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="Sites" id="YTZ-bb-TOG">
|
||||
@ -82,12 +70,12 @@
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="Edit" id="8Pm-83-BlM">
|
||||
<items>
|
||||
<menuItem title="Undo" keyEquivalent="z" id="jCt-Yf-FSE">
|
||||
<menuItem title="Undo" enabled="NO" keyEquivalent="z" id="jCt-Yf-FSE">
|
||||
<connections>
|
||||
<action selector="undo:" target="Ady-hI-5gd" id="O3z-27-Ug0"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Redo" keyEquivalent="Z" id="fCh-1M-Qyg">
|
||||
<menuItem title="Redo" enabled="NO" keyEquivalent="Z" id="fCh-1M-Qyg">
|
||||
<connections>
|
||||
<action selector="redo:" target="Ady-hI-5gd" id="utE-Bv-fdY"/>
|
||||
</connections>
|
||||
@ -297,6 +285,18 @@
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
<menuItem title="Window" id="XRy-v5-KNb">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="Window" id="zA7-mh-f1x">
|
||||
<items>
|
||||
<menuItem title="Close" keyEquivalent="w" id="2FI-pQ-tuO">
|
||||
<connections>
|
||||
<action selector="performClose:" target="Ady-hI-5gd" id="ZHq-so-Sba"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
<menuItem title="Help" id="wpr-3q-Mcd">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="Help" systemMenu="help" id="F2S-fz-NVQ">
|
||||
@ -317,7 +317,11 @@
|
||||
</application>
|
||||
<customObject id="YLy-65-1bz" customClass="NSFontManager"/>
|
||||
<customObject id="Ady-hI-5gd" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>
|
||||
<customObject id="Voe-Tx-rLC" customClass="AppDelegate" customModule="PHP_Monitor" customModuleProvider="target"/>
|
||||
<customObject id="Voe-Tx-rLC" customClass="AppDelegate" customModule="PHP_Monitor" customModuleProvider="target">
|
||||
<connections>
|
||||
<outlet property="menuItemSites" destination="9gy-d3-Pos" id="nul-IL-YuR"/>
|
||||
</connections>
|
||||
</customObject>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="-360" y="-94"/>
|
||||
</scene>
|
||||
|
@ -88,6 +88,9 @@ extension MainMenu {
|
||||
// Load the global hotkey
|
||||
App.shared.loadGlobalHotkey()
|
||||
|
||||
// Set up menu items
|
||||
AppDelegate.instance.configureMenuItems(standalone: !Valet.installed)
|
||||
|
||||
if Valet.installed {
|
||||
// Preload all sites
|
||||
await Valet.shared.startPreloadingSites()
|
||||
|
@ -0,0 +1,58 @@
|
||||
//
|
||||
// FakeBrewFormulaeHandler.swift
|
||||
// PHP Monitor
|
||||
//
|
||||
// Created by Nico Verbruggen on 27/05/2023.
|
||||
// Copyright © 2023 Nico Verbruggen. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
class FakeBrewFormulaeHandler: HandlesBrewFormulae {
|
||||
public func loadPhpVersions(loadOutdated: Bool) async -> [BrewFormula] {
|
||||
return [
|
||||
BrewFormula(
|
||||
name: "php",
|
||||
displayName: "PHP 8.2",
|
||||
installedVersion: "8.2.3",
|
||||
upgradeVersion: "8.2.4"
|
||||
),
|
||||
BrewFormula(
|
||||
name: "php@8.1",
|
||||
displayName: "PHP 8.1",
|
||||
installedVersion: "8.1.17",
|
||||
upgradeVersion: nil
|
||||
),
|
||||
BrewFormula(
|
||||
name: "php@8.0",
|
||||
displayName: "PHP 8.0",
|
||||
installedVersion: nil,
|
||||
upgradeVersion: nil
|
||||
),
|
||||
BrewFormula(
|
||||
name: "php@7.4",
|
||||
displayName: "PHP 7.4",
|
||||
installedVersion: nil,
|
||||
upgradeVersion: nil
|
||||
),
|
||||
BrewFormula(
|
||||
name: "php@7.3",
|
||||
displayName: "PHP 7.3",
|
||||
installedVersion: nil,
|
||||
upgradeVersion: nil
|
||||
),
|
||||
BrewFormula(
|
||||
name: "php@7.2",
|
||||
displayName: "PHP 7.2",
|
||||
installedVersion: nil,
|
||||
upgradeVersion: nil
|
||||
),
|
||||
BrewFormula(
|
||||
name: "php@7.1",
|
||||
displayName: "PHP 7.1",
|
||||
installedVersion: nil,
|
||||
upgradeVersion: nil
|
||||
)
|
||||
]
|
||||
}
|
||||
}
|
@ -189,6 +189,15 @@ struct PhpFormulaeView: View {
|
||||
}
|
||||
|
||||
public func runCommand(_ command: InstallAndUpgradeCommand) async {
|
||||
if PhpEnvironments.shared.isBusy {
|
||||
self.presentErrorAlert(
|
||||
title: "phpman.busy.title".localized,
|
||||
description: "phpman.busy.desc".localized,
|
||||
button: "generic.ok".localized
|
||||
)
|
||||
return
|
||||
}
|
||||
|
||||
do {
|
||||
self.setBusyStatus(true)
|
||||
try await command.execute { progress in
|
||||
@ -349,52 +358,3 @@ struct PhpFormulaeView_Previews: PreviewProvider {
|
||||
).frame(width: 600, height: 600)
|
||||
}
|
||||
}
|
||||
|
||||
class FakeBrewFormulaeHandler: HandlesBrewFormulae {
|
||||
public func loadPhpVersions(loadOutdated: Bool) async -> [BrewFormula] {
|
||||
return [
|
||||
BrewFormula(
|
||||
name: "php",
|
||||
displayName: "PHP 8.2",
|
||||
installedVersion: "8.2.3",
|
||||
upgradeVersion: "8.2.4"
|
||||
),
|
||||
BrewFormula(
|
||||
name: "php@8.1",
|
||||
displayName: "PHP 8.1",
|
||||
installedVersion: "8.1.17",
|
||||
upgradeVersion: nil
|
||||
),
|
||||
BrewFormula(
|
||||
name: "php@8.0",
|
||||
displayName: "PHP 8.0",
|
||||
installedVersion: nil,
|
||||
upgradeVersion: nil
|
||||
),
|
||||
BrewFormula(
|
||||
name: "php@7.4",
|
||||
displayName: "PHP 7.4",
|
||||
installedVersion: nil,
|
||||
upgradeVersion: nil
|
||||
),
|
||||
BrewFormula(
|
||||
name: "php@7.3",
|
||||
displayName: "PHP 7.3",
|
||||
installedVersion: nil,
|
||||
upgradeVersion: nil
|
||||
),
|
||||
BrewFormula(
|
||||
name: "php@7.2",
|
||||
displayName: "PHP 7.2",
|
||||
installedVersion: nil,
|
||||
upgradeVersion: nil
|
||||
),
|
||||
BrewFormula(
|
||||
name: "php@7.1",
|
||||
displayName: "PHP 7.1",
|
||||
installedVersion: nil,
|
||||
upgradeVersion: nil
|
||||
)
|
||||
]
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user