diff --git a/Sources/Secretive.xcodeproj/project.pbxproj b/Sources/Secretive.xcodeproj/project.pbxproj index fe78151..1d9ae29 100644 --- a/Sources/Secretive.xcodeproj/project.pbxproj +++ b/Sources/Secretive.xcodeproj/project.pbxproj @@ -266,7 +266,6 @@ isa = PBXGroup; children = ( 50617D8423FCE48E0099B055 /* ContentView.swift */, - 5065E312295517C500E16645 /* ToolbarButtonStyle.swift */, 5079BA0E250F29BF00EA86F4 /* StoreListView.swift */, 50153E21250DECA300525160 /* SecretListItemView.swift */, 50C385A42407A76D00AF2719 /* SecretDetailView.swift */, @@ -278,6 +277,7 @@ 50153E1F250AFCB200525160 /* UpdateView.swift */, 5066A6C12516F303004B5A36 /* SetupView.swift */, 5066A6C72516FE6E004B5A36 /* CopyableView.swift */, + 5065E312295517C500E16645 /* ToolbarButtonStyle.swift */, ); path = Views; sourceTree = ""; diff --git a/Sources/Secretive/Controllers/AgentStatusChecker.swift b/Sources/Secretive/Controllers/AgentStatusChecker.swift index 8f0602e..e957fad 100644 --- a/Sources/Secretive/Controllers/AgentStatusChecker.swift +++ b/Sources/Secretive/Controllers/AgentStatusChecker.swift @@ -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() + } + } diff --git a/Sources/Secretive/Preview Content/PreviewAgentStatusChecker.swift b/Sources/Secretive/Preview Content/PreviewAgentStatusChecker.swift index e893155..d725735 100644 --- a/Sources/Secretive/Preview Content/PreviewAgentStatusChecker.swift +++ b/Sources/Secretive/Preview Content/PreviewAgentStatusChecker.swift @@ -10,4 +10,7 @@ class PreviewAgentStatusChecker: AgentStatusCheckerProtocol { self.running = running } + func restart() { + } + } diff --git a/Sources/Secretive/Views/ContentView.swift b/Sources/Secretive/Views/ContentView.swift index 59dd3fc..9e9a951 100644 --- a/Sources/Secretive/Views/ContentView.swift +++ b/Sources/Secretive/Views/ContentView.swift @@ -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() }