diff --git a/Encrypted Ink/Agent.swift b/Encrypted Ink/Agent.swift index a9e3ca2f..797c2fb7 100644 --- a/Encrypted Ink/Agent.swift +++ b/Encrypted Ink/Agent.swift @@ -114,7 +114,11 @@ class Agent: NSObject { alert.addButton(withTitle: "OK") alert.addButton(withTitle: "Cancel") if alert.runModal() == .alertFirstButtonReturn { - NSApp.terminate(nil) + statusBarItem = nil + WalletConnect.shared.killAllSessions() + DispatchQueue.main.asyncAfter(deadline: .now() + .seconds(2)) { + NSApp.terminate(nil) + } } } diff --git a/Encrypted Ink/WalletConnect.swift b/Encrypted Ink/WalletConnect.swift index d1337f5c..14029f1d 100644 --- a/Encrypted Ink/WalletConnect.swift +++ b/Encrypted Ink/WalletConnect.swift @@ -28,6 +28,12 @@ class WalletConnect { interactors.append(interactor) } + func killAllSessions() { + interactors.forEach { + $0.killSession().cauterize() + } + } + private func configure(interactor: WCInteractor, address: String) { let accounts = [address] let chainId = 1