diff --git a/Sources/Secretive/App.swift b/Sources/Secretive/App.swift index c13dadd..ea2f156 100644 --- a/Sources/Secretive/App.swift +++ b/Sources/Secretive/App.swift @@ -17,7 +17,8 @@ struct Secretive: App { .onReceive(NotificationCenter.default.publisher(for: NSApplication.didBecomeActiveNotification)) { _ in Task { @AppStorage("defaultsHasRunSetup") var hasRunSetup = false - guard hasRunSetup else { return } + @AppStorage("explicitlyDisabled") var explicitlyDisabled = false + guard hasRunSetup && !explicitlyDisabled else { return } agentLaunchController.check() guard !agentLaunchController.developmentBuild else { return } if justUpdatedChecker.justUpdatedBuild || !agentLaunchController.running { diff --git a/Sources/Secretive/Controllers/AgentStatusChecker.swift b/Sources/Secretive/Controllers/AgentStatusChecker.swift index 63962ac..4cb4620 100644 --- a/Sources/Secretive/Controllers/AgentStatusChecker.swift +++ b/Sources/Secretive/Controllers/AgentStatusChecker.swift @@ -40,7 +40,7 @@ import ServiceManagement // The process corresponding to this instance of Secretive var instanceSecretAgentProcess: NSRunningApplication? { - // FIXME: CHECK VERSION + // TODO: CHECK VERSION let agents = allSecretAgentProcesses for agent in agents { guard let url = agent.bundleURL else { continue } diff --git a/Sources/Secretive/Views/Views/AgentStatusView.swift b/Sources/Secretive/Views/Views/AgentStatusView.swift index 3377772..43c69a1 100644 --- a/Sources/Secretive/Views/Views/AgentStatusView.swift +++ b/Sources/Secretive/Views/Views/AgentStatusView.swift @@ -15,6 +15,7 @@ struct AgentStatusView: View { struct AgentRunningView: View { @Environment(\.agentLaunchController) private var agentLaunchController: any AgentLaunchControllerProtocol + @AppStorage("explicitlyDisabled") var explicitlyDisabled = false var body: some View { Form { @@ -53,6 +54,7 @@ struct AgentRunningView: View { Menu(.agentDetailsRestartAgentButton) { Button(.agentDetailsDisableAgentButton) { Task { + explicitlyDisabled = true try? await agentLaunchController .uninstall() } @@ -79,6 +81,7 @@ struct AgentNotRunningView: View { @Environment(\.agentLaunchController) private var agentLaunchController @State var triedRestart = false @State var loading = false + @AppStorage("explicitlyDisabled") var explicitlyDisabled = false var body: some View { Form { @@ -94,6 +97,7 @@ struct AgentNotRunningView: View { if !triedRestart { Spacer() Button { + explicitlyDisabled = false guard !loading else { return } loading = true Task {