Remove now unused password flavor action sheet

This commit is contained in:
Danny Moesch 2020-03-09 08:30:05 +01:00 committed by Mingshen Sun
parent eca4d79178
commit fda8df70dd

View file

@ -255,8 +255,6 @@ class PasswordEditorTableViewController: UITableViewController {
self.present(alert, animated: true, completion: nil)
} else if selectedCell == scanQRCodeCell {
self.performSegue(withIdentifier: "showQRScannerSegue", sender: self)
} else if selectedCell == passwordFlavorCell {
showPasswordGeneratorFlavorActionSheet(sourceCell: selectedCell!, tableView: tableView)
}
}
@ -264,33 +262,6 @@ class PasswordEditorTableViewController: UITableViewController {
super.viewWillDisappear(animated)
Defaults.passwordGenerator = passwordGenerator
}
private func showPasswordGeneratorFlavorActionSheet(sourceCell: UITableViewCell, tableView: UITableView) {
let optionMenu = UIAlertController(title: nil, message: nil, preferredStyle: .actionSheet)
PasswordGeneratorFlavor.allCases.forEach { flavor in
var actionTitle = flavor.longNameLocalized
if passwordGenerator.flavor == flavor {
actionTitle = "" + actionTitle
}
let action = UIAlertAction(title: actionTitle, style: .default) { _ in
guard self.passwordGenerator.flavor != flavor else {
return
}
self.passwordGenerator.flavor = flavor
sourceCell.detailTextLabel?.text = self.passwordGenerator.flavor.localized
self.updateTableData(withRespectTo: flavor)
tableView.reloadSections([self.passwordSection], with: .none)
}
optionMenu.addAction(action)
}
let cancelAction = UIAlertAction(title: "Cancel".localize(), style: .cancel, handler: nil)
optionMenu.addAction(cancelAction)
optionMenu.popoverPresentationController?.sourceView = sourceCell
self.present(optionMenu, animated: true, completion: nil)
}
private func updateTableData(withRespectTo flavor: PasswordGeneratorFlavor) {
// Remove delimiter configuration for XKCD style passwords. Re-add it for random ones.