Merge pull request #2121 from rizwankce/fix/in-app-browser-shortcut

fix open in app browser for mac and iOS
This commit is contained in:
Maurice Parker 2020-05-29 10:13:07 -05:00 committed by GitHub
commit 9a82d2e233
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 25 additions and 18 deletions

View File

@ -274,6 +274,11 @@ class MainWindowController : NSWindowController, NSUserInterfaceValidations {
openArticleInBrowser(sender)
}
@objc func openInAppBrowser(_ sender: Any?) {
// There is no In-App Browser for mac - so we use safari
openArticleInBrowser(sender)
}
@IBAction func openInBrowserUsingOppositeOfSettings(_ sender: Any?) {
if let link = currentLink {
Browser.open(link, inBackground: !AppDefaults.openInBrowserInBackground)

View File

@ -240,6 +240,14 @@ protocol SidebarDelegate: class {
Browser.open(homePageURL, invertPreference: NSApp.currentEvent?.modifierFlags.contains(.shift) ?? false)
}
@objc func openInAppBrowser(_ sender: Any?) {
// There is no In-App Browser for mac - so we use safari
guard let feed = singleSelectedWebFeed, let homePageURL = feed.homePageURL else {
return
}
Browser.open(homePageURL, invertPreference: NSApp.currentEvent?.modifierFlags.contains(.shift) ?? false)
}
@IBAction func gotoToday(_ sender: Any?) {
selectFeed(SmartFeedsController.shared.todayFeed)
focus()

View File

@ -106,11 +106,11 @@
</dict>
<dict>
<key>title</key>
<string>Open in Browser</string>
<string>Open In App Browser</string>
<key>key</key>
<string>[return]</string>
<key>action</key>
<string>openInBrowser:</string>
<string>openInAppBrowser:</string>
</dict>
<dict>
<key>key</key>

View File

@ -177,9 +177,6 @@ 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 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]))

View File

@ -83,11 +83,7 @@ class RootSplitViewController: UISplitViewController {
}
@objc func openInAppBrowser(_ sender: Any?) {
coordinator.showInAppBrowserForCurrentArticle()
}
@objc func openFeedInAppBrowser(_ sender: Any?) {
coordinator.showInAppBrowserForCurrentFeed()
coordinator.showInAppBrowser()
}
@objc func articleSearch(_ sender: Any?) {

View File

@ -1186,12 +1186,13 @@ class SceneCoordinator: NSObject, UndoableCommandRunner, UnreadCountProvider {
UIApplication.shared.open(url, options: [:])
}
func showInAppBrowserForCurrentArticle() {
articleViewController?.openInAppBrowser()
}
func showInAppBrowserForCurrentFeed() {
masterFeedViewController.openInAppBrowser()
func showInAppBrowser() {
if currentArticle != nil {
articleViewController?.openInAppBrowser()
}
else {
masterFeedViewController.openInAppBrowser()
}
}
func navigateToFeeds() {