mirror of
https://github.com/Ranchero-Software/NetNewsWire.git
synced 2025-01-31 11:14:54 +01:00
adds "Open In App Browser" shortcut
This commit is contained in:
parent
f7f7f4dddb
commit
c9ebb6bd75
@ -106,11 +106,11 @@
|
||||
</dict>
|
||||
<dict>
|
||||
<key>title</key>
|
||||
<string>Open in Safari</string>
|
||||
<string>Open in App Browser</string>
|
||||
<key>key</key>
|
||||
<string>[return]</string>
|
||||
<key>action</key>
|
||||
<string>openInSafari:</string>
|
||||
<string>openFeedInAppBrowser:</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>key</key>
|
||||
|
@ -256,6 +256,7 @@ class ArticleViewController: UIViewController {
|
||||
}
|
||||
|
||||
// MARK: Keyboard Shortcuts
|
||||
|
||||
@objc func navigateToTimeline(_ sender: Any?) {
|
||||
coordinator.navigateToTimeline()
|
||||
}
|
||||
@ -277,7 +278,10 @@ class ArticleViewController: UIViewController {
|
||||
func stopArticleExtractorIfProcessing() {
|
||||
currentWebViewController?.stopArticleExtractorIfProcessing()
|
||||
}
|
||||
|
||||
|
||||
func openInAppBrowser() {
|
||||
currentWebViewController?.openInAppBrowser()
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: WebViewControllerDelegate
|
||||
|
@ -226,7 +226,15 @@ class WebViewController: UIViewController {
|
||||
activityViewController.popoverPresentationController?.barButtonItem = popOverBarButtonItem
|
||||
present(activityViewController, animated: true)
|
||||
}
|
||||
|
||||
|
||||
func openInAppBrowser() {
|
||||
guard let preferredLink = article?.preferredLink, let url = URL(string: preferredLink) else {
|
||||
return
|
||||
}
|
||||
|
||||
let vc = SFSafariViewController(url: url)
|
||||
present(vc, animated: true)
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: ArticleExtractorDelegate
|
||||
|
@ -177,8 +177,8 @@ 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 openInAppBrowserTitle = NSLocalizedString("Open In App Browser", comment: "Open In App Browser")
|
||||
keys.append(KeyboardManager.createKeyCommand(title: openInAppBrowserTitle, action: "openInAppBrowser:", 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]))
|
||||
|
@ -11,6 +11,7 @@ import Account
|
||||
import Articles
|
||||
import RSCore
|
||||
import RSTree
|
||||
import SafariServices
|
||||
|
||||
class MasterFeedViewController: UITableViewController, UndoableCommandRunner {
|
||||
|
||||
@ -420,10 +421,6 @@ 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 {
|
||||
@ -507,7 +504,14 @@ class MasterFeedViewController: UITableViewController, UndoableCommandRunner {
|
||||
func focus() {
|
||||
becomeFirstResponder()
|
||||
}
|
||||
|
||||
|
||||
func openInAppBrowser() {
|
||||
if let indexPath = coordinator.currentFeedIndexPath,
|
||||
let url = coordinator.homePageURLForFeed(indexPath) {
|
||||
let vc = SFSafariViewController(url: url)
|
||||
present(vc, animated: true)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: UIContextMenuInteractionDelegate
|
||||
|
@ -82,8 +82,12 @@ class RootSplitViewController: UISplitViewController {
|
||||
coordinator.showBrowserForCurrentArticle()
|
||||
}
|
||||
|
||||
@objc func openInSafari(_ sender: Any?) {
|
||||
coordinator.showSafariForCurrentArticle()
|
||||
@objc func openInAppBrowser(_ sender: Any?) {
|
||||
coordinator.showInAppBrowserForCurrentArticle()
|
||||
}
|
||||
|
||||
@objc func openFeedInAppBrowser(_ sender: Any?) {
|
||||
coordinator.showInAppBrowserForCurrentFeed()
|
||||
}
|
||||
|
||||
@objc func articleSearch(_ sender: Any?) {
|
||||
|
@ -1185,19 +1185,12 @@ 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 showInAppBrowserForCurrentArticle() {
|
||||
articleViewController?.openInAppBrowser()
|
||||
}
|
||||
|
||||
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 showInAppBrowserForCurrentFeed() {
|
||||
masterFeedViewController.openInAppBrowser()
|
||||
}
|
||||
|
||||
func navigateToFeeds() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user