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]?
|
private(set) var keyCommands: [UIKeyCommand]?
|
||||||
|
|
||||||
init(type: KeyboardType) {
|
init(type: KeyboardType) {
|
||||||
let file = Bundle.main.path(forResource: type.rawValue, ofType: "plist")!
|
let globalFile = Bundle.main.path(forResource: KeyboardType.global.rawValue, ofType: "plist")!
|
||||||
let entries = NSArray(contentsOfFile: file)! as! [[String: Any]]
|
let globalEntries = NSArray(contentsOfFile: globalFile)! as! [[String: Any]]
|
||||||
keyCommands = entries.compactMap { createKeyCommand(keyEntry: $0) }
|
keyCommands = globalEntries.compactMap { createKeyCommand(keyEntry: $0) }
|
||||||
|
keyCommands!.append(contentsOf: globalAuxilaryKeyCommands())
|
||||||
|
|
||||||
switch type {
|
let specificFile = Bundle.main.path(forResource: type.rawValue, ofType: "plist")!
|
||||||
case .global:
|
let specificEntries = NSArray(contentsOfFile: specificFile)! as! [[String: Any]]
|
||||||
keyCommands?.append(contentsOf: globalAuxilaryKeyCommands())
|
keyCommands!.append(contentsOf: specificEntries.compactMap { createKeyCommand(keyEntry: $0) } )
|
||||||
case .sidebar:
|
|
||||||
keyCommands?.append(contentsOf: sidebarAuxilaryKeyCommands())
|
if type == .sidebar {
|
||||||
default:
|
keyCommands!.append(contentsOf: sidebarAuxilaryKeyCommands())
|
||||||
break
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,11 +13,6 @@ class RootSplitViewController: UISplitViewController {
|
|||||||
|
|
||||||
var coordinator: SceneCoordinator!
|
var coordinator: SceneCoordinator!
|
||||||
|
|
||||||
private let keyboardManager = KeyboardManager(type: .global)
|
|
||||||
override var keyCommands: [UIKeyCommand]? {
|
|
||||||
return keyboardManager.keyCommands
|
|
||||||
}
|
|
||||||
|
|
||||||
// MARK: Keyboard Shortcuts
|
// MARK: Keyboard Shortcuts
|
||||||
|
|
||||||
@objc func scrollOrGoToNextUnread(_ sender: Any?) {
|
@objc func scrollOrGoToNextUnread(_ sender: Any?) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user