mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
Remove some no-longer-needed #available checks.
This commit is contained in:
@@ -73,27 +73,25 @@ final class DetailWebView: WKWebView {
|
||||
|
||||
This code adjusts the height of the window by -1pt/+1pt,
|
||||
which puts the webview back in the correct place.
|
||||
*/
|
||||
if #available(macOS 11, *) {
|
||||
guard var frame = window?.frame else {
|
||||
return
|
||||
}
|
||||
|
||||
guard !inBigSurOffsetFix else {
|
||||
return
|
||||
}
|
||||
|
||||
inBigSurOffsetFix = true
|
||||
|
||||
defer {
|
||||
inBigSurOffsetFix = false
|
||||
}
|
||||
|
||||
frame.size = NSSize(width: window!.frame.width, height: window!.frame.height - 1)
|
||||
window!.setFrame(frame, display: false)
|
||||
frame.size = NSSize(width: window!.frame.width, height: window!.frame.height + 1)
|
||||
window!.setFrame(frame, display: false)
|
||||
*/
|
||||
guard var frame = window?.frame else {
|
||||
return
|
||||
}
|
||||
|
||||
guard !inBigSurOffsetFix else {
|
||||
return
|
||||
}
|
||||
|
||||
inBigSurOffsetFix = true
|
||||
|
||||
defer {
|
||||
inBigSurOffsetFix = false
|
||||
}
|
||||
|
||||
frame.size = NSSize(width: window!.frame.width, height: window!.frame.height - 1)
|
||||
window!.setFrame(frame, display: false)
|
||||
frame.size = NSSize(width: window!.frame.width, height: window!.frame.height + 1)
|
||||
window!.setFrame(frame, display: false)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -119,19 +119,6 @@ final class DetailWebViewController: NSViewController {
|
||||
|
||||
view = webView
|
||||
|
||||
// Use the safe area layout guides if they are available.
|
||||
if #available(OSX 11.0, *) {
|
||||
// These constraints have been removed as they were unsatisfiable after removing NSBox.
|
||||
} else {
|
||||
let constraints = [
|
||||
webView.topAnchor.constraint(equalTo: view.topAnchor),
|
||||
webView.bottomAnchor.constraint(equalTo: view.bottomAnchor),
|
||||
webView.leadingAnchor.constraint(equalTo: view.leadingAnchor),
|
||||
webView.trailingAnchor.constraint(equalTo: view.trailingAnchor),
|
||||
]
|
||||
NSLayoutConstraint.activate(constraints)
|
||||
}
|
||||
|
||||
// Hide the web view until the first reload (navigation) is complete (plus some delay) to avoid the awful white flash that happens on the initial display in dark mode.
|
||||
// See bug #901.
|
||||
webView.isHidden = true
|
||||
@@ -343,10 +330,8 @@ private extension DetailWebViewController {
|
||||
}
|
||||
|
||||
func fetchScrollInfo(_ completion: @escaping (ScrollInfo?) -> Void) {
|
||||
var javascriptString = "var x = {contentHeight: document.body.scrollHeight, offsetY: document.body.scrollTop}; x"
|
||||
if #available(macOS 10.15, *) {
|
||||
javascriptString = "var x = {contentHeight: document.body.scrollHeight, offsetY: window.pageYOffset}; x"
|
||||
}
|
||||
|
||||
let javascriptString = "var x = {contentHeight: document.body.scrollHeight, offsetY: window.pageYOffset}; x"
|
||||
|
||||
webView.evaluateJavaScript(javascriptString) { (info, error) in
|
||||
guard let info = info as? [String: Any] else {
|
||||
|
||||
@@ -23,11 +23,7 @@ struct SidebarCellAppearance: Equatable {
|
||||
textFieldFontSize = 11
|
||||
case .large:
|
||||
imageSize = CGSize(width: 22, height: 22)
|
||||
if #available(macOS 11.0, *) {
|
||||
textFieldFontSize = 15
|
||||
} else {
|
||||
textFieldFontSize = 13
|
||||
}
|
||||
textFieldFontSize = 15
|
||||
default:
|
||||
imageSize = CGSize(width: 19, height: 19)
|
||||
textFieldFontSize = 13
|
||||
|
||||
@@ -56,11 +56,7 @@ struct TimelineCellAppearance: Equatable {
|
||||
|
||||
self.showIcon = showIcon
|
||||
|
||||
if #available(macOS 11.0, *) {
|
||||
cellPadding = NSEdgeInsets(top: 8.0, left: 4.0, bottom: 10.0, right: 4.0)
|
||||
} else {
|
||||
cellPadding = NSEdgeInsets(top: 8.0, left: 18.0, bottom: 10.0, right: 18.0)
|
||||
}
|
||||
cellPadding = NSEdgeInsets(top: 8.0, left: 4.0, bottom: 10.0, right: 4.0)
|
||||
|
||||
let margin = self.cellPadding.left + self.unreadCircleDimension + self.unreadCircleMarginRight
|
||||
self.boxLeftMargin = margin
|
||||
|
||||
@@ -53,27 +53,21 @@ class TimelineTableRowView : NSTableRowView {
|
||||
}
|
||||
|
||||
private func addSeparatorView() {
|
||||
|
||||
guard let cellView = cellView, separator == nil else { return }
|
||||
|
||||
separator = NSView()
|
||||
separator!.translatesAutoresizingMaskIntoConstraints = false
|
||||
separator!.wantsLayer = true
|
||||
separator!.layer?.backgroundColor = AppAssets.timelineSeparatorColor.cgColor
|
||||
|
||||
addSubview(separator!)
|
||||
if #available(macOS 11.0, *) {
|
||||
NSLayoutConstraint.activate([
|
||||
separator!.leadingAnchor.constraint(equalTo: cellView.leadingAnchor, constant: 20),
|
||||
separator!.trailingAnchor.constraint(equalTo: cellView.trailingAnchor, constant: -4),
|
||||
separator!.heightAnchor.constraint(equalToConstant: 1),
|
||||
separator!.bottomAnchor.constraint(equalTo: bottomAnchor, constant: 0)
|
||||
])
|
||||
} else {
|
||||
NSLayoutConstraint.activate([
|
||||
separator!.leadingAnchor.constraint(equalTo: cellView.leadingAnchor, constant: 34),
|
||||
separator!.trailingAnchor.constraint(equalTo: cellView.trailingAnchor, constant: -28),
|
||||
separator!.heightAnchor.constraint(equalToConstant: 1),
|
||||
separator!.bottomAnchor.constraint(equalTo: bottomAnchor, constant: 0)
|
||||
])
|
||||
}
|
||||
|
||||
NSLayoutConstraint.activate([
|
||||
separator!.leadingAnchor.constraint(equalTo: cellView.leadingAnchor, constant: 20),
|
||||
separator!.trailingAnchor.constraint(equalTo: cellView.trailingAnchor, constant: -4),
|
||||
separator!.heightAnchor.constraint(equalToConstant: 1),
|
||||
separator!.bottomAnchor.constraint(equalTo: bottomAnchor, constant: 0)
|
||||
])
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -207,10 +207,7 @@ final class TimelineViewController: NSViewController, UndoableCommandRunner, Unr
|
||||
tableView.doubleAction = #selector(openArticleInBrowser(_:))
|
||||
tableView.setDraggingSourceOperationMask(.copy, forLocal: false)
|
||||
tableView.keyboardDelegate = keyboardDelegate
|
||||
|
||||
if #available(macOS 11.0, *) {
|
||||
tableView.style = .inset
|
||||
}
|
||||
tableView.style = .inset
|
||||
|
||||
if !didRegisterForNotifications {
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(statusesDidChange(_:)), name: .StatusesDidChange, object: nil)
|
||||
|
||||
Reference in New Issue
Block a user