mirror of
https://github.com/lil-org/wallet.git
synced 2025-01-06 04:13:11 +03:00
Show alert before removing account
This commit is contained in:
parent
eb045017dd
commit
51e342a572
@ -55,10 +55,18 @@ class AccountsListViewController: NSViewController {
|
||||
|
||||
@objc private func didClickRemoveAccount(_ sender: AnyObject) {
|
||||
let row = tableView.clickedRow
|
||||
guard row >= 0 else { return }
|
||||
AccountsService.removeAccount(accounts[row])
|
||||
accounts.remove(at: row)
|
||||
tableView.reloadData()
|
||||
|
||||
let alert = NSAlert()
|
||||
alert.messageText = "Removed accounts can't be recovered."
|
||||
alert.alertStyle = .critical
|
||||
alert.addButton(withTitle: "Cancel")
|
||||
alert.addButton(withTitle: "Remove anyway")
|
||||
if alert.runModal() != .alertFirstButtonReturn {
|
||||
guard row >= 0 else { return }
|
||||
AccountsService.removeAccount(accounts[row])
|
||||
accounts.remove(at: row)
|
||||
tableView.reloadData()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user