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