mirror of
https://github.com/maxgoedjen/secretive.git
synced 2026-03-11 03:57:23 +01:00
Add restart
This commit is contained in:
@@ -6,6 +6,7 @@ import SecretKit
|
||||
protocol AgentStatusCheckerProtocol: ObservableObject {
|
||||
var running: Bool { get }
|
||||
var developmentBuild: Bool { get }
|
||||
func restart()
|
||||
}
|
||||
|
||||
class AgentStatusChecker: ObservableObject, AgentStatusCheckerProtocol {
|
||||
@@ -37,12 +38,15 @@ class AgentStatusChecker: ObservableObject, AgentStatusCheckerProtocol {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
// Whether Secretive is being run in an Xcode environment.
|
||||
var developmentBuild: Bool {
|
||||
Bundle.main.bundleURL.absoluteString.contains("/Library/Developer/Xcode")
|
||||
}
|
||||
|
||||
func restart() {
|
||||
instanceSecretAgentProcess?.forceTerminate()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -10,4 +10,7 @@ class PreviewAgentStatusChecker: AgentStatusCheckerProtocol {
|
||||
self.running = running
|
||||
}
|
||||
|
||||
func restart() {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -149,6 +149,9 @@ extension ContentView {
|
||||
.padding(5)
|
||||
Text("SecretAgent is a process that runs in the background to sign requests, so you don't need to keep Secretive open all the time.\n\n**You can close Secretive, and everything will still keep working.**")
|
||||
.frame(width: 300)
|
||||
Button("Restart Agent") {
|
||||
self.agentStatusChecker.restart()
|
||||
}
|
||||
}
|
||||
.padding()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user