Hide the password generation setting on Apple Keychain style (close #84)

This commit is contained in:
Yishi Lin 2017-05-26 00:37:00 +08:00
parent f513255aa8
commit dd3c8b9164
5 changed files with 63 additions and 54 deletions

View file

@ -16,11 +16,14 @@ class AddPasswordTableViewController: PasswordEditorTableViewController {
override func viewDidLoad() {
tableData = [
[[.type: PasswordEditorCellType.nameCell, .title: "name"]],
[[.type: PasswordEditorCellType.fillPasswordCell, .title: "password"],
[.type: PasswordEditorCellType.passwordLengthCell, .title: "passwordlength"]],
[[.type: PasswordEditorCellType.fillPasswordCell, .title: "password"]],
[[.type: PasswordEditorCellType.additionsCell, .title: "additions"]],
[[.type: PasswordEditorCellType.scanQRCodeCell]]
]
if let lengthSetting = Globals.passwordDefaultLength[Defaults[.passwordGeneratorFlavor]],
lengthSetting.max > lengthSetting.min {
tableData[1].append([.type: PasswordEditorCellType.passwordLengthCell, .title: "passwordlength"])
}
super.viewDidLoad()
}

View file

@ -7,17 +7,21 @@
//
import UIKit
import SwiftyUserDefaults
class EditPasswordTableViewController: PasswordEditorTableViewController {
override func viewDidLoad() {
tableData = [
[[.type: PasswordEditorCellType.nameCell, .title: "name", .content: password!.namePath]],
[[.type: PasswordEditorCellType.fillPasswordCell, .title: "password", .content: password!.password],
[.type: PasswordEditorCellType.passwordLengthCell, .title: "passwordlength"]],
[[.type: PasswordEditorCellType.fillPasswordCell, .title: "password", .content: password!.password]],
[[.type: PasswordEditorCellType.additionsCell, .title: "additions", .content: password!.getAdditionsPlainText()]],
[[.type: PasswordEditorCellType.scanQRCodeCell],
[.type: PasswordEditorCellType.deletePasswordCell]]
]
if let lengthSetting = Globals.passwordDefaultLength[Defaults[.passwordGeneratorFlavor]],
lengthSetting.max > lengthSetting.min {
tableData[1].append([.type: PasswordEditorCellType.passwordLengthCell, .title: "passwordlength"])
}
super.viewDidLoad()
}

View file

@ -89,6 +89,9 @@ class PasswordEditorTableViewController: UITableViewController, FillPasswordTabl
fillPasswordCell = tableView.dequeueReusableCell(withIdentifier: "fillPasswordCell", for: indexPath) as? FillPasswordTableViewCell
fillPasswordCell?.delegate = self
fillPasswordCell?.setContent(content: cellData[PasswordEditorCellKey.content] as? String)
if tableData[passwordSection].count == 1 {
fillPasswordCell?.settingButton.isHidden = true
}
return fillPasswordCell!
case .passwordLengthCell:
passwordLengthCell = tableView.dequeueReusableCell(withIdentifier: "passwordLengthCell", for: indexPath) as? SliderTableViewCell