mirror of
https://github.com/lil-org/wallet.git
synced 2025-01-01 08:54:06 +03:00
Pass imported wallet id to accounts list
This commit is contained in:
parent
a3155beb58
commit
4887c892c8
@ -9,6 +9,7 @@ class AccountsListViewController: NSViewController {
|
||||
private var cellModels = [CellModel]()
|
||||
|
||||
var onSelectedWallet: ((InkWallet) -> Void)?
|
||||
var newWalletId: String?
|
||||
|
||||
enum CellModel {
|
||||
case wallet(InkWallet)
|
||||
|
@ -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)
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user