Restore swipe to delete tokens in Wallet tab, fixing crash when deleting

pull/1363/head
Hwee-Boon Yar 5 years ago
parent 843321b679
commit 24edd7b9ff
  1. 3
      AlphaWallet/Tokens/ViewControllers/TokensViewController.swift
  2. 1
      AlphaWallet/Tokens/ViewModels/TokensViewModel.swift

@ -366,8 +366,7 @@ extension TokensViewController: UITableViewDelegate {
}
func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool {
//Disabled deleting until we figure why it crashes when deleting
return false
return viewModel.canDelete(for: indexPath.row, section: indexPath.section)
}
func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCell.EditingStyle, forRowAt indexPath: IndexPath) {

@ -77,6 +77,7 @@ class TokensViewModel {
func canDelete(for row: Int, section: Int) -> Bool {
let token = item(for: row, section: section)
guard !token.isInvalidated else { return false }
if token.contractAddress.sameContract(as: Constants.nativeCryptoAddressInDatabase) {
return false
}

Loading…
Cancel
Save