Show number of hidden fields in password view
This commit is contained in:
parent
68dd60fb8e
commit
5780a439db
2 changed files with 27 additions and 1 deletions
|
|
@ -441,12 +441,30 @@ class PasswordDetailTableViewController: UITableViewController, UIGestureRecogni
|
|||
cell.selectionStyle = .none
|
||||
return cell
|
||||
case .misc:
|
||||
let cell = UITableViewCell()
|
||||
let cell = UITableViewCell(style: .value1, reuseIdentifier: nil)
|
||||
cell.textLabel?.text = tableDataItem.title
|
||||
cell.selectionStyle = .default
|
||||
addHiddenFieldInformation(to: cell)
|
||||
return cell
|
||||
}
|
||||
}
|
||||
|
||||
private func addHiddenFieldInformation(to cell: UITableViewCell) {
|
||||
guard password != nil, let detailTextLabel = cell.detailTextLabel else {
|
||||
return
|
||||
}
|
||||
|
||||
var numberOfHiddenFields = 0
|
||||
numberOfHiddenFields += SharedDefaults[.isHideUnknownOn] ? password!.numberOfUnknowns : 0
|
||||
numberOfHiddenFields += SharedDefaults[.isHideOTPOn] ? password!.numberOfOtpRelated : 0
|
||||
guard numberOfHiddenFields > 0 else {
|
||||
return
|
||||
}
|
||||
|
||||
detailTextLabel.textAlignment = .center
|
||||
detailTextLabel.textColor = .gray
|
||||
detailTextLabel.text = "\(numberOfHiddenFields) hidden field\(numberOfHiddenFields > 1 ? "s" : "")"
|
||||
}
|
||||
|
||||
override func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
|
||||
return tableData[section].header
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue