Force launch.

This commit is contained in:
Max Goedjen 2020-11-11 16:34:15 -08:00
parent 0ba2e4107b
commit 043af5cb99
No known key found for this signature in database
GPG Key ID: E58C21DD77B9B8E8
1 changed files with 10 additions and 3 deletions

View File

@ -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 {