tokenary/Encrypted Ink/Screens/ImportViewController.swift

46 lines
1.3 KiB
Swift
Raw Normal View History

2021-06-12 13:48:29 +03:00
// Copyright © 2021 Encrypted Ink. All rights reserved.
2021-06-12 13:32:27 +03:00
import Cocoa
2021-06-13 02:12:03 +03:00
class ImportViewController: NSViewController {
2021-06-12 17:39:42 +03:00
2021-06-13 02:24:02 +03:00
@IBOutlet weak var textField: NSTextField! {
didSet {
textField.delegate = self
}
}
@IBOutlet weak var okButton: NSButton!
2021-06-12 17:39:42 +03:00
2021-06-12 13:32:27 +03:00
override func viewDidLoad() {
super.viewDidLoad()
}
2021-06-12 19:33:24 +03:00
@IBAction func actionButtonTapped(_ sender: Any) {
AccountsService.addAccount(privateKey: textField.stringValue)
2021-06-13 02:24:02 +03:00
// TODO: open accounts list
2021-06-12 20:37:56 +03:00
WalletConnect.shared.connect(link: globalLink, address: "0xCf60CC6E4AD79187E7eBF62e0c21ae3a343180B2") { connected in
// TODO: close here
// use connected value
}
if let accounts = storyboard?.instantiateController(withIdentifier: "AccountsListViewController") as? AccountsListViewController {
view.window?.contentViewController = accounts
}
2021-06-12 20:37:56 +03:00
// TODO: show spinner
// Window.closeAll()
// Window.activateSafari()
2021-06-12 19:33:24 +03:00
}
2021-06-12 13:32:27 +03:00
}
2021-06-13 02:24:02 +03:00
extension ImportViewController: NSTextFieldDelegate {
func controlTextDidChange(_ obj: Notification) {
okButton.isEnabled = AccountsService.validateAccountKey(textField.stringValue)
}
}