This commit is contained in:
relikd
2020-03-19 00:05:43 +01:00
parent 188a130825
commit 126da073a5
53 changed files with 2476 additions and 593 deletions

View File

@@ -0,0 +1,41 @@
import UIKit
class TVCDomains: UITableViewController, IncrementalDataSourceUpdate {
internal var dataSource: [GroupedDomain] = []
override func viewDidLoad() {
super.viewDidLoad()
if #available(iOS 10.0, *) {
tableView.refreshControl = UIRefreshControl(call: #selector(reloadDataSource), on: self)
}
NotifyLogHistoryReset.observe(call: #selector(reloadDataSource), on: self)
reloadDataSource()
DBWrp.dataA_delegate = self
}
@objc func reloadDataSource() {
dataSource = DBWrp.listOfDomains()
tableView.reloadData()
}
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if let index = tableView.indexPathForSelectedRow?.row {
(segue.destination as? TVCHosts)?.parentDomain = dataSource[index].domain
}
}
// MARK: - Table View Delegate
override func tableView(_ _: UITableView, numberOfRowsInSection _: Int) -> Int { dataSource.count }
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "DomainCell")!
let entry = dataSource[indexPath.row]
cell.textLabel?.text = entry.domain
cell.detailTextLabel?.text = entry.detailCellText
cell.imageView?.image = entry.options?.tableRowImage()
return cell
}
}