Skip to content

Commit

Permalink
make subsequent dialogs contain a simple 'back'
Browse files Browse the repository at this point in the history
  • Loading branch information
r10s committed Jul 26, 2024
1 parent 8ceb5d0 commit 70dcb23
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 50 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,6 @@ class CertificateCheckController: UITableViewController {
var selectedIndex: Int?
weak var delegate: CertificateCheckDelegate?

var okButton: UIBarButtonItem {
let button = UIBarButtonItem(title: String.localized("ok"), style: .done, target: self, action: #selector(okButtonPressed))
return button
}

var cancelButton: UIBarButtonItem {
let button = UIBarButtonItem(title: String.localized("cancel"), style: .plain, target: self, action: #selector(cancelButtonPressed))
return button
}

var staticCells: [UITableViewCell] {
return options.map({
let cell = UITableViewCell(style: .default, reuseIdentifier: nil)
Expand All @@ -46,13 +36,6 @@ class CertificateCheckController: UITableViewController {
fatalError("init(coder:) has not been implemented")
}

override func viewDidLoad() {
super.viewDidLoad()

navigationItem.rightBarButtonItem = okButton
navigationItem.leftBarButtonItem = cancelButton
}

// MARK: - Table view data source

override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
Expand Down Expand Up @@ -89,18 +72,10 @@ class CertificateCheckController: UITableViewController {
currentValue = options[newIndex]
}
selectedIndex = index
}

@objc private func okButtonPressed() {
delegate?.onCertificateCheckChanged(newValue: currentValue)
navigationController?.popViewController(animated: true)
}

@objc private func cancelButtonPressed() {
navigationController?.popViewController(animated: true)
}

class ValueConverter {
class ValueConverter {
static func convertHexToString(value: Int) -> String {
switch value {
case Int(DC_CERTCK_AUTO):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,6 @@ class SecuritySettingsController: UITableViewController {
private var selectedIndex: Int
weak var delegate: SecuritySettingsDelegate?

private var okButton: UIBarButtonItem {
let button = UIBarButtonItem(title: String.localized("ok"), style: .done, target: self, action: #selector(okButtonPressed))
return button
}

private var cancelButton: UIBarButtonItem {
let button = UIBarButtonItem(title: String.localized("cancel"), style: .plain, target: self, action: #selector(cancelButtonPressed))
return button
}

private var staticCells: [UITableViewCell] {
return options.map {
let cell = UITableViewCell(style: .default, reuseIdentifier: nil)
Expand All @@ -40,12 +30,6 @@ class SecuritySettingsController: UITableViewController {
fatalError("init(coder:) has not been implemented")
}

override func viewDidLoad() {
super.viewDidLoad()
navigationItem.rightBarButtonItem = okButton
navigationItem.leftBarButtonItem = cancelButton
}

// MARK: - Table view data source

override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
Expand All @@ -71,15 +55,7 @@ class SecuritySettingsController: UITableViewController {
cell.accessoryType = .checkmark
}
selectedIndex = indexPath.row
}

@objc func okButtonPressed() {
delegate?.onSecuritySettingsChanged(newValue: Int(options[selectedIndex]))
navigationController?.popViewController(animated: true)
}

@objc func cancelButtonPressed() {
navigationController?.popViewController(animated: true)
}
}

Expand Down

0 comments on commit 70dcb23

Please sign in to comment.