mirror of
https://github.com/maxgoedjen/secretive.git
synced 2025-04-18 05:22:11 +00:00
Better processing.
This commit is contained in:
parent
7de561af5d
commit
320dd49ce0
@ -15,11 +15,24 @@ class AgentStatusChecker: ObservableObject, AgentStatusCheckerProtocol {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func check() {
|
func check() {
|
||||||
running = secretAgentProcess != nil
|
running = instanceSecretAgentProcess != nil
|
||||||
}
|
}
|
||||||
|
|
||||||
var secretAgentProcess: NSRunningApplication? {
|
// All processes, including ones from older versions, etc
|
||||||
NSRunningApplication.runningApplications(withBundleIdentifier: Constants.secretAgentAppID).first
|
var secretAgentProcesses: [NSRunningApplication] {
|
||||||
|
NSRunningApplication.runningApplications(withBundleIdentifier: Constants.secretAgentAppID)
|
||||||
|
}
|
||||||
|
|
||||||
|
// The process corresponding to this instance of Secretive
|
||||||
|
var instanceSecretAgentProcess: NSRunningApplication? {
|
||||||
|
let agents = secretAgentProcesses
|
||||||
|
for agent in agents {
|
||||||
|
guard let url = agent.bundleURL else { continue }
|
||||||
|
if url.absoluteString.hasPrefix(Bundle.main.bundleURL.absoluteString) {
|
||||||
|
return agent
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user