diff --git a/Secretive/Controllers/AgentStatusChecker.swift b/Secretive/Controllers/AgentStatusChecker.swift index d09cd32..ab33384 100644 --- a/Secretive/Controllers/AgentStatusChecker.swift +++ b/Secretive/Controllers/AgentStatusChecker.swift @@ -9,6 +9,7 @@ protocol AgentStatusCheckerProtocol: ObservableObject { class AgentStatusChecker: ObservableObject, AgentStatusCheckerProtocol { @Published var running: Bool = false + let bundleID = Bundle.main.bundleIdentifier?.replacingOccurrences(of: "Host", with: "SecretAgent") init() { check() @@ -20,7 +21,7 @@ class AgentStatusChecker: ObservableObject, AgentStatusCheckerProtocol { // All processes, including ones from older versions, etc var secretAgentProcesses: [NSRunningApplication] { - NSRunningApplication.runningApplications(withBundleIdentifier: Constants.secretAgentAppID) + NSRunningApplication.runningApplications(withBundleIdentifier: bundleID ?? "com.maxgoedjen.Secretive.SecretAgent") } // The process corresponding to this instance of Secretive @@ -37,10 +38,4 @@ class AgentStatusChecker: ObservableObject, AgentStatusCheckerProtocol { } -extension AgentStatusChecker { - enum Constants { - static let secretAgentAppID = "com.maxgoedjen.Secretive.SecretAgent" - } - -}