Added MasterTableViewCellDelegate.

This commit is contained in:
Maurice Parker 2019-04-17 10:34:10 -05:00
parent bb20e4d2a2
commit c9beee89ab
3 changed files with 21 additions and 2 deletions

View File

@ -916,9 +916,9 @@
51C45260226508F600C03939 /* Cell */ = {
isa = PBXGroup;
children = (
51C45261226508F600C03939 /* MasterUnreadCountView.swift */,
51C45262226508F600C03939 /* MasterTableViewCell.swift */,
51C45263226508F600C03939 /* MasterTableViewCellLayout.swift */,
51C45261226508F600C03939 /* MasterUnreadCountView.swift */,
);
path = Cell;
sourceTree = "<group>";

View File

@ -11,10 +11,16 @@ import RSCore
import Account
import RSTree
protocol MasterTableViewCellDelegate: class {
func disclosureSelected(_ sender: MasterTableViewCell, expanding: Bool)
}
class MasterTableViewCell : UITableViewCell {
private var accessoryButton: UIButton?
weak var delegate: MasterTableViewCellDelegate?
override var accessibilityLabel: String? {
set {}
get {
@ -108,12 +114,14 @@ class MasterTableViewCell : UITableViewCell {
if sender.imageView?.image == AppAssets.chevronRightImage {
sender.setImage(AppAssets.chevronDownImage, for: .normal)
delegate?.disclosureSelected(self, expanding: true)
} else {
sender.setImage(AppAssets.chevronRightImage, for: .normal)
delegate?.disclosureSelected(self, expanding: false)
}
}
}
private extension MasterTableViewCell {

View File

@ -287,6 +287,7 @@ class MasterViewController: UITableViewController, UndoableCommandRunner {
// MARK: API
func configure(_ cell: MasterTableViewCell, _ node: Node) {
cell.delegate = self
cell.name = nameFor(node)
configureUnreadCount(cell, node)
configureFavicon(cell, node)
@ -391,6 +392,16 @@ extension MasterViewController: UIDocumentPickerDelegate {
}
// MARK: MasterTableViewCellDelegate
extension MasterViewController: MasterTableViewCellDelegate {
func disclosureSelected(_ sender: MasterTableViewCell, expanding: Bool) {
// let indexSet = tableView.indexPath(for: sender)
}
}
// MARK: Private
private extension MasterViewController {