mirror of
https://github.com/nicoverbruggen/phpmon.git
synced 2026-04-06 03:00:07 +02:00
👌 Various fixes
- Fixed issue with Version Manager - Separate behaviour for previews for Version Manager - Remove verbose logging when previews are in use (Note: The latter change may break various other previews. Will need to investigate this particular issue.)
This commit is contained in:
@@ -31,7 +31,10 @@ public class Paths {
|
|||||||
}
|
}
|
||||||
|
|
||||||
userName = identity()
|
userName = identity()
|
||||||
Log.info("The current username is `\(userName)`.")
|
|
||||||
|
if !isRunningSwiftUIPreview {
|
||||||
|
Log.info("The current username is `\(userName)`.")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public func detectBinaryPaths() {
|
public func detectBinaryPaths() {
|
||||||
|
|||||||
@@ -88,10 +88,12 @@ class AppDelegate: NSObject, NSApplicationDelegate, UNUserNotificationCenterDele
|
|||||||
Log.info("Extra CLI mode is on (`~/.config/phpmon/verbose` exists).")
|
Log.info("Extra CLI mode is on (`~/.config/phpmon/verbose` exists).")
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.separator(as: .info)
|
if !isRunningSwiftUIPreview {
|
||||||
Log.info("PHP MONITOR by Nico Verbruggen")
|
Log.separator(as: .info)
|
||||||
Log.info("Version \(App.version)")
|
Log.info("PHP MONITOR by Nico Verbruggen")
|
||||||
Log.separator(as: .info)
|
Log.info("Version \(App.version)")
|
||||||
|
Log.separator(as: .info)
|
||||||
|
}
|
||||||
|
|
||||||
self.state = App.shared
|
self.state = App.shared
|
||||||
self.menu = MainMenu.shared
|
self.menu = MainMenu.shared
|
||||||
@@ -118,6 +120,11 @@ class AppDelegate: NSObject, NSApplicationDelegate, UNUserNotificationCenterDele
|
|||||||
startup procedure.
|
startup procedure.
|
||||||
*/
|
*/
|
||||||
func applicationDidFinishLaunching(_ aNotification: Notification) {
|
func applicationDidFinishLaunching(_ aNotification: Notification) {
|
||||||
|
// Prevent previews from kicking off a costly boot
|
||||||
|
if isRunningSwiftUIPreview {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// Make sure notifications will work
|
// Make sure notifications will work
|
||||||
setupNotifications()
|
setupNotifications()
|
||||||
|
|
||||||
|
|||||||
@@ -9,10 +9,18 @@
|
|||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
class FakeBrewFormulaeHandler: HandlesBrewFormulae {
|
class FakeBrewFormulaeHandler: HandlesBrewFormulae {
|
||||||
|
// swiftlint:disable function_body_length
|
||||||
public func loadPhpVersions(loadOutdated: Bool) async -> [BrewFormula] {
|
public func loadPhpVersions(loadOutdated: Bool) async -> [BrewFormula] {
|
||||||
return [
|
return [
|
||||||
BrewFormula(
|
BrewFormula(
|
||||||
name: "php",
|
name: "php@9.9",
|
||||||
|
displayName: "PHP 9.9",
|
||||||
|
installedVersion: nil,
|
||||||
|
upgradeVersion: "9.9.0",
|
||||||
|
prerelease: true
|
||||||
|
),
|
||||||
|
BrewFormula(
|
||||||
|
name: "php@8.3",
|
||||||
displayName: "PHP 8.3",
|
displayName: "PHP 8.3",
|
||||||
installedVersion: nil,
|
installedVersion: nil,
|
||||||
upgradeVersion: "8.3.0",
|
upgradeVersion: "8.3.0",
|
||||||
|
|||||||
@@ -28,8 +28,15 @@ struct PhpVersionManagerView: View {
|
|||||||
description: "phpman.busy.description.outdated".localized
|
description: "phpman.busy.description.outdated".localized
|
||||||
)
|
)
|
||||||
|
|
||||||
Task { [self] in
|
if handler is FakeBrewFormulaeHandler {
|
||||||
await self.initialLoad()
|
Task { [self] in
|
||||||
|
await self.handler.refreshPhpVersions(loadOutdated: false)
|
||||||
|
self.status.busy = false
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Task { [self] in
|
||||||
|
await self.initialLoad()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -127,7 +134,7 @@ struct PhpVersionManagerView: View {
|
|||||||
|
|
||||||
BlockingOverlayView(busy: self.status.busy, title: self.status.title, text: self.status.description) {
|
BlockingOverlayView(busy: self.status.busy, title: self.status.title, text: self.status.description) {
|
||||||
List(Array(formulae.phpVersions.enumerated()), id: \.1.name) { (index, formula) in
|
List(Array(formulae.phpVersions.enumerated()), id: \.1.name) { (index, formula) in
|
||||||
HStack {
|
HStack(alignment: .center, spacing: 7.0) {
|
||||||
Image(systemName: formula.icon)
|
Image(systemName: formula.icon)
|
||||||
.resizable()
|
.resizable()
|
||||||
.aspectRatio(contentMode: .fit)
|
.aspectRatio(contentMode: .fit)
|
||||||
@@ -143,11 +150,10 @@ struct PhpVersionManagerView: View {
|
|||||||
.font(.system(size: 9))
|
.font(.system(size: 9))
|
||||||
.padding(.horizontal, 5)
|
.padding(.horizontal, 5)
|
||||||
.padding(.vertical, 1)
|
.padding(.vertical, 1)
|
||||||
.background(Color.appPrimary)
|
.background(Color.orange)
|
||||||
.foregroundColor(Color.white)
|
.foregroundColor(Color.white)
|
||||||
.clipShape(Capsule())
|
.clipShape(Capsule())
|
||||||
.fixedSize(horizontal: true, vertical: true)
|
.fixedSize(horizontal: true, vertical: true)
|
||||||
.frame(maxHeight: 7)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -192,12 +198,12 @@ struct PhpVersionManagerView: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.listRowBackground(index % 2 == 0
|
.listRowBackground(index % 2 == 0 ? Color.gray.opacity(0): Color.gray.opacity(0.08))
|
||||||
? Color.gray.opacity(0)
|
.padding(.vertical, 8)
|
||||||
: Color.gray.opacity(0.08)
|
.padding(.horizontal, 8)
|
||||||
)
|
|
||||||
.padding(.vertical, 10)
|
|
||||||
}
|
}
|
||||||
|
.edgesIgnoringSafeArea(.top)
|
||||||
|
.listStyle(PlainListStyle())
|
||||||
}
|
}
|
||||||
}.frame(width: 600, height: 600)
|
}.frame(width: 600, height: 600)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user