Polish and refactor PasswordsTableDataSource

This commit is contained in:
Mingshen Sun 2021-01-11 21:04:11 -08:00
parent 8e66b2905b
commit a706f90d0d
No known key found for this signature in database
GPG key ID: 1F86BA2052FED3B4
2 changed files with 26 additions and 33 deletions

View file

@ -68,17 +68,7 @@ extension PasswordsViewController: UISearchBarDelegate {
extension PasswordsViewController: UITableViewDelegate {
func tableView(_: UITableView, didSelectRowAt indexPath: IndexPath) {
tableView.deselectRow(at: indexPath, animated: true)
var entry: PasswordTableEntry!
if dataSource.showSuggestion {
if indexPath.section == 0 {
entry = dataSource.suggestedPasswordsTableEntries[indexPath.row]
} else {
entry = dataSource.otherPasswordsTableEntries[indexPath.row]
}
} else {
entry = dataSource.filteredPasswordsTableEntries[indexPath.row]
}
let entry = dataSource.tableEntry(at: indexPath)
UIImpactFeedbackGenerator(style: .medium).impactOccurred()
self.selectionDelegate?.selected(password: entry)
}