Use a better section name

This commit is contained in:
Davide De Rosa 2018-10-22 22:17:21 +02:00
parent edc513f6cc
commit 9d94d59aab
1 changed files with 6 additions and 6 deletions

View File

@ -45,13 +45,13 @@ class AccountViewController: UIViewController, TableModelHost {
var infrastructureName: Infrastructure.Name? { var infrastructureName: Infrastructure.Name? {
didSet { didSet {
guard let name = infrastructureName else { guard let name = infrastructureName else {
model.removeFooter(for: .only) model.removeFooter(for: .credentials)
return return
} }
let V = L10n.Account.SuggestionFooter.Infrastructure.self let V = L10n.Account.SuggestionFooter.Infrastructure.self
switch name { switch name {
case .pia: case .pia:
model.setFooter(V.pia, for: .only) model.setFooter(V.pia, for: .credentials)
} }
tableView?.reloadData() tableView?.reloadData()
} }
@ -69,8 +69,8 @@ class AccountViewController: UIViewController, TableModelHost {
let model: TableModel<SectionType, RowType> = { let model: TableModel<SectionType, RowType> = {
let model: TableModel<SectionType, RowType> = TableModel() let model: TableModel<SectionType, RowType> = TableModel()
model.add(.only) model.add(.credentials)
model.set([.username, .password], in: .only) model.set([.username, .password], in: .credentials)
return model return model
}() }()
@ -123,7 +123,7 @@ class AccountViewController: UIViewController, TableModelHost {
extension AccountViewController: UITableViewDataSource, UITableViewDelegate, FieldTableViewCellDelegate { extension AccountViewController: UITableViewDataSource, UITableViewDelegate, FieldTableViewCellDelegate {
enum SectionType: Int { enum SectionType: Int {
case only case credentials
} }
enum RowType: Int { enum RowType: Int {
@ -135,7 +135,7 @@ extension AccountViewController: UITableViewDataSource, UITableViewDelegate, Fie
private static let footerButtonTag = 1000 private static let footerButtonTag = 1000
func tableView(_ tableView: UITableView, titleForFooterInSection section: Int) -> String? { func tableView(_ tableView: UITableView, titleForFooterInSection section: Int) -> String? {
return model.footer(for: .only) return model.footer(for: .credentials)
} }
func tableView(_ tableView: UITableView, willDisplayFooterView view: UIView, forSection section: Int) { func tableView(_ tableView: UITableView, willDisplayFooterView view: UIView, forSection section: Int) {