diff --git a/iOS/KeyboardManager.swift b/iOS/KeyboardManager.swift index b5d6742b9..0af53e80e 100644 --- a/iOS/KeyboardManager.swift +++ b/iOS/KeyboardManager.swift @@ -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()) + + 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) } ) - switch type { - case .global: - keyCommands?.append(contentsOf: globalAuxilaryKeyCommands()) - case .sidebar: - keyCommands?.append(contentsOf: sidebarAuxilaryKeyCommands()) - default: - break + if type == .sidebar { + keyCommands!.append(contentsOf: sidebarAuxilaryKeyCommands()) } } diff --git a/iOS/RootSplitViewController.swift b/iOS/RootSplitViewController.swift index 3ea657a2a..c02d23594 100644 --- a/iOS/RootSplitViewController.swift +++ b/iOS/RootSplitViewController.swift @@ -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?) {