mirror of
https://github.com/Ranchero-Software/NetNewsWire.git
synced 2025-02-02 12:06:58 +01:00
adds keyboard shortcuts for open in Safari
This commit is contained in:
parent
8f8bd229c5
commit
f7f7f4dddb
@ -106,11 +106,11 @@
|
||||
</dict>
|
||||
<dict>
|
||||
<key>title</key>
|
||||
<string>Open in Browser</string>
|
||||
<string>Open in Safari</string>
|
||||
<key>key</key>
|
||||
<string>[return]</string>
|
||||
<key>action</key>
|
||||
<string>openInBrowser:</string>
|
||||
<string>openInSafari:</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>key</key>
|
||||
|
@ -177,6 +177,9 @@ private extension KeyboardManager {
|
||||
let openInBrowserTitle = NSLocalizedString("Open In Browser", comment: "Open In Browser")
|
||||
keys.append(KeyboardManager.createKeyCommand(title: openInBrowserTitle, action: "openInBrowser:", input: UIKeyCommand.inputRightArrow, modifiers: [.command]))
|
||||
|
||||
let openInSafariTitle = NSLocalizedString("Open In Safari", comment: "Open In Safari")
|
||||
keys.append(KeyboardManager.createKeyCommand(title: openInSafariTitle, action: "openInSafari:", input: "\r", modifiers: []))
|
||||
|
||||
let toggleReadTitle = NSLocalizedString("Toggle Read Status", comment: "Toggle Read Status")
|
||||
keys.append(KeyboardManager.createKeyCommand(title: toggleReadTitle, action: "toggleRead:", input: "u", modifiers: [.command, .shift]))
|
||||
|
||||
|
@ -420,6 +420,10 @@ class MasterFeedViewController: UITableViewController, UndoableCommandRunner {
|
||||
@objc func openInBrowser(_ sender: Any?) {
|
||||
coordinator.showBrowserForCurrentFeed()
|
||||
}
|
||||
|
||||
@objc func openInSafari(_ sender: Any?) {
|
||||
coordinator.showSafariForCurrentFeed()
|
||||
}
|
||||
|
||||
@objc override func delete(_ sender: Any?) {
|
||||
if let indexPath = coordinator.currentFeedIndexPath {
|
||||
|
@ -81,6 +81,10 @@ class RootSplitViewController: UISplitViewController {
|
||||
@objc func openInBrowser(_ sender: Any?) {
|
||||
coordinator.showBrowserForCurrentArticle()
|
||||
}
|
||||
|
||||
@objc func openInSafari(_ sender: Any?) {
|
||||
coordinator.showSafariForCurrentArticle()
|
||||
}
|
||||
|
||||
@objc func articleSearch(_ sender: Any?) {
|
||||
coordinator.showSearch()
|
||||
|
@ -12,6 +12,7 @@ import Account
|
||||
import Articles
|
||||
import RSCore
|
||||
import RSTree
|
||||
import SafariServices
|
||||
|
||||
enum PanelMode {
|
||||
case unset
|
||||
@ -1183,6 +1184,21 @@ class SceneCoordinator: NSObject, UndoableCommandRunner, UnreadCountProvider {
|
||||
}
|
||||
UIApplication.shared.open(url, options: [:])
|
||||
}
|
||||
|
||||
func showSafariForCurrentFeed() {
|
||||
if let ip = currentFeedIndexPath, let url = homePageURLForFeed(ip) {
|
||||
let vc = SFSafariViewController(url: url)
|
||||
rootSplitViewController.viewControllers.last?.present(vc, animated: true)
|
||||
}
|
||||
}
|
||||
|
||||
func showSafariForCurrentArticle() {
|
||||
guard let preferredLink = currentArticle?.preferredLink, let url = URL(string: preferredLink) else {
|
||||
return
|
||||
}
|
||||
let vc = SFSafariViewController(url: url)
|
||||
rootSplitViewController.viewControllers.last?.present(vc, animated: true)
|
||||
}
|
||||
|
||||
func navigateToFeeds() {
|
||||
masterFeedViewController?.focus()
|
||||
|
Loading…
x
Reference in New Issue
Block a user