|
@@ -2,6 +2,7 @@ import UIKit
|
|
|
|
|
|
class EditSettingsController: UITableViewController {
|
|
class EditSettingsController: UITableViewController {
|
|
|
|
|
|
|
|
+ private let dcContext: DcContext
|
|
private var displayNameBackup: String?
|
|
private var displayNameBackup: String?
|
|
private var statusCellBackup: String?
|
|
private var statusCellBackup: String?
|
|
|
|
|
|
@@ -9,7 +10,12 @@ class EditSettingsController: UITableViewController {
|
|
private let section1Name = 0
|
|
private let section1Name = 0
|
|
private let section1Status = 1
|
|
private let section1Status = 1
|
|
private let section1RowCount = 2
|
|
private let section1RowCount = 2
|
|
- private let sectionCount = 1
|
|
|
|
|
|
+
|
|
|
|
+ private let section2 = 1
|
|
|
|
+ private let section2AccountSettings = 0
|
|
|
|
+ private let section2RowCount = 1
|
|
|
|
+
|
|
|
|
+ private let sectionCount = 2
|
|
|
|
|
|
private lazy var displayNameCell: TextFieldCell = {
|
|
private lazy var displayNameCell: TextFieldCell = {
|
|
let cell = TextFieldCell(description: String.localized("pref_your_name"), placeholder: String.localized("pref_your_name"))
|
|
let cell = TextFieldCell(description: String.localized("pref_your_name"), placeholder: String.localized("pref_your_name"))
|
|
@@ -23,7 +29,16 @@ class EditSettingsController: UITableViewController {
|
|
return cell
|
|
return cell
|
|
}()
|
|
}()
|
|
|
|
|
|
- init() {
|
|
|
|
|
|
+ lazy var accountSettingsCell: UITableViewCell = {
|
|
|
|
+ let cell = UITableViewCell(style: .value1, reuseIdentifier: nil)
|
|
|
|
+ cell.textLabel?.text = String.localized("pref_password_and_account_settings")
|
|
|
|
+ cell.accessoryType = .disclosureIndicator
|
|
|
|
+ cell.accessibilityIdentifier = "accountSettingsCell"
|
|
|
|
+ return cell
|
|
|
|
+ }()
|
|
|
|
+
|
|
|
|
+ init(dcContext: DcContext) {
|
|
|
|
+ self.dcContext = dcContext
|
|
super.init(style: .grouped)
|
|
super.init(style: .grouped)
|
|
}
|
|
}
|
|
|
|
|
|
@@ -56,14 +71,23 @@ class EditSettingsController: UITableViewController {
|
|
}
|
|
}
|
|
|
|
|
|
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
|
|
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
|
|
- return section1RowCount
|
|
|
|
|
|
+ if section == section1 {
|
|
|
|
+ return section1RowCount
|
|
|
|
+ } else {
|
|
|
|
+ return section2RowCount
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
|
|
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
|
|
- if indexPath.section == section1 && indexPath.row == section1Name {
|
|
|
|
- return displayNameCell
|
|
|
|
|
|
+ if indexPath.section == section1 {
|
|
|
|
+ if indexPath.row == section1Name {
|
|
|
|
+ return displayNameCell
|
|
|
|
+ } else {
|
|
|
|
+ return statusCell
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ return accountSettingsCell
|
|
}
|
|
}
|
|
- return statusCell
|
|
|
|
}
|
|
}
|
|
|
|
|
|
override func tableView(_: UITableView, titleForFooterInSection section: Int) -> String? {
|
|
override func tableView(_: UITableView, titleForFooterInSection section: Int) -> String? {
|
|
@@ -73,4 +97,16 @@ class EditSettingsController: UITableViewController {
|
|
return nil
|
|
return nil
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
|
|
|
|
+ guard let cell = tableView.cellForRow(at: indexPath) else { return }
|
|
|
|
+ if cell.accessibilityIdentifier == "accountSettingsCell" {
|
|
|
|
+ tableView.deselectRow(at: indexPath, animated: true)
|
|
|
|
+ guard let nc = navigationController else { return }
|
|
|
|
+ let accountSetupVC = AccountSetupController(dcContext: dcContext, editView: true)
|
|
|
|
+ let coordinator = AccountSetupCoordinator(dcContext: dcContext, navigationController: nc)
|
|
|
|
+ accountSetupVC.coordinator = coordinator
|
|
|
|
+ nc.pushViewController(accountSetupVC, animated: true)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|