Merge pull request #2073 from rizwankce/open-in-safari-shortcut
Keyboard shortcuts for "Open in App Browser"
This commit is contained in:
commit
225c98a70e
@ -106,11 +106,11 @@
|
|||||||
</dict>
|
</dict>
|
||||||
<dict>
|
<dict>
|
||||||
<key>title</key>
|
<key>title</key>
|
||||||
<string>Open in Browser</string>
|
<string>Open in App Browser</string>
|
||||||
<key>key</key>
|
<key>key</key>
|
||||||
<string>[return]</string>
|
<string>[return]</string>
|
||||||
<key>action</key>
|
<key>action</key>
|
||||||
<string>openInBrowser:</string>
|
<string>openFeedInAppBrowser:</string>
|
||||||
</dict>
|
</dict>
|
||||||
<dict>
|
<dict>
|
||||||
<key>key</key>
|
<key>key</key>
|
||||||
|
@ -256,6 +256,7 @@ class ArticleViewController: UIViewController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// MARK: Keyboard Shortcuts
|
// MARK: Keyboard Shortcuts
|
||||||
|
|
||||||
@objc func navigateToTimeline(_ sender: Any?) {
|
@objc func navigateToTimeline(_ sender: Any?) {
|
||||||
coordinator.navigateToTimeline()
|
coordinator.navigateToTimeline()
|
||||||
}
|
}
|
||||||
@ -278,6 +279,9 @@ class ArticleViewController: UIViewController {
|
|||||||
currentWebViewController?.stopArticleExtractorIfProcessing()
|
currentWebViewController?.stopArticleExtractorIfProcessing()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func openInAppBrowser() {
|
||||||
|
currentWebViewController?.openInAppBrowser()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: WebViewControllerDelegate
|
// MARK: WebViewControllerDelegate
|
||||||
|
@ -228,6 +228,14 @@ class WebViewController: UIViewController {
|
|||||||
present(activityViewController, animated: true)
|
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
|
// MARK: ArticleExtractorDelegate
|
||||||
|
@ -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 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")
|
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]))
|
||||||
|
|
||||||
|
@ -11,6 +11,7 @@ import Account
|
|||||||
import Articles
|
import Articles
|
||||||
import RSCore
|
import RSCore
|
||||||
import RSTree
|
import RSTree
|
||||||
|
import SafariServices
|
||||||
|
|
||||||
class MasterFeedViewController: UITableViewController, UndoableCommandRunner {
|
class MasterFeedViewController: UITableViewController, UndoableCommandRunner {
|
||||||
|
|
||||||
@ -515,6 +516,13 @@ class MasterFeedViewController: UITableViewController, UndoableCommandRunner {
|
|||||||
becomeFirstResponder()
|
becomeFirstResponder()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func openInAppBrowser() {
|
||||||
|
if let indexPath = coordinator.currentFeedIndexPath,
|
||||||
|
let url = coordinator.homePageURLForFeed(indexPath) {
|
||||||
|
let vc = SFSafariViewController(url: url)
|
||||||
|
present(vc, animated: true)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: UIContextMenuInteractionDelegate
|
// MARK: UIContextMenuInteractionDelegate
|
||||||
|
@ -82,6 +82,14 @@ class RootSplitViewController: UISplitViewController {
|
|||||||
coordinator.showBrowserForCurrentArticle()
|
coordinator.showBrowserForCurrentArticle()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@objc func openInAppBrowser(_ sender: Any?) {
|
||||||
|
coordinator.showInAppBrowserForCurrentArticle()
|
||||||
|
}
|
||||||
|
|
||||||
|
@objc func openFeedInAppBrowser(_ sender: Any?) {
|
||||||
|
coordinator.showInAppBrowserForCurrentFeed()
|
||||||
|
}
|
||||||
|
|
||||||
@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
|
||||||
@ -1184,6 +1185,14 @@ class SceneCoordinator: NSObject, UndoableCommandRunner, UnreadCountProvider {
|
|||||||
UIApplication.shared.open(url, options: [:])
|
UIApplication.shared.open(url, options: [:])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func showInAppBrowserForCurrentArticle() {
|
||||||
|
articleViewController?.openInAppBrowser()
|
||||||
|
}
|
||||||
|
|
||||||
|
func showInAppBrowserForCurrentFeed() {
|
||||||
|
masterFeedViewController.openInAppBrowser()
|
||||||
|
}
|
||||||
|
|
||||||
func navigateToFeeds() {
|
func navigateToFeeds() {
|
||||||
masterFeedViewController?.focus()
|
masterFeedViewController?.focus()
|
||||||
selectArticle(nil)
|
selectArticle(nil)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user