mirror of
https://github.com/lil-org/tokenary.git
synced 2025-01-05 20:16:25 +03:00
Show error screen on failed connection attempt
This commit is contained in:
parent
3faa8d498d
commit
2ab17518cf
@ -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()
|
||||
|
@ -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()
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user