mirror of
https://github.com/nicoverbruggen/phpmon.git
synced 2025-12-21 11:10:08 +01:00
🚀 Version 25.10.1
This commit is contained in:
@@ -3920,7 +3920,7 @@
|
||||
CODE_SIGN_IDENTITY = "Apple Development";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
CURRENT_PROJECT_VERSION = 1685;
|
||||
CURRENT_PROJECT_VERSION = 1690;
|
||||
DEAD_CODE_STRIPPING = YES;
|
||||
DEBUG = YES;
|
||||
ENABLE_APP_SANDBOX = NO;
|
||||
@@ -3939,7 +3939,7 @@
|
||||
"@executable_path/../Frameworks",
|
||||
);
|
||||
MACOSX_DEPLOYMENT_TARGET = 13.5;
|
||||
MARKETING_VERSION = 25.10;
|
||||
MARKETING_VERSION = 25.10.1;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.nicoverbruggen.phpmon;
|
||||
PRODUCT_MODULE_NAME = PHP_Monitor;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
@@ -3964,7 +3964,7 @@
|
||||
CODE_SIGN_IDENTITY = "Apple Development";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
CURRENT_PROJECT_VERSION = 1685;
|
||||
CURRENT_PROJECT_VERSION = 1690;
|
||||
DEAD_CODE_STRIPPING = YES;
|
||||
DEBUG = NO;
|
||||
ENABLE_APP_SANDBOX = NO;
|
||||
@@ -3983,7 +3983,7 @@
|
||||
"@executable_path/../Frameworks",
|
||||
);
|
||||
MACOSX_DEPLOYMENT_TARGET = 13.5;
|
||||
MARKETING_VERSION = 25.10;
|
||||
MARKETING_VERSION = 25.10.1;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.nicoverbruggen.phpmon;
|
||||
PRODUCT_MODULE_NAME = PHP_Monitor;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
@@ -4146,7 +4146,7 @@
|
||||
CODE_SIGN_IDENTITY = "Apple Development";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
CURRENT_PROJECT_VERSION = 1685;
|
||||
CURRENT_PROJECT_VERSION = 1690;
|
||||
DEAD_CODE_STRIPPING = YES;
|
||||
DEBUG = YES;
|
||||
ENABLE_APP_SANDBOX = NO;
|
||||
@@ -4165,7 +4165,7 @@
|
||||
"@executable_path/../Frameworks",
|
||||
);
|
||||
MACOSX_DEPLOYMENT_TARGET = 13.5;
|
||||
MARKETING_VERSION = 25.10;
|
||||
MARKETING_VERSION = 25.10.1;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.nicoverbruggen.phpmon.eap;
|
||||
PRODUCT_MODULE_NAME = PHP_Monitor;
|
||||
PRODUCT_NAME = "$(TARGET_NAME) EAP";
|
||||
@@ -4339,7 +4339,7 @@
|
||||
CODE_SIGN_IDENTITY = "Apple Development";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
CURRENT_PROJECT_VERSION = 1685;
|
||||
CURRENT_PROJECT_VERSION = 1690;
|
||||
DEAD_CODE_STRIPPING = YES;
|
||||
DEBUG = NO;
|
||||
ENABLE_APP_SANDBOX = NO;
|
||||
@@ -4358,7 +4358,7 @@
|
||||
"@executable_path/../Frameworks",
|
||||
);
|
||||
MACOSX_DEPLOYMENT_TARGET = 13.5;
|
||||
MARKETING_VERSION = 25.10;
|
||||
MARKETING_VERSION = 25.10.1;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.nicoverbruggen.phpmon.eap;
|
||||
PRODUCT_MODULE_NAME = PHP_Monitor;
|
||||
PRODUCT_NAME = "$(TARGET_NAME) EAP";
|
||||
|
||||
@@ -67,8 +67,8 @@
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug.EA"
|
||||
selectedDebuggerIdentifier = ""
|
||||
selectedLauncherIdentifier = "Xcode.IDEFoundation.Launcher.PosixSpawn"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
|
||||
@@ -70,8 +70,8 @@
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = ""
|
||||
selectedLauncherIdentifier = "Xcode.IDEFoundation.Launcher.PosixSpawn"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
|
||||
@@ -9,7 +9,7 @@ import SwiftUI
|
||||
|
||||
struct Localization {
|
||||
static var preferredLanguage: String? {
|
||||
if Preferences.shared == nil {
|
||||
if App.shared.preferences == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
@@ -126,10 +126,9 @@ public struct TestableConfiguration: Codable {
|
||||
let container = App.shared.container
|
||||
container.overrideWith(config: self)
|
||||
|
||||
Preferences.shared = Preferences(container)
|
||||
Log.info("Applying temporary preference overrides...")
|
||||
preferenceOverrides.forEach { (key: PreferenceName, value: Any?) in
|
||||
Preferences.shared.cachedPreferences[key] = value
|
||||
container.preferences.cachedPreferences[key] = value
|
||||
}
|
||||
|
||||
if Valet.shared.installed {
|
||||
|
||||
@@ -7,16 +7,17 @@
|
||||
//
|
||||
|
||||
class Container {
|
||||
// Core abstractions
|
||||
// Primary
|
||||
var shell: ShellProtocol!
|
||||
var filesystem: FileSystemProtocol!
|
||||
var command: CommandProtocol!
|
||||
|
||||
// Extra abstractions
|
||||
var paths: Paths!
|
||||
|
||||
// Secondary (uses primary instances above)
|
||||
var preferences: Preferences!
|
||||
var phpEnvs: PhpEnvironments!
|
||||
var favorites: Favorites!
|
||||
var warningManager: WarningManager! // pending rename?
|
||||
var warningManager: WarningManager!
|
||||
|
||||
///
|
||||
/// The initializer is empty. You must call `prepare` to enable the container.
|
||||
@@ -32,13 +33,17 @@ class Container {
|
||||
/// the container itself and passing the reference on to each component that needs it.
|
||||
///
|
||||
public func prepare() {
|
||||
// Core
|
||||
// These are the most basic building blocks. We need these before
|
||||
// any of the other classes can be initialized!
|
||||
self.shell = RealShell(container: self)
|
||||
self.filesystem = RealFileSystem(container: self)
|
||||
self.command = RealCommand()
|
||||
|
||||
// Extra
|
||||
self.paths = Paths(container: self)
|
||||
|
||||
// Please note that the order in which these are initialized, matters!
|
||||
// For example, preferences leverages the Paths instance, so don't just
|
||||
// swap these around for no reason... the order is very intentional.
|
||||
self.preferences = Preferences(container: self)
|
||||
self.phpEnvs = PhpEnvironments(container: self)
|
||||
self.favorites = Favorites()
|
||||
self.warningManager = WarningManager(container: self)
|
||||
|
||||
@@ -35,13 +35,6 @@ class AppDelegate: NSObject, NSApplicationDelegate, UNUserNotificationCenterDele
|
||||
*/
|
||||
let brew: Brew
|
||||
|
||||
/**
|
||||
The PhpEnvironments singleton that handles PHP version
|
||||
detection, as well as switching. It is initialized
|
||||
when the app is ready and passed all checks.
|
||||
*/
|
||||
var phpEnvironments: PhpEnvironments! = nil
|
||||
|
||||
/**
|
||||
The logger is responsible for different levels of logging.
|
||||
You can tweak the verbosity in the `init` method here.
|
||||
@@ -96,10 +89,6 @@ class AppDelegate: NSObject, NSApplicationDelegate, UNUserNotificationCenterDele
|
||||
super.init()
|
||||
}
|
||||
|
||||
func initializeSwitcher() {
|
||||
self.phpEnvironments = App.shared.container.phpEnvs
|
||||
}
|
||||
|
||||
static func initializeTestingProfile(_ path: String) {
|
||||
Log.info("The configuration with path `\(path)` is being requested...")
|
||||
// Clear for PHP Guard
|
||||
|
||||
@@ -22,7 +22,7 @@ class Startup {
|
||||
Log.info("The user is running PHP Monitor with the architecture: \(App.architecture)")
|
||||
|
||||
// Set up a "background" timer on the main thread
|
||||
Task { @MainActor in
|
||||
await MainActor.run {
|
||||
startStartupTimer()
|
||||
}
|
||||
|
||||
@@ -47,7 +47,6 @@ class Startup {
|
||||
}
|
||||
|
||||
// If we get here, nothing has gone wrong. That's what we want!
|
||||
initializeSwitcher()
|
||||
Log.info("PHP Monitor has determined the application has successfully passed all checks.")
|
||||
|
||||
Log.separator(as: .info)
|
||||
@@ -82,17 +81,6 @@ class Startup {
|
||||
.show()
|
||||
}
|
||||
|
||||
/**
|
||||
Because the Switcher requires various environment guarantees, the switcher is only
|
||||
initialized when it is done working. The switcher must be initialized on the main thread.
|
||||
*/
|
||||
private func initializeSwitcher() {
|
||||
Task { @MainActor in
|
||||
let appDelegate = NSApplication.shared.delegate as! AppDelegate
|
||||
appDelegate.initializeSwitcher()
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Check (List)
|
||||
|
||||
public var groups: [EnvironmentCheckGroup] = [
|
||||
|
||||
@@ -34,32 +34,23 @@ class Packagist {
|
||||
throw PackagistError.unexpectedResponseStructure
|
||||
}
|
||||
|
||||
// Filter for stable versions using the version_normalized string.
|
||||
// A stable version typically does not have a hyphen (-) indicating a pre-release.
|
||||
// Packagist v2 API returns versions in descending order (newest first).
|
||||
// Filter for stable versions - those without a hyphen in version_normalized.
|
||||
let stableVersions = versionsArray.filter { version in
|
||||
guard let versionNormalized = version.version_normalized else {
|
||||
return false
|
||||
}
|
||||
|
||||
// Filter out versions with a hyphen, which are usually unstable.
|
||||
// Filter out pre-release versions (alpha, beta, RC, etc.)
|
||||
return !versionNormalized.contains("-")
|
||||
}
|
||||
|
||||
// Sort the filtered versions using version_normalized, which is designed for lexicographical sorting.
|
||||
let sortedVersions = stableVersions.sorted { (version1, version2) -> Bool in
|
||||
guard let v1 = version1.version_normalized, let v2 = version2.version_normalized else {
|
||||
return false
|
||||
}
|
||||
return v1.lexicographicallyPrecedes(v2)
|
||||
}
|
||||
|
||||
// The last element of the sorted array is the latest version
|
||||
guard let latestVersionInfo = sortedVersions.last,
|
||||
// Get the first stable version (which is the latest)
|
||||
guard let latestVersionInfo = stableVersions.first,
|
||||
let latestVersion = latestVersionInfo.version else {
|
||||
throw PackagistError.noStableVersions
|
||||
}
|
||||
|
||||
return try! VersionNumber.parse(latestVersion)
|
||||
return try VersionNumber.parse(latestVersion)
|
||||
} catch {
|
||||
// Catch any errors that occurred and re-throw them as our custom error type for better diagnostics.
|
||||
if let decodingError = error as? DecodingError {
|
||||
|
||||
@@ -15,7 +15,7 @@ extension MainMenu {
|
||||
*/
|
||||
func startup() async {
|
||||
// Start with the icon
|
||||
Task { @MainActor in
|
||||
await MainActor.run {
|
||||
self.setStatusBar(image: NSImage.statusBarIcon)
|
||||
}
|
||||
|
||||
@@ -36,9 +36,6 @@ extension MainMenu {
|
||||
// Make sure that broken symlinks are removed ASAP
|
||||
await BrewDiagnostics.shared.checkForOutdatedPhpInstallationSymlinks()
|
||||
|
||||
// Initialize preferences
|
||||
Preferences.shared = Preferences(container)
|
||||
|
||||
// Put some useful diagnostics information in log
|
||||
BrewDiagnostics.shared.logBootInformation()
|
||||
|
||||
|
||||
@@ -9,16 +9,13 @@
|
||||
import Foundation
|
||||
|
||||
class Preferences {
|
||||
// MARK: - Singleton
|
||||
static var shared: Preferences!
|
||||
|
||||
var container: Container
|
||||
|
||||
var customPreferences: CustomPrefs
|
||||
|
||||
var cachedPreferences: [PreferenceName: Any?]
|
||||
|
||||
public init(_ container: Container) {
|
||||
public init(container: Container) {
|
||||
self.container = container
|
||||
Preferences.handleFirstTimeLaunch()
|
||||
cachedPreferences = Self.cache()
|
||||
@@ -124,11 +121,11 @@ class Preferences {
|
||||
// MARK: - API
|
||||
|
||||
static var preferences: [PreferenceName: Any?] {
|
||||
return Self.shared.cachedPreferences
|
||||
return App.shared.container.preferences.cachedPreferences
|
||||
}
|
||||
|
||||
static var custom: CustomPrefs {
|
||||
return Self.shared.customPreferences
|
||||
return App.shared.container.preferences.customPreferences
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -168,6 +165,6 @@ class Preferences {
|
||||
UserDefaults.standard.synchronize()
|
||||
|
||||
// Update the preferences cache in memory!
|
||||
Preferences.shared.cachedPreferences = Preferences.cache()
|
||||
App.shared.container.preferences.cachedPreferences = Preferences.cache()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user