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

@ -30,7 +30,7 @@
<textInputTraits key="textInputTraits"/>
</searchBar>
<prototypes>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" accessoryType="disclosureIndicator" indentationWidth="10" reuseIdentifier="passwordTableViewCell" textLabel="LUo-8T-I4j" detailTextLabel="9ik-sy-sTS" style="IBUITableViewCellStyleValue1" id="T2b-vj-fza">
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" accessoryType="disclosureIndicator" indentationWidth="10" reuseIdentifier="passwordTableViewCell" textLabel="LUo-8T-I4j" detailTextLabel="9ik-sy-sTS" style="IBUITableViewCellStyleValue1" id="T2b-vj-fza" customClass="PasswordTableViewCell" customModule="passExtension" customModuleProvider="target">
<rect key="frame" x="0.0" y="84" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="T2b-vj-fza" id="aVb-V4-hqg">

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
}