Kill all sessions on app quit

This commit is contained in:
Ivan Grachev 2021-06-20 20:36:06 +03:00
parent 21830909a3
commit 4551f70b18
2 changed files with 11 additions and 1 deletions

View File

@ -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)
}
}
}

View File

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