Add selected row expanding and collapsing keyboard shortcuts
This commit is contained in:
parent
c9fd7d01d9
commit
953259f0d3
@ -404,6 +404,20 @@ class MasterFeedViewController: UITableViewController, UndoableCommandRunner {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@objc func expandSelectedRows(_ sender: Any?) {
|
||||||
|
if let indexPath = coordinator.currentFeedIndexPath {
|
||||||
|
coordinator.expand(indexPath)
|
||||||
|
self.applyChanges(animate: true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@objc func collapseSelectedRows(_ sender: Any?) {
|
||||||
|
if let indexPath = coordinator.currentFeedIndexPath {
|
||||||
|
coordinator.collapse(indexPath)
|
||||||
|
self.applyChanges(animate: true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// MARK: API
|
// MARK: API
|
||||||
|
|
||||||
func updateFeedSelection() {
|
func updateFeedSelection() {
|
||||||
|
@ -465,6 +465,7 @@ class SceneCoordinator: NSObject, UndoableCommandRunner, UnreadCountProvider {
|
|||||||
|
|
||||||
func expand(_ indexPath: IndexPath) {
|
func expand(_ indexPath: IndexPath) {
|
||||||
let expandNode = shadowTable[indexPath.section][indexPath.row]
|
let expandNode = shadowTable[indexPath.section][indexPath.row]
|
||||||
|
guard !expandedNodes.contains(expandNode) else { return }
|
||||||
expandedNodes.append(expandNode)
|
expandedNodes.append(expandNode)
|
||||||
|
|
||||||
animatingChanges = true
|
animatingChanges = true
|
||||||
@ -499,6 +500,7 @@ class SceneCoordinator: NSObject, UndoableCommandRunner, UnreadCountProvider {
|
|||||||
animatingChanges = true
|
animatingChanges = true
|
||||||
|
|
||||||
let collapseNode = shadowTable[indexPath.section][indexPath.row]
|
let collapseNode = shadowTable[indexPath.section][indexPath.row]
|
||||||
|
guard expandedNodes.contains(collapseNode) else { return }
|
||||||
if let removeNode = expandedNodes.firstIndex(of: collapseNode) {
|
if let removeNode = expandedNodes.firstIndex(of: collapseNode) {
|
||||||
expandedNodes.remove(at: removeNode)
|
expandedNodes.remove(at: removeNode)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user