From 043af5cb996aeef162d96a20369a381ee5f4cbe5 Mon Sep 17 00:00:00 2001 From: Max Goedjen Date: Wed, 11 Nov 2020 16:34:15 -0800 Subject: [PATCH] Force launch. --- Secretive/App.swift | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/Secretive/App.swift b/Secretive/App.swift index eb4a82a..ab0bd93 100644 --- a/Secretive/App.swift +++ b/Secretive/App.swift @@ -28,13 +28,20 @@ struct Secretive: App { .onAppear { if !hasRunSetup { showingSetup = true - } else if agentStatusChecker.running && justUpdatedChecker.justUpdated { - // Relaunch the agent, since it'll be running from earlier update still - _ = LaunchAgentController().install() + } else { + if agentStatusChecker.running && justUpdatedChecker.justUpdated { + // Relaunch the agent, since it'll be running from earlier update still + _ = LaunchAgentController().install() + } } } .onReceive(NotificationCenter.default.publisher(for: NSApplication.willBecomeActiveNotification)) { _ in agentStatusChecker.check() + if hasRunSetup && !agentStatusChecker.running { + // We've run setup, we didn't just update, launchd is just not doing it's thing. + // Force a launch directly. + LaunchAgentController().forceLaunch() + } } } .commands {