Skip to content

Commit

Permalink
fixed QA finding (8): keyboard commands for search and sort order whe…
Browse files Browse the repository at this point in the history
…re missing in directory picker
  • Loading branch information
hosy committed Apr 16, 2021
1 parent 0ea4bb9 commit 002ee67
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 19 deletions.
22 changes: 4 additions & 18 deletions ownCloud/Key Commands/KeyCommands.swift
Original file line number Diff line number Diff line change
Expand Up @@ -679,7 +679,7 @@ extension ClientQueryViewController {
shortcuts.append(nextObjectCommand)
}

if let core = core, let rootItem = query.rootItem {
if let core = core, let rootItem = query.rootItem, !isMoreButtonPermanentlyHidden {
var item = rootItem
if let indexPath = self.tableView?.indexPathForSelectedRow, let selectedItem = itemAt(indexPath: indexPath) {
item = selectedItem
Expand Down Expand Up @@ -789,7 +789,7 @@ extension QueryFileListTableViewController {
}
}

if let core = core, let rootItem = query.rootItem {
if let core = core, let rootItem = query.rootItem, !isMoreButtonPermanentlyHidden {
var item = rootItem
if let indexPath = self.tableView?.indexPathForSelectedRow, let selectedItem = itemAt(indexPath: indexPath) {
item = selectedItem
Expand Down Expand Up @@ -914,22 +914,8 @@ extension ClientDirectoryPickerViewController {
open override var keyCommands: [UIKeyCommand]? {
var shortcuts = [UIKeyCommand]()

let nextObjectCommand = UIKeyCommand(input: UIKeyCommand.inputDownArrow, modifierFlags: [], action: #selector(selectNext), discoverabilityTitle: "Select Next".localized)
let previousObjectCommand = UIKeyCommand(input: UIKeyCommand.inputUpArrow, modifierFlags: [], action: #selector(selectPrevious), discoverabilityTitle: "Select Previous".localized)
let selectObjectCommand = UIKeyCommand(input: UIKeyCommand.inputRightArrow, modifierFlags: [], action: #selector(selectCurrent), discoverabilityTitle: "Open Selected".localized)

if let selectedIndexPath = self.tableView?.indexPathForSelectedRow {
if selectedIndexPath.row < self.items.count - 1 {
shortcuts.append(nextObjectCommand)
}
if selectedIndexPath.row > 0 || selectedIndexPath.section > 0 {
shortcuts.append(previousObjectCommand)
}
if let item : OCItem = self.itemAt(indexPath: selectedIndexPath), item.type == OCItemType.collection {
shortcuts.append(selectObjectCommand)
}
} else {
shortcuts.append(nextObjectCommand)
if let superKeyCommands = super.keyCommands {
shortcuts.append(contentsOf: superKeyCommands)
}

if let selectButtonTitle = selectButton?.title, let selector = selectButton?.action {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ open class ClientDirectoryPickerViewController: ClientQueryViewController {
open var selectButton: UIBarButtonItem?
private var selectButtonTitle: String?
private var cancelBarButton: UIBarButtonItem?

open var directoryPath : String?

open var choiceHandler: ClientDirectoryPickerChoiceHandler?
Expand Down Expand Up @@ -115,6 +114,8 @@ open class ClientDirectoryPickerViewController: ClientQueryViewController {

// Disable pull to refresh
allowPullToRefresh = false

isMoreButtonPermanentlyHidden = true
}

required public init?(coder aDecoder: NSCoder) {
Expand Down

0 comments on commit 002ee67

Please sign in to comment.