mirror of
https://github.com/maxgoedjen/secretive.git
synced 2026-03-15 05:47:24 +01:00
Allows auto-launch for every user's build
This commit is contained in:
@@ -9,7 +9,7 @@ protocol AgentStatusCheckerProtocol: ObservableObject {
|
||||
class AgentStatusChecker: ObservableObject, AgentStatusCheckerProtocol {
|
||||
|
||||
@Published var running: Bool = false
|
||||
let bundleID = Bundle.main.bundleIdentifier?.replacingOccurrences(of: "Host", with: "SecretAgent")
|
||||
let bundleID = Bundle.main.bundleIdentifier!.replacingOccurrences(of: "Host", with: "SecretAgent")
|
||||
|
||||
init() {
|
||||
check()
|
||||
@@ -21,7 +21,7 @@ class AgentStatusChecker: ObservableObject, AgentStatusCheckerProtocol {
|
||||
|
||||
// All processes, including ones from older versions, etc
|
||||
var secretAgentProcesses: [NSRunningApplication] {
|
||||
NSRunningApplication.runningApplications(withBundleIdentifier: bundleID ?? "com.maxgoedjen.Secretive.SecretAgent")
|
||||
NSRunningApplication.runningApplications(withBundleIdentifier: bundleID )
|
||||
}
|
||||
|
||||
// The process corresponding to this instance of Secretive
|
||||
|
||||
@@ -5,6 +5,7 @@ import OSLog
|
||||
|
||||
struct LaunchAgentController {
|
||||
|
||||
let bundleID = Bundle.main.bundleIdentifier!.replacingOccurrences(of: "Host", with: "SecretAgent")
|
||||
func install(completion: (() -> Void)? = nil) {
|
||||
Logger().debug("Installing agent")
|
||||
_ = setEnabled(false)
|
||||
@@ -32,7 +33,7 @@ struct LaunchAgentController {
|
||||
}
|
||||
|
||||
private func setEnabled(_ enabled: Bool) -> Bool {
|
||||
SMLoginItemSetEnabled("com.maxgoedjen.Secretive.SecretAgent" as CFString, enabled)
|
||||
SMLoginItemSetEnabled(bundleID as CFString, enabled)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user