diff --git a/DEVELOPER.md b/DEVELOPER.md index f8a7396..ff43b26 100644 --- a/DEVELOPER.md +++ b/DEVELOPER.md @@ -14,6 +14,16 @@ It also automatically runs when you try to build the project. You'll get a warni swiftlint --fix ``` +## ⚙️ Preferences + +You can find the persisted configuration file in `~/Library/Preferences/com.nicoverbruggen.phpmon.plist` + +These values are cached by the OS. You can clear this cache by running: + +``` +defaults delete com.nicoverbruggen.phpmon && killall cfprefsd +``` + ## 🔧 Build instructions build button in Xcode diff --git a/phpmon/Common/PHP/Homebrew/HomebrewService.swift b/phpmon/Common/PHP/Homebrew/HomebrewService.swift index 028dfe0..d46cbc7 100644 --- a/phpmon/Common/PHP/Homebrew/HomebrewService.swift +++ b/phpmon/Common/PHP/Homebrew/HomebrewService.swift @@ -44,7 +44,7 @@ final class HomebrewService: Sendable, Decodable { /** Dummy data for preview purposes. */ - public static func dummy(named service: String, enabled: Bool) -> HomebrewService { + public static func dummy(named service: String, enabled: Bool, status: String? = nil) -> HomebrewService { return HomebrewService( name: service, service_name: service, @@ -52,7 +52,7 @@ final class HomebrewService: Sendable, Decodable { loaded: enabled, pid: nil, user: nil, - status: nil, + status: status, log_path: nil, error_log_path: nil ) diff --git a/phpmon/Domain/App/Services/FakeServicesManager.swift b/phpmon/Domain/App/Services/FakeServicesManager.swift index e522ac3..b18998f 100644 --- a/phpmon/Domain/App/Services/FakeServicesManager.swift +++ b/phpmon/Domain/App/Services/FakeServicesManager.swift @@ -41,9 +41,14 @@ class FakeServicesManager: ServicesManager { private func reapplyServices() { let services = self.formulae.map { + let dummy = HomebrewService.dummy( + named: $0.name, + enabled: self.fixedStatus == .active, + status: self.fixedStatus == .error ? "error" : nil + ) let wrapper = Service( formula: $0, - service: HomebrewService.dummy(named: $0.name, enabled: self.fixedStatus == .active) + service: dummy ) return wrapper } diff --git a/phpmon/Domain/Menu/MainMenu+Startup.swift b/phpmon/Domain/Menu/MainMenu+Startup.swift index 03a4545..e51d2e9 100644 --- a/phpmon/Domain/Menu/MainMenu+Startup.swift +++ b/phpmon/Domain/Menu/MainMenu+Startup.swift @@ -111,7 +111,7 @@ extension MainMenu { #endif // Present first launch screen if needed - if Stats.successfulLaunchCount == 0 && !isRunningSwiftUIPreview { + if Stats.successfulLaunchCount == 1 && !isRunningSwiftUIPreview { Log.info("Should present the first launch screen!") Task { @MainActor in OnboardingWindowController.show()