Skip to content

Commit 8790b30

Browse files
🚀 Version 6.2.1
2 parents e6f1d7e + c42188b commit 8790b30

15 files changed

+86
-81
lines changed

PHP Monitor.xcodeproj/project.pbxproj

+12-12
Original file line numberDiff line numberDiff line change
@@ -3520,7 +3520,7 @@
35203520
CODE_SIGN_IDENTITY = "Apple Development";
35213521
CODE_SIGN_STYLE = Automatic;
35223522
COMBINE_HIDPI_IMAGES = YES;
3523-
CURRENT_PROJECT_VERSION = 1340;
3523+
CURRENT_PROJECT_VERSION = 1346;
35243524
DEAD_CODE_STRIPPING = YES;
35253525
DEBUG = YES;
35263526
DEVELOPMENT_TEAM = 8M54J5J787;
@@ -3533,7 +3533,7 @@
35333533
"@executable_path/../Frameworks",
35343534
);
35353535
MACOSX_DEPLOYMENT_TARGET = 12.4;
3536-
MARKETING_VERSION = 6.2;
3536+
MARKETING_VERSION = 6.2.1;
35373537
PRODUCT_BUNDLE_IDENTIFIER = com.nicoverbruggen.phpmon;
35383538
PRODUCT_MODULE_NAME = PHP_Monitor;
35393539
PRODUCT_NAME = "$(TARGET_NAME)";
@@ -3551,7 +3551,7 @@
35513551
CODE_SIGN_IDENTITY = "Apple Development";
35523552
CODE_SIGN_STYLE = Automatic;
35533553
COMBINE_HIDPI_IMAGES = YES;
3554-
CURRENT_PROJECT_VERSION = 1340;
3554+
CURRENT_PROJECT_VERSION = 1346;
35553555
DEAD_CODE_STRIPPING = YES;
35563556
DEBUG = NO;
35573557
DEVELOPMENT_TEAM = 8M54J5J787;
@@ -3564,7 +3564,7 @@
35643564
"@executable_path/../Frameworks",
35653565
);
35663566
MACOSX_DEPLOYMENT_TARGET = 12.4;
3567-
MARKETING_VERSION = 6.2;
3567+
MARKETING_VERSION = 6.2.1;
35683568
PRODUCT_BUNDLE_IDENTIFIER = com.nicoverbruggen.phpmon;
35693569
PRODUCT_MODULE_NAME = PHP_Monitor;
35703570
PRODUCT_NAME = "$(TARGET_NAME)";
@@ -3791,7 +3791,7 @@
37913791
CODE_SIGN_IDENTITY = "Apple Development";
37923792
CODE_SIGN_STYLE = Automatic;
37933793
COMBINE_HIDPI_IMAGES = YES;
3794-
CURRENT_PROJECT_VERSION = 1340;
3794+
CURRENT_PROJECT_VERSION = 1346;
37953795
DEAD_CODE_STRIPPING = YES;
37963796
DEBUG = NO;
37973797
DEVELOPMENT_TEAM = 8M54J5J787;
@@ -3804,7 +3804,7 @@
38043804
"@executable_path/../Frameworks",
38053805
);
38063806
MACOSX_DEPLOYMENT_TARGET = 12.4;
3807-
MARKETING_VERSION = 6.2;
3807+
MARKETING_VERSION = 6.2.1;
38083808
PRODUCT_BUNDLE_IDENTIFIER = com.nicoverbruggen.phpmon.dev;
38093809
PRODUCT_MODULE_NAME = PHP_Monitor;
38103810
PRODUCT_NAME = "$(TARGET_NAME) DEV";
@@ -3907,7 +3907,7 @@
39073907
CODE_SIGN_IDENTITY = "Apple Development";
39083908
CODE_SIGN_STYLE = Automatic;
39093909
COMBINE_HIDPI_IMAGES = YES;
3910-
CURRENT_PROJECT_VERSION = 1340;
3910+
CURRENT_PROJECT_VERSION = 1346;
39113911
DEAD_CODE_STRIPPING = YES;
39123912
DEBUG = YES;
39133913
DEVELOPMENT_TEAM = 8M54J5J787;
@@ -3920,7 +3920,7 @@
39203920
"@executable_path/../Frameworks",
39213921
);
39223922
MACOSX_DEPLOYMENT_TARGET = 12.4;
3923-
MARKETING_VERSION = 6.2;
3923+
MARKETING_VERSION = 6.2.1;
39243924
PRODUCT_BUNDLE_IDENTIFIER = com.nicoverbruggen.phpmon.dev;
39253925
PRODUCT_MODULE_NAME = PHP_Monitor;
39263926
PRODUCT_NAME = "$(TARGET_NAME) DEV";
@@ -4023,7 +4023,7 @@
40234023
CODE_SIGN_IDENTITY = "Apple Development";
40244024
CODE_SIGN_STYLE = Automatic;
40254025
COMBINE_HIDPI_IMAGES = YES;
4026-
CURRENT_PROJECT_VERSION = 1340;
4026+
CURRENT_PROJECT_VERSION = 1346;
40274027
DEAD_CODE_STRIPPING = YES;
40284028
DEBUG = YES;
40294029
DEVELOPMENT_TEAM = 8M54J5J787;
@@ -4036,7 +4036,7 @@
40364036
"@executable_path/../Frameworks",
40374037
);
40384038
MACOSX_DEPLOYMENT_TARGET = 12.4;
4039-
MARKETING_VERSION = 6.2;
4039+
MARKETING_VERSION = 6.2.1;
40404040
PRODUCT_BUNDLE_IDENTIFIER = com.nicoverbruggen.phpmon.eap;
40414041
PRODUCT_MODULE_NAME = PHP_Monitor;
40424042
PRODUCT_NAME = "$(TARGET_NAME) EAP";
@@ -4204,7 +4204,7 @@
42044204
CODE_SIGN_IDENTITY = "Apple Development";
42054205
CODE_SIGN_STYLE = Automatic;
42064206
COMBINE_HIDPI_IMAGES = YES;
4207-
CURRENT_PROJECT_VERSION = 1340;
4207+
CURRENT_PROJECT_VERSION = 1346;
42084208
DEAD_CODE_STRIPPING = YES;
42094209
DEBUG = NO;
42104210
DEVELOPMENT_TEAM = 8M54J5J787;
@@ -4217,7 +4217,7 @@
42174217
"@executable_path/../Frameworks",
42184218
);
42194219
MACOSX_DEPLOYMENT_TARGET = 12.4;
4220-
MARKETING_VERSION = 6.2;
4220+
MARKETING_VERSION = 6.2.1;
42214221
PRODUCT_BUNDLE_IDENTIFIER = com.nicoverbruggen.phpmon.eap;
42224222
PRODUCT_MODULE_NAME = PHP_Monitor;
42234223
PRODUCT_NAME = "$(TARGET_NAME) EAP";

phpmon/Common/Core/Constants.swift

+21-3
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,26 @@ struct Constants {
2020

2121
/**
2222
* The PHP versions that are considered pre-release versions.
23+
* Past a certain date, an experimental version "graduates"
24+
* to a release version and is no longer marked as experimental.
2325
*/
24-
static let ExperimentalPhpVersions: Set = [
25-
"8.3", "8.4"
26-
]
26+
static var ExperimentalPhpVersions: Set<String> {
27+
let releaseDates = [
28+
"8.4": Date.fromString("2024-12-01"), // PLACEHOLDER DATE
29+
"8.3": Date.fromString("2023-11-23") // OFFICIAL RELEASE
30+
]
31+
32+
return Set(releaseDates
33+
.filter { (_: String, date: Date?) in
34+
guard let date else {
35+
return false
36+
}
37+
38+
return date > Date.now
39+
}.map { (version: String, _: Date?) in
40+
return version
41+
})
42+
}
2743

2844
/**
2945
* The PHP versions supported by this application.
@@ -91,6 +107,8 @@ struct Constants {
91107
string: "https://raw.githubusercontent.com/nicoverbruggen/homebrew-cask/master/Casks/phpmon-dev.rb"
92108
)!
93109

110+
// EAP URLs
111+
94112
static let EarlyAccessCaskFile = URL(
95113
string: "https://phpmon.app/builds/early-access/sponsors/phpmon-eap.rb"
96114
)!

phpmon/Common/Extensions/DateExtension.swift

+6
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,10 @@ extension Date {
1515
return dateFormatter.string(from: self)
1616
}
1717

18+
static func fromString(_ string: String) -> Date? {
19+
let dateFormatter = DateFormatter()
20+
dateFormatter.dateFormat = "yyyy-MM-dd"
21+
return dateFormatter.date(from: string)
22+
}
23+
1824
}

phpmon/Common/PHP/PHP Version/PhpEnvironments.swift

+4-6
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class PhpEnvironments {
1313
// MARK: - Initializer
1414

1515
/**
16-
16+
Loads the currently active PHP installation upon startup. May be empty.
1717
*/
1818
init() {
1919
self.currentInstall = ActivePhpInstallation.load()
@@ -49,12 +49,10 @@ class PhpEnvironments {
4949
static let shared = PhpEnvironments()
5050

5151
/** Whether the switcher is busy performing any actions. */
52-
var isBusy: Bool = false {
52+
@MainActor var isBusy: Bool = false {
5353
didSet {
54-
Task { @MainActor in
55-
MainMenu.shared.setBusyImage()
56-
MainMenu.shared.rebuild()
57-
}
54+
MainMenu.shared.refreshIcon()
55+
MainMenu.shared.rebuild()
5856
}
5957
}
6058

phpmon/Common/PHP/PhpExtension.swift

+4-4
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ class PhpExtension {
6767

6868
self.name = String(fullPath.split(separator: "/").last!) // take last segment
6969

70-
self.enabled = !line.contains(";")
70+
self.enabled = !line.starts(with: ";")
7171
self.file = file
7272
}
7373

@@ -76,22 +76,22 @@ class PhpExtension {
7676
You may need to restart the other services in order for this change to apply.
7777
*/
7878
func toggle() async {
79-
let newLine = enabled
79+
let newLine = !line.starts(with: ";")
8080
// DISABLED: Commented out line
8181
? "; \(line)"
8282
// ENABLED: Line where the comment delimiter (;) is removed
8383
: line.replacingOccurrences(of: "; ", with: "")
8484

8585
await sed(file: file, original: line, replacement: newLine)
8686

87-
enabled.toggle()
87+
self.enabled = !newLine.starts(with: ";")
88+
self.line = newLine
8889

8990
if !isRunningTests {
9091
Task { @MainActor in
9192
MainMenu.shared.rebuild()
9293
}
9394
}
94-
9595
}
9696

9797
// MARK: - Static Methods

phpmon/Domain/Integrations/Composer/ComposerWindow.swift

+1-6
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ import Foundation
2828
}
2929

3030
PhpEnvironments.shared.isBusy = true
31-
MainMenu.shared.setBusyImage()
32-
MainMenu.shared.rebuild()
3331

3432
window = TerminalProgressWindowController.display(
3533
title: "alert.composer_progress.title".localized,
@@ -106,14 +104,11 @@ import Foundation
106104

107105
private func removeBusyStatus() {
108106
PhpEnvironments.shared.isBusy = false
109-
Task { @MainActor in
110-
MainMenu.shared.updatePhpVersionInStatusBar()
111-
}
112107
}
113108

114109
// MARK: Alert
115110

116-
@MainActor private func presentMissingAlert() {
111+
private func presentMissingAlert() {
117112
BetterAlert()
118113
.withInformation(
119114
title: "alert.composer_missing.title".localized,

phpmon/Domain/Integrations/Homebrew/Brew.swift

+2-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ class Brew {
4545

4646
/// Each formula for each PHP version that can be installed.
4747
public static let phpVersionFormulae = [
48-
"8.3": "shivammathur/php/php@8.3",
48+
"8.4": "shivammathur/php/php@8.4",
49+
"8.3": "shivammathur/php/php@8.3", // TODO: when php@8.3 lands in stable, update this
4950
"8.2": "php@8.2",
5051
"8.1": "php@8.1",
5152
"8.0": "php@8.0",

phpmon/Domain/Menu/MainMenu+Actions.swift

-3
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,6 @@ extension MainMenu {
283283
return
284284
}
285285

286-
setBusyImage()
287286
PhpEnvironments.shared.isBusy = true
288287
PhpEnvironments.shared.delegate = self
289288
PhpEnvironments.shared.delegate?.switcherDidStartSwitching(to: version)
@@ -298,7 +297,6 @@ extension MainMenu {
298297
}
299298

300299
@objc func switchToPhpVersion(_ version: String) {
301-
setBusyImage()
302300
PhpEnvironments.shared.isBusy = true
303301
PhpEnvironments.shared.delegate = self
304302
PhpEnvironments.shared.delegate?.switcherDidStartSwitching(to: version)
@@ -325,7 +323,6 @@ extension MainMenu {
325323
*/
326324
func switchToPhp(_ version: String) async {
327325
Task { @MainActor [self] in
328-
setBusyImage()
329326
PhpEnvironments.shared.isBusy = true
330327
PhpEnvironments.shared.delegate = self
331328
PhpEnvironments.shared.delegate?.switcherDidStartSwitching(to: version)

phpmon/Domain/Menu/MainMenu+Async.swift

+8-11
Original file line numberDiff line numberDiff line change
@@ -45,21 +45,16 @@ extension MainMenu {
4545
.broadcastServicesUpdate
4646
]
4747
) {
48-
if behaviours.contains(.reloadsPhpInstallation) {
48+
if behaviours.contains(.reloadsPhpInstallation) || behaviours.contains(.setsBusyUI) {
4949
PhpEnvironments.shared.isBusy = true
5050
}
5151

52-
if behaviours.contains(.setsBusyUI) {
53-
setBusyImage()
54-
}
55-
5652
Task(priority: .userInitiated) { [unowned self] in
5753
var error: Error?
5854

59-
do { try execute() } catch let e { error = e }
60-
61-
if behaviours.contains(.setsBusyUI) {
62-
PhpEnvironments.shared.isBusy = false
55+
do { try execute() } catch let e {
56+
error = e
57+
Log.err(e)
6358
}
6459

6560
Task { @MainActor [self, error] in
@@ -69,14 +64,16 @@ extension MainMenu {
6964

7065
if behaviours.contains(.updatesMenuBarContents) {
7166
updatePhpVersionInStatusBar()
72-
} else if behaviours.contains(.setsBusyUI) {
73-
refreshIcon()
7467
}
7568

7669
if behaviours.contains(.broadcastServicesUpdate) {
7770
Task { await ServicesManager.shared.reloadServicesStatus() }
7871
}
7972

73+
if behaviours.contains(.setsBusyUI) {
74+
PhpEnvironments.shared.isBusy = false
75+
}
76+
8077
if error != nil {
8178
return failure(error!)
8279
}

phpmon/Domain/Menu/MainMenu+Startup.swift

+3
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,9 @@ extension MainMenu {
105105
Valet.shared.notifyAboutUnsupportedTLD()
106106
}
107107

108+
// Keep track of which PHP versions are currently about to release
109+
Log.info("Experimental PHP versions: \(Constants.ExperimentalPhpVersions)")
110+
108111
// Find out which services are active
109112
Log.info("The services manager knows about \(ServicesManager.shared.services.count) services.")
110113

phpmon/Domain/Menu/MainMenu+Switcher.swift

+3-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ extension MainMenu {
1616

1717
nonisolated func switcherDidCompleteSwitch(to version: String) {
1818
// Mark as no longer busy
19-
PhpEnvironments.shared.isBusy = false
19+
Task { @MainActor in
20+
PhpEnvironments.shared.isBusy = false
21+
}
2022

2123
Task { // Things to do after reloading domain list data
2224
if Valet.installed {

phpmon/Domain/Menu/MainMenu.swift

+5-8
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ class MainMenu: NSObject, NSWindowDelegate, NSMenuDelegate, PhpSwitcherDelegate
8787
}
8888

8989
/** Updates the icon (refresh icon) and rebuilds the menu. */
90+
@available(*, deprecated, message: "Use the busy status instead")
9091
@objc func updatePhpVersionInStatusBar() {
9192
refreshIcon()
9293
rebuild()
@@ -139,7 +140,7 @@ class MainMenu: NSObject, NSWindowDelegate, NSMenuDelegate, PhpSwitcherDelegate
139140
@objc func reloadPhpMonitorMenuInBackground() {
140141
asyncExecution({
141142
// This automatically reloads the menu
142-
Log.info("Reloading information about the PHP installation (in the background)...")
143+
Log.perf("Reloading information about the PHP installation (in the background)...")
143144
}, behaviours: [
144145
.setsBusyUI,
145146
.reloadsPhpInstallation,
@@ -150,10 +151,13 @@ class MainMenu: NSObject, NSWindowDelegate, NSMenuDelegate, PhpSwitcherDelegate
150151

151152
/** Refreshes the icon with the PHP version. */
152153
@objc func refreshIcon() {
154+
153155
Task { @MainActor [self] in
154156
if PhpEnvironments.shared.isBusy {
157+
Log.perf("Refreshing icon: currently busy")
155158
setStatusBar(image: NSImage(named: NSImage.Name("StatusBarIcon"))!)
156159
} else {
160+
Log.perf("Refreshing icon: no longer busy")
157161
if Preferences.preferences[.shouldDisplayDynamicIcon] as! Bool == false {
158162
// Static icon has been requested
159163
setStatusBar(image: NSImage(named: NSImage.Name("StatusBarIconStatic"))!)
@@ -172,13 +176,6 @@ class MainMenu: NSObject, NSWindowDelegate, NSMenuDelegate, PhpSwitcherDelegate
172176
}
173177
}
174178

175-
/** Updates the icon to be displayed as busy. */
176-
@objc func setBusyImage() {
177-
Task { @MainActor [self] in
178-
setStatusBar(image: NSImage(named: NSImage.Name("StatusBarIcon"))!)
179-
}
180-
}
181-
182179
// MARK: - Menu Item Functionality
183180

184181
@objc func openAbout() {

0 commit comments

Comments
 (0)