1
0
mirror of https://github.com/nicoverbruggen/phpmon.git synced 2026-03-30 08:20:09 +02:00

👌 Fixed various lint issues

This commit is contained in:
2023-11-21 18:19:17 +01:00
parent 1f19b81530
commit 3b78ac43d7
10 changed files with 15 additions and 15 deletions

View File

@@ -103,6 +103,7 @@ public struct TestableConfiguration: Codable {
) )
} }
} }
// swiftlint:enable function_body_length
// MARK: Interactions // MARK: Interactions

View File

@@ -287,7 +287,7 @@ extension MainMenu {
PhpEnvironments.shared.delegate = self PhpEnvironments.shared.delegate = self
PhpEnvironments.shared.delegate?.switcherDidStartSwitching(to: version) PhpEnvironments.shared.delegate?.switcherDidStartSwitching(to: version)
updatePhpVersionInStatusBar() refreshIcon()
rebuild() rebuild()
await PhpEnvironments.switcher.performSwitch(to: version) await PhpEnvironments.switcher.performSwitch(to: version)
@@ -302,7 +302,7 @@ extension MainMenu {
PhpEnvironments.shared.delegate?.switcherDidStartSwitching(to: version) PhpEnvironments.shared.delegate?.switcherDidStartSwitching(to: version)
Task(priority: .userInitiated) { [unowned self] in Task(priority: .userInitiated) { [unowned self] in
updatePhpVersionInStatusBar() refreshIcon()
rebuild() rebuild()
await PhpEnvironments.switcher.performSwitch(to: version) await PhpEnvironments.switcher.performSwitch(to: version)
@@ -328,7 +328,7 @@ extension MainMenu {
PhpEnvironments.shared.delegate?.switcherDidStartSwitching(to: version) PhpEnvironments.shared.delegate?.switcherDidStartSwitching(to: version)
} }
updatePhpVersionInStatusBar() refreshIcon()
rebuild() rebuild()
await PhpEnvironments.switcher.performSwitch(to: version) await PhpEnvironments.switcher.performSwitch(to: version)

View File

@@ -63,7 +63,8 @@ extension MainMenu {
} }
if behaviours.contains(.updatesMenuBarContents) { if behaviours.contains(.updatesMenuBarContents) {
updatePhpVersionInStatusBar() refreshIcon()
rebuild()
} }
if behaviours.contains(.broadcastServicesUpdate) { if behaviours.contains(.broadcastServicesUpdate) {

View File

@@ -63,9 +63,6 @@ extension MainMenu {
// Check for an alias conflict // Check for an alias conflict
await BrewDiagnostics.checkForCaskConflict() await BrewDiagnostics.checkForCaskConflict()
// Update the icon
updatePhpVersionInStatusBar()
// Attempt to find out if PHP-FPM is broken // Attempt to find out if PHP-FPM is broken
PhpEnvironments.prepare() PhpEnvironments.prepare()
@@ -129,6 +126,7 @@ extension MainMenu {
PhpGuard().compareToLastGlobalVersion() PhpGuard().compareToLastGlobalVersion()
// We are ready! // We are ready!
PhpEnvironments.shared.isBusy = false
Log.info("PHP Monitor is ready to serve!") Log.info("PHP Monitor is ready to serve!")
// Check if we upgraded just now // Check if we upgraded just now

View File

@@ -27,7 +27,7 @@ extension MainMenu {
// Perform UI updates on main thread // Perform UI updates on main thread
Task { @MainActor [self] in Task { @MainActor [self] in
updatePhpVersionInStatusBar() refreshIcon()
rebuild() rebuild()
if Valet.installed && !PhpEnvironments.shared.validate(version) { if Valet.installed && !PhpEnvironments.shared.validate(version) {

View File

@@ -37,8 +37,7 @@ class MainMenu: NSObject, NSWindowDelegate, NSMenuDelegate, PhpSwitcherDelegate
// MARK: - UI related // MARK: - UI related
/** /**
Rebuilds the menu (either asynchronously or synchronously). Rebuilds the menu on the main thread.
Defaults to rebuilding the menu asynchronously.
*/ */
func rebuild() { func rebuild() {
Task { @MainActor [self] in Task { @MainActor [self] in
@@ -80,7 +79,8 @@ class MainMenu: NSObject, NSWindowDelegate, NSMenuDelegate, PhpSwitcherDelegate
@objc func refreshActiveInstallation() { @objc func refreshActiveInstallation() {
if !PhpEnvironments.shared.isBusy { if !PhpEnvironments.shared.isBusy {
PhpEnvironments.shared.currentInstall = ActivePhpInstallation.load() PhpEnvironments.shared.currentInstall = ActivePhpInstallation.load()
updatePhpVersionInStatusBar() refreshIcon()
rebuild()
} else { } else {
Log.perf("Skipping version refresh due to busy status!") Log.perf("Skipping version refresh due to busy status!")
} }

View File

@@ -56,7 +56,6 @@ class ConfigFSNotifier {
return App.shared.handlePhpConfigWatcher(forceReload: true) return App.shared.handlePhpConfigWatcher(forceReload: true)
} }
self?.parent.didChange?(self!.url) self?.parent.didChange?(self!.url)
} }

View File

@@ -8,8 +8,8 @@
import Foundation import Foundation
// swiftlint:disable function_body_length
class FakeBrewFormulaeHandler: HandlesBrewPhpFormulae { class FakeBrewFormulaeHandler: HandlesBrewPhpFormulae {
// swiftlint:disable function_body_length
public func loadPhpVersions(loadOutdated: Bool) async -> [BrewPhpFormula] { public func loadPhpVersions(loadOutdated: Bool) async -> [BrewPhpFormula] {
return [ return [
BrewPhpFormula( BrewPhpFormula(
@@ -78,3 +78,4 @@ class FakeBrewFormulaeHandler: HandlesBrewPhpFormulae {
] ]
} }
} }
// swiftlint:enable function_body_length