From efd17502e08e17aebb77efa96c9db52488342823 Mon Sep 17 00:00:00 2001 From: Maurice Parker Date: Thu, 5 Sep 2019 11:29:04 -0500 Subject: [PATCH] Stub out all the global shortcut functions and move global shortcuts to the RootSplitViewController --- iOS/KeyboardManager.swift | 16 ++++---------- iOS/RootSplitViewController.swift | 36 +++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 12 deletions(-) diff --git a/iOS/KeyboardManager.swift b/iOS/KeyboardManager.swift index 7bef03e86..d9729dfb3 100644 --- a/iOS/KeyboardManager.swift +++ b/iOS/KeyboardManager.swift @@ -30,21 +30,13 @@ class KeyboardManager { private extension KeyboardManager { func load(type: KeyboardType) { - let globalFile = Bundle.main.path(forResource: KeyboardType.global.rawValue, ofType: "plist")! - let globalEntries = NSArray(contentsOfFile: globalFile)! as! [[String: Any]] - var globalCommands = globalEntries.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) + let file = Bundle.main.path(forResource: type.rawValue, ofType: "plist")! + let entries = NSArray(contentsOfFile: file)! as! [[String: Any]] + keyCommands = entries.compactMap { createKeyCommand(keyEntry: $0) } if type == .sidebar { - globalCommands.append(contentsOf: sidebarAuxilaryKeyCommands()) + keyCommands?.append(contentsOf: sidebarAuxilaryKeyCommands()) } - - keyCommands = globalCommands } func createKeyCommand(keyEntry: [String: Any]) -> UIKeyCommand? { diff --git a/iOS/RootSplitViewController.swift b/iOS/RootSplitViewController.swift index fe63a7d28..6e4750c29 100644 --- a/iOS/RootSplitViewController.swift +++ b/iOS/RootSplitViewController.swift @@ -12,7 +12,43 @@ class RootSplitViewController: UISplitViewController { var coordinator: SceneCoordinator! + lazy var keyboardManager = KeyboardManager(type: .global, coordinator: coordinator) + override var keyCommands: [UIKeyCommand]? { + return keyboardManager.keyCommands + } + // 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?) { coordinator.showBrowserForCurrentArticle()