Don't do shift-key detection in Browser
This commit is contained in:
parent
e79cafc82e
commit
24338b135e
|
@ -6,16 +6,14 @@
|
|||
// Copyright © 2016 Ranchero Software, LLC. All rights reserved.
|
||||
//
|
||||
|
||||
import AppKit
|
||||
import Foundation
|
||||
import RSWeb
|
||||
|
||||
struct Browser {
|
||||
|
||||
static func open(_ urlString: String) {
|
||||
let shouldInvertPreference = NSApp.currentEvent?.modifierFlags.contains(.shift) ?? false
|
||||
|
||||
static func open(_ urlString: String, invertPreference invert: Bool = false) {
|
||||
// Opens according to prefs.
|
||||
open(urlString, inBackground: shouldInvertPreference ? !AppDefaults.openInBrowserInBackground : AppDefaults.openInBrowserInBackground)
|
||||
open(urlString, inBackground: invert ? !AppDefaults.openInBrowserInBackground : AppDefaults.openInBrowserInBackground)
|
||||
}
|
||||
|
||||
static func open(_ urlString: String, inBackground: Bool) {
|
||||
|
|
|
@ -182,7 +182,7 @@ class MainWindowController : NSWindowController, NSUserInterfaceValidations {
|
|||
if let item = item as? NSMenuItem, item.keyEquivalentModifierMask.contains(.shift) {
|
||||
item.title = Browser.titleForOpenInBrowserInverted
|
||||
}
|
||||
|
||||
|
||||
return currentLink != nil
|
||||
}
|
||||
|
||||
|
@ -264,8 +264,10 @@ class MainWindowController : NSWindowController, NSUserInterfaceValidations {
|
|||
}
|
||||
|
||||
@IBAction func openArticleInBrowser(_ sender: Any?) {
|
||||
let invert = NSApp.currentEvent?.modifierFlags.contains(.shift) ?? false
|
||||
|
||||
if let link = currentLink {
|
||||
Browser.open(link)
|
||||
Browser.open(link, invertPreference: invert)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -296,8 +296,10 @@ final class TimelineViewController: NSViewController, UndoableCommandRunner, Unr
|
|||
// MARK: - Actions
|
||||
|
||||
@objc func openArticleInBrowser(_ sender: Any?) {
|
||||
let invert = NSApp.currentEvent?.modifierFlags.contains(.shift) ?? false
|
||||
|
||||
if let link = oneSelectedArticle?.preferredLink {
|
||||
Browser.open(link)
|
||||
Browser.open(link, invertPreference: invert)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue