From b0c75ef7ec013f30901aaeba7c0faec101fc569a Mon Sep 17 00:00:00 2001 From: Nico Verbruggen Date: Wed, 30 Jul 2025 23:35:42 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Display=20app=20driver=20is=20now?= =?UTF-8?q?=20a=20preference?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- phpmon/Domain/Menu/StatusMenu.swift | 14 ++++++++------ phpmon/Domain/Preferences/PreferenceName.swift | 4 +++- phpmon/Domain/Preferences/Preferences.swift | 1 + phpmon/Domain/Preferences/PreferencesTabs.swift | 10 ++++------ phpmon/en.lproj/Localizable.strings | 3 +++ 5 files changed, 19 insertions(+), 13 deletions(-) diff --git a/phpmon/Domain/Menu/StatusMenu.swift b/phpmon/Domain/Menu/StatusMenu.swift index 5dbe8c93..54a37f1e 100644 --- a/phpmon/Domain/Menu/StatusMenu.swift +++ b/phpmon/Domain/Menu/StatusMenu.swift @@ -66,12 +66,14 @@ class StatusMenu: NSMenu { addPreferencesMenuItems() - if Valet.installed { - // Add the menu item displaying the driver information - addValetVersionItem() - } else { - // No driver, using Standalone Mode (internally: lite mode) - addLiteModeMenuItem() + if Preferences.isEnabled(.displayDriver) { + if Valet.installed { + // Add the menu item displaying the driver information + addValetVersionItem() + } else { + // No driver, using Standalone Mode (internally: lite mode) + addLiteModeMenuItem() + } } addCoreMenuItems() diff --git a/phpmon/Domain/Preferences/PreferenceName.swift b/phpmon/Domain/Preferences/PreferenceName.swift index bdcf72fd..b18f6784 100644 --- a/phpmon/Domain/Preferences/PreferenceName.swift +++ b/phpmon/Domain/Preferences/PreferenceName.swift @@ -48,6 +48,7 @@ enum PreferenceName: String, Codable { case displayExtensions = "display_extensions" case displayPresets = "display_presets" case displayMisc = "display_misc" + case displayDriver = "display_driver" /** What type of data each preference contains. @@ -81,7 +82,8 @@ enum PreferenceName: String, Codable { .displayLimitsWidget, .displayExtensions, .displayPresets, - .displayMisc + .displayMisc, + .displayDriver ], .string: [ .globalHotkey, diff --git a/phpmon/Domain/Preferences/Preferences.swift b/phpmon/Domain/Preferences/Preferences.swift index d7b42a89..63b0707c 100644 --- a/phpmon/Domain/Preferences/Preferences.swift +++ b/phpmon/Domain/Preferences/Preferences.swift @@ -72,6 +72,7 @@ class Preferences { PreferenceName.notifyAboutGlobalComposerStatus.rawValue: true, /// Preferences: UI Preferences + PreferenceName.displayDriver.rawValue: true, PreferenceName.displayGlobalVersionSwitcher.rawValue: true, PreferenceName.displayServicesManager.rawValue: true, PreferenceName.displayValetIntegration.rawValue: true, diff --git a/phpmon/Domain/Preferences/PreferencesTabs.swift b/phpmon/Domain/Preferences/PreferencesTabs.swift index 1198e15c..4b189523 100644 --- a/phpmon/Domain/Preferences/PreferencesTabs.swift +++ b/phpmon/Domain/Preferences/PreferencesTabs.swift @@ -55,7 +55,8 @@ class MenuStructurePreferencesVC: GenericPreferenceVC { let vc = NSStoryboard(name: "Main", bundle: nil) .instantiateController(withIdentifier: "preferencesTemplateVC") as! GenericPreferenceVC - _ = vc.addView(when: true, vc.displayFeature("prefs.display_global_version_switcher", .displayGlobalVersionSwitcher, true)) + return vc + .addView(when: true, vc.displayFeature("prefs.display_global_version_switcher", .displayGlobalVersionSwitcher, true)) .addView(when: Valet.installed, vc.displayFeature("prefs.display_services_manager", .displayServicesManager)) .addView(when: Valet.installed, vc.displayFeature("prefs.display_valet_integration", .displayValetIntegration)) .addView(when: true, vc.displayFeature("prefs.display_php_config_finder", .displayPhpConfigFinder)) @@ -64,8 +65,7 @@ class MenuStructurePreferencesVC: GenericPreferenceVC { .addView(when: true, vc.displayFeature("prefs.display_extensions", .displayExtensions)) .addView(when: true, vc.displayFeature("prefs.display_presets", .displayPresets)) .addView(when: true, vc.displayFeature("prefs.display_misc", .displayMisc)) - - return vc + .addView(when: true, vc.displayFeature("prefs.display_driver", .displayDriver)) } // swiftlint:enable line_length } @@ -76,15 +76,13 @@ class NotificationPreferencesVC: GenericPreferenceVC { let vc = NSStoryboard(name: "Main", bundle: nil) .instantiateController(withIdentifier: "preferencesTemplateVC") as! GenericPreferenceVC - _ = vc.addView(when: true, vc.getNotifyAboutVersionChangePV()) + return vc.addView(when: true, vc.getNotifyAboutVersionChangePV()) .addView(when: true, vc.getNotifyAboutPresetsPV()) .addView(when: Valet.installed, vc.getNotifyAboutSecureTogglePV()) .addView(when: true, vc.getNotifyAboutGlobalComposerStatusPV()) .addView(when: true, vc.getNotifyAboutServicesPV()) .addView(when: Valet.installed, vc.getNotifyAboutPhpFpmChangePV()) .addView(when: Valet.installed, vc.getWarnAboutNonStandardTldPV()) - - return vc } } diff --git a/phpmon/en.lproj/Localizable.strings b/phpmon/en.lproj/Localizable.strings index 5ebd9f1e..e1cc68bb 100644 --- a/phpmon/en.lproj/Localizable.strings +++ b/phpmon/en.lproj/Localizable.strings @@ -467,6 +467,9 @@ This has no effect on other terminals, only for the particular terminal session "prefs.warn_about_non_standard_tld_desc" = "If you use a non-standard TLD, you may not wish to get repeated notifications about this."; "prefs.warn_about_non_standard_tld" = "Warn about non-standard TLD"; +"prefs.display_driver_desc" = "If disabled, you will not be able to see which driver is in use. If Valet is active, the version number will also no longer be visible."; +"prefs.display_driver" = "App Driver"; + "prefs.display_global_version_switcher_desc" = "If disabled, you will not be able to change the globally linked PHP version via the main menu."; "prefs.display_global_version_switcher" = "PHP Switcher";