Show error screen on failed connection attempt

This commit is contained in:
Ivan Grachyov 2021-06-13 07:12:39 +03:00
parent 3faa8d498d
commit 2ab17518cf
2 changed files with 24 additions and 6 deletions

View File

@ -46,11 +46,19 @@ class Agent {
}
}
func connectWalletWithLink(_ link: String, account: Account) {
WalletConnect.shared.connect(link: link, address: account.address) { connected in
Window.closeAll()
Window.activateSafari()
// TODO: show error if failed to connect
func showErrorMessage(_ message: String) {
let windowController = Window.showNew()
windowController.contentViewController = ErrorViewController.withMessage(message)
}
private func connectWalletWithLink(_ link: String, account: Account) {
WalletConnect.shared.connect(link: link, address: account.address) { [weak self] connected in
if connected {
Window.closeAll()
Window.activateSafari()
} else {
self?.showErrorMessage("Failed to connect")
}
}
let windowController = Window.showNew()

View File

@ -4,14 +4,24 @@ import Cocoa
class ErrorViewController: NSViewController {
static func withMessage(_ message: String) -> ErrorViewController {
let new = instantiate(ErrorViewController.self)
new.message = message
return new
}
private var message = ""
@IBOutlet weak var titleLabel: NSTextField!
override func viewDidLoad() {
super.viewDidLoad()
// TODO: show message text
}
@IBAction func actionButtonTapped(_ sender: Any) {
Window.closeAll()
Window.activateSafari()
}
}