diff --git a/PHP Monitor.xcodeproj/xcshareddata/xcschemes/PHP Monitor DEV.xcscheme b/PHP Monitor.xcodeproj/xcshareddata/xcschemes/PHP Monitor DEV.xcscheme index 8642ae0..b0a4d86 100644 --- a/PHP Monitor.xcodeproj/xcshareddata/xcschemes/PHP Monitor DEV.xcscheme +++ b/PHP Monitor.xcodeproj/xcshareddata/xcschemes/PHP Monitor DEV.xcscheme @@ -91,7 +91,7 @@ + isEnabled = "YES"> becomes inactive) + : service.status == .active // service remains unmodified if it's not the named one we change + + return Service( + formula: service.formula, + service: HomebrewService.dummy( + named: service.name, + enabled: newServiceEnabled + ) + ) + }) + + Task { @MainActor in + self.services = services + } } } diff --git a/phpmon/Domain/App/Services/Service.swift b/phpmon/Domain/App/Services/Service.swift index cf9b021..8fca526 100644 --- a/phpmon/Domain/App/Services/Service.swift +++ b/phpmon/Domain/App/Services/Service.swift @@ -8,18 +8,10 @@ import Foundation -/** - Whether a given service is active, inactive or PHP Monitor is still busy determining the status. - */ -public enum ServiceStatus: String { - case active - case inactive - case missing -} - +/** Service linked to a Homebrew formula and whether it is currently (in)active or missing. */ public struct Service: Hashable { var formula: HomebrewFormula - var status: ServiceStatus = .missing + var status: Status = .missing public var name: String { return formula.name @@ -33,6 +25,8 @@ public struct Service: Hashable { } } + // MARK: - Protocols + public static func == (lhs: Service, rhs: Service) -> Bool { return lhs.hashValue == rhs.hashValue } @@ -41,4 +35,12 @@ public struct Service: Hashable { hasher.combine(formula) hasher.combine(status) } + + // MARK: - Status + + public enum Status: String { + case active + case inactive + case missing + } }