mirror of
https://github.com/Ranchero-Software/NetNewsWire.git
synced 2024-12-23 08:09:41 +01:00
Prevent global keyboard shortcuts from being executed in modal dialogs
This commit is contained in:
parent
9b17293f4e
commit
d6ea701d26
@ -20,17 +20,17 @@ class KeyboardManager {
|
||||
private(set) var keyCommands: [UIKeyCommand]?
|
||||
|
||||
init(type: KeyboardType) {
|
||||
let file = Bundle.main.path(forResource: type.rawValue, ofType: "plist")!
|
||||
let entries = NSArray(contentsOfFile: file)! as! [[String: Any]]
|
||||
keyCommands = entries.compactMap { createKeyCommand(keyEntry: $0) }
|
||||
let globalFile = Bundle.main.path(forResource: KeyboardType.global.rawValue, ofType: "plist")!
|
||||
let globalEntries = NSArray(contentsOfFile: globalFile)! as! [[String: Any]]
|
||||
keyCommands = globalEntries.compactMap { createKeyCommand(keyEntry: $0) }
|
||||
keyCommands!.append(contentsOf: globalAuxilaryKeyCommands())
|
||||
|
||||
switch type {
|
||||
case .global:
|
||||
keyCommands?.append(contentsOf: globalAuxilaryKeyCommands())
|
||||
case .sidebar:
|
||||
keyCommands?.append(contentsOf: sidebarAuxilaryKeyCommands())
|
||||
default:
|
||||
break
|
||||
let specificFile = Bundle.main.path(forResource: type.rawValue, ofType: "plist")!
|
||||
let specificEntries = NSArray(contentsOfFile: specificFile)! as! [[String: Any]]
|
||||
keyCommands!.append(contentsOf: specificEntries.compactMap { createKeyCommand(keyEntry: $0) } )
|
||||
|
||||
if type == .sidebar {
|
||||
keyCommands!.append(contentsOf: sidebarAuxilaryKeyCommands())
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -13,11 +13,6 @@ class RootSplitViewController: UISplitViewController {
|
||||
|
||||
var coordinator: SceneCoordinator!
|
||||
|
||||
private let keyboardManager = KeyboardManager(type: .global)
|
||||
override var keyCommands: [UIKeyCommand]? {
|
||||
return keyboardManager.keyCommands
|
||||
}
|
||||
|
||||
// MARK: Keyboard Shortcuts
|
||||
|
||||
@objc func scrollOrGoToNextUnread(_ sender: Any?) {
|
||||
|
Loading…
Reference in New Issue
Block a user