From 9c4b4ac39eff2b55c5fa6e374d745cb12ebac7a1 Mon Sep 17 00:00:00 2001 From: Alex Lavallee <73203142+lavalleeale@users.noreply.github.com> Date: Mon, 30 Nov 2020 00:47:31 -0800 Subject: [PATCH] Fixed rest of app for non-standard build --- Secretive/Controllers/AgentStatusChecker.swift | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) 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" - } - -}