refactor open in app browser with global shortcuts

This commit is contained in:
Rizwan Mohamed Ibrahim 2020-05-29 20:39:04 +05:30
parent d671029828
commit f2cd09aae3
No known key found for this signature in database
GPG Key ID: D5BEE468D448BCC5
4 changed files with 11 additions and 17 deletions

View File

@ -106,7 +106,7 @@
</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>

View File

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

View File

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

View File

@ -1185,15 +1185,16 @@ class SceneCoordinator: NSObject, UndoableCommandRunner, UnreadCountProvider {
} }
UIApplication.shared.open(url, options: [:]) 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() { func navigateToFeeds() {
masterFeedViewController?.focus() masterFeedViewController?.focus()
selectArticle(nil) selectArticle(nil)