Pass imported wallet id to accounts list

This commit is contained in:
Ivan Grachyov 2021-08-03 23:37:01 +03:00
parent a3155beb58
commit 4887c892c8
2 changed files with 6 additions and 4 deletions

View File

@ -9,6 +9,7 @@ class AccountsListViewController: NSViewController {
private var cellModels = [CellModel]()
var onSelectedWallet: ((InkWallet) -> Void)?
var newWalletId: String?
enum CellModel {
case wallet(InkWallet)

View File

@ -52,21 +52,22 @@ class ImportViewController: NSViewController {
private func importWith(input: String, password: String?) {
do {
_ = try walletsManager.addWallet(input: input, inputPassword: password)
showAccountsList()
let wallet = try walletsManager.addWallet(input: input, inputPassword: password)
showAccountsList(newWalletId: wallet.id)
} catch {
Alert.showWithMessage("Failed to import account", style: .critical)
}
}
private func showAccountsList() {
private func showAccountsList(newWalletId: String?) {
let accountsListViewController = instantiate(AccountsListViewController.self)
accountsListViewController.onSelectedWallet = onSelectedWallet
accountsListViewController.newWalletId = newWalletId
view.window?.contentViewController = accountsListViewController
}
@IBAction func cancelButtonTapped(_ sender: NSButton) {
showAccountsList()
showAccountsList(newWalletId: nil)
}
}