Use PasswordTableViewCell for all password entries

This commit is contained in:
Mingshen Sun 2021-01-05 20:54:51 -08:00
parent 3e3aca1c3c
commit 3ecb35e701
No known key found for this signature in database
GPG key ID: 1F86BA2052FED3B4
7 changed files with 164 additions and 168 deletions

View file

@ -52,7 +52,7 @@ class ExtensionViewController: UIViewController, UITableViewDataSource, UITableV
searchBar.delegate = self
tableView.delegate = self
tableView.dataSource = self
tableView.register(UINib(nibName: "PasswordWithFolderTableViewCell", bundle: nil), forCellReuseIdentifier: "passwordWithFolderTableViewCell")
tableView.register(PasswordTableViewCell.self, forCellReuseIdentifier: "passwordTableViewCell")
// initialize table entries
initPasswordsTableEntries()
@ -109,16 +109,10 @@ class ExtensionViewController: UIViewController, UITableViewDataSource, UITableV
// define cell contents, and set long press action
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "passwordTableViewCell", for: indexPath)
let cell = tableView.dequeueReusableCell(withIdentifier: "passwordTableViewCell", for: indexPath) as! PasswordTableViewCell
let entry = getPasswordEntry(by: indexPath)
if entry.synced {
cell.textLabel?.text = entry.title
} else {
cell.textLabel?.text = "\(entry.title)"
}
cell.accessoryType = .none
cell.detailTextLabel?.font = UIFont.preferredFont(forTextStyle: .footnote)
cell.detailTextLabel?.text = entry.categoryText
cell.configure(with: entry)
return cell
}