diff --git a/Mac/MainWindow/MainWindowController.swift b/Mac/MainWindow/MainWindowController.swift index 4d068daad..eab97ca16 100644 --- a/Mac/MainWindow/MainWindowController.swift +++ b/Mac/MainWindow/MainWindowController.swift @@ -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) diff --git a/Mac/MainWindow/Sidebar/SidebarViewController.swift b/Mac/MainWindow/Sidebar/SidebarViewController.swift index 7cb181d39..a6afd8cca 100644 --- a/Mac/MainWindow/Sidebar/SidebarViewController.swift +++ b/Mac/MainWindow/Sidebar/SidebarViewController.swift @@ -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() diff --git a/Shared/Resources/GlobalKeyboardShortcuts.plist b/Shared/Resources/GlobalKeyboardShortcuts.plist index 7dab14cf5..c6288be02 100644 --- a/Shared/Resources/GlobalKeyboardShortcuts.plist +++ b/Shared/Resources/GlobalKeyboardShortcuts.plist @@ -106,11 +106,11 @@ title - Open in Browser + Open In App Browser key [return] action - openInBrowser: + openInAppBrowser: key diff --git a/iOS/KeyboardManager.swift b/iOS/KeyboardManager.swift index 581652073..a79dcd834 100644 --- a/iOS/KeyboardManager.swift +++ b/iOS/KeyboardManager.swift @@ -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])) diff --git a/iOS/RootSplitViewController.swift b/iOS/RootSplitViewController.swift index 4117a0ee7..248436129 100644 --- a/iOS/RootSplitViewController.swift +++ b/iOS/RootSplitViewController.swift @@ -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?) { diff --git a/iOS/SceneCoordinator.swift b/iOS/SceneCoordinator.swift index 8d087a51c..6d976f567 100644 --- a/iOS/SceneCoordinator.swift +++ b/iOS/SceneCoordinator.swift @@ -1185,15 +1185,16 @@ 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() { masterFeedViewController?.focus() selectArticle(nil)