refactor open in app browser for mac and iOS

This commit is contained in:
Rizwan Mohamed Ibrahim 2020-05-29 19:26:20 +05:30
parent eb7ac0f076
commit d671029828
No known key found for this signature in database
GPG Key ID: D5BEE468D448BCC5
5 changed files with 14 additions and 6 deletions

View File

@ -273,7 +273,7 @@ class MainWindowController : NSWindowController, NSUserInterfaceValidations {
openArticleInBrowser(sender)
}
@objc func openFeedInAppBrowser(_ sender: Any?) {
@objc func openInAppBrowser(_ sender: Any?) {
// There is no In-App Browser for mac - so we use safari
openArticleInBrowser(sender)
}

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

@ -110,7 +110,7 @@
<key>key</key>
<string>[return]</string>
<key>action</key>
<string>openFeedInAppBrowser:</string>
<string>openInAppBrowser:</string>
</dict>
<dict>
<key>key</key>

View File

@ -178,7 +178,7 @@ private extension KeyboardManager {
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: []))
keys.append(KeyboardManager.createKeyCommand(title: openInAppBrowserTitle, action: "openArticleInAppBrowser:", 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,11 @@ class RootSplitViewController: UISplitViewController {
}
@objc func openInAppBrowser(_ sender: Any?) {
coordinator.showInAppBrowserForCurrentArticle()
coordinator.showInAppBrowserForCurrentFeed()
}
@objc func openFeedInAppBrowser(_ sender: Any?) {
coordinator.showInAppBrowserForCurrentFeed()
@objc func openArticleInAppBrowser(_ sender: Any?) {
coordinator.showInAppBrowserForCurrentArticle()
}
@objc func articleSearch(_ sender: Any?) {