Stub out all the global shortcut functions and move global shortcuts to the RootSplitViewController

This commit is contained in:
Maurice Parker 2019-09-05 11:29:04 -05:00
parent a69cb2dd77
commit efd17502e0
2 changed files with 40 additions and 12 deletions

View File

@ -30,21 +30,13 @@ class KeyboardManager {
private extension KeyboardManager { private extension KeyboardManager {
func load(type: KeyboardType) { func load(type: KeyboardType) {
let globalFile = Bundle.main.path(forResource: KeyboardType.global.rawValue, ofType: "plist")! let file = Bundle.main.path(forResource: type.rawValue, ofType: "plist")!
let globalEntries = NSArray(contentsOfFile: globalFile)! as! [[String: Any]] let entries = NSArray(contentsOfFile: file)! as! [[String: Any]]
var globalCommands = globalEntries.compactMap { createKeyCommand(keyEntry: $0) } keyCommands = entries.compactMap { createKeyCommand(keyEntry: $0) }
let specificFile = Bundle.main.path(forResource: type.rawValue, ofType: "plist")!
let specificEntries = NSArray(contentsOfFile: specificFile)! as! [[String: Any]]
let specificCommands = specificEntries.compactMap { createKeyCommand(keyEntry: $0) }
globalCommands.append(contentsOf: specificCommands)
if type == .sidebar { if type == .sidebar {
globalCommands.append(contentsOf: sidebarAuxilaryKeyCommands()) keyCommands?.append(contentsOf: sidebarAuxilaryKeyCommands())
} }
keyCommands = globalCommands
} }
func createKeyCommand(keyEntry: [String: Any]) -> UIKeyCommand? { func createKeyCommand(keyEntry: [String: Any]) -> UIKeyCommand? {

View File

@ -12,7 +12,43 @@ class RootSplitViewController: UISplitViewController {
var coordinator: SceneCoordinator! var coordinator: SceneCoordinator!
lazy var keyboardManager = KeyboardManager(type: .global, coordinator: coordinator)
override var keyCommands: [UIKeyCommand]? {
return keyboardManager.keyCommands
}
// MARK: Keyboard Shortcuts // MARK: Keyboard Shortcuts
@objc func scrollOrGoToNextUnread(_ sender: Any?) {
}
@objc func goToPreviousUnread(_ sender: Any?) {
}
@objc func nextUnread(_ sender: Any?) {
}
@objc func markRead(_ sender: Any?) {
}
@objc func markUnreadAndGoToNextUnread(_ sender: Any?) {
}
@objc func markAllAsReadAndGoToNextUnread(_ sender: Any?) {
}
@objc func markOlderArticlesAsRead(_ sender: Any?) {
}
@objc func markUnread(_ sender: Any?) {
}
@objc func goToPreviousSubscription(_ sender: Any?) {
coordinator.selectPrevFeed()
}
@objc func goToNextSubscription(_ sender: Any?) {
coordinator.selectNextFeed()
}
@objc func openInBrowser(_ sender: Any?) { @objc func openInBrowser(_ sender: Any?) {
coordinator.showBrowserForCurrentArticle() coordinator.showBrowserForCurrentArticle()